fixed A so it's only constructed once and made calculation be by reference. Barely/no noticeable difference (I think it went from 20 times to closer to 21 times, but hard to tell.