Added some JavaDoc and further code-cleanup