Added tests; cleaned up javadoc