Cleaned up unused code and added JavaDocs