[Minor] Code cleanup

Added Junit4 and refactored tests which were main methods to be proper
JUnits. Cleaned up code and added JavaDoc. Fixed compiler warnings