Clean up and refactoring of backend
Documentation for backend done