Added error checking to options