Factor out long opts since I now realize getopts doesn't support them. Also use local variables in helper file.