Switched to an array based implementation