modularized the server start code