refactoring of the backend