Merge

Cleaned up endpoints and tests, ready for integration with front-end