Improved performance speed via xrange and made white spacing 'more pythonic'