Backend: More refactoring