Added javadoc and additional inline comments