Refactoring backend