Removed commented out code and unnessesary casting.
Wrote some javadocs.