Updated range function.

Hopefully fixes #9 and I removed the unnecessary break statement.