Modify command/flag functions to return errors