Add types, fix bug in map, refactor range