Backend refactoring