Updated code to use options