Completed not_bad function