Added some Javadoc documentation and refactored to reduce unnecessary code visibility