Changing athe logic to handle options