Outlined the server handler loop