refactoring to make the reason for the if (division by 0) a little clearer
remove test of sparse array - it fails in ie 8 and it really isn't a neccessary test