Refactored server code to Express