Refactored to make it more like a standard Express application