Reformated code (moved things around, categorized, etc.).