tweaked: moved parsing of arguments out to own function, added logic to check for sane threshold values.