Reformatted code and some additions to JavaDoc