major overhaul of backend