Major refactor. Separate classes logically.