Organized code. Refactored a bit.