Refactoring common endpoints, adding source tests.