Organized the code and took out a few bugs.