Split the backend code into more files, in preparation for a bigger revamp