added some javadoc and did some refactoring; also removed extraneous package