Fixed bugs, organized methods, and refactored a little bit.