Moved logic to the frontend.