fix bug related to calculating alpha, should use p rather than fixed value.  also fixed getIndex function based on correction from paper