Moved things around and fixed a minor bug