added a variation of format range with a class parameter so you can force the type