Added some JavaDoc comments and JUnit tests