break server main() into parts 1