fix up javadoc and potential memory management issues