Restructured and simplified the backend