Refactor some common code current endpoints and tests. Update some endpoint javadoc. A few small optimizations