fixed logic issue, updated threshold, and fixed output format