Cleaned up the Code massively.

- Comments
- JavaDoc
- Added a few useful methods.
- Fixed a few bugs.