Added JavaDoc and comments