Decoupled server code from main