working health threshold added to util and add a parameter to main