Cleanup and added some Javadocs