Refactored backend