app config setTreshold(); add comments and refactor