Adds more endpoints and a bit more refactoring.