Small changed, using range() instead of deprecated xrange()