move GetOption out of loop