Java doc added where required. Some very small bits of code cleaned up a little