the start of the range function, and some commenting

Signed-off-by: Alexander Skjolden <alex@plastboks.net>