Code enhancements, fixed some typos, enhanced javadoc.