Fix categorised hazard pop function

Fixed categorical threshold and added user configurable threshold.