Enforce better type checking and limit range of counter