Split mainController file into five different files, under the server di...

...rectory.