Code Cleanup & added javadocs