Moving functions around, adding javadoc comments