Changed range to xrange for much faster execution
Added interactivity