Modularized the server-side code