finished backend refactoring now to frontend