read whole request. cleanup main