Cleaned up

- Optimized code.
- Renamed and moved methods.