moved getops into function