Refacter the API part of the codebase

Tidied up a few of the API/express related files, as well as abstracted away the clustering code.