Added JavaDoc comments and cleaned up the code to meet the checkstyle rules.