slight improvements to options and error checking