Move functionality from frontend to backend