Backend slightly refactored