Switched to typed arrays for increased performance