Reorganize code, endpoints, and files