refactoring with backends and tests