refactored server side code into folder