Added some javadoc, removed unused imports, fixed the first of many bugs.