refactor to try out longs for speed
refactor to try out longs for speed