Finished implementation, added javadoc comments