adding in test with demo. also adding javadoc