rewrite range class, multiple improvements