backend refactoring