First refactor of rangewizard