update server.js logic for step 4