split main to dedicated listen and accept