Based on work done by @fusiondog in #1583, extend the concept to use an integer instead of a boolean. Fixes: #1583 && #1481