Cleaned code structure

- Organized code based on file comments