Cleaned up code, changed noise flag to nonoise flag to be consistent with nocri flag.