Some fixes and updated javadoc