Re-write to use Data.Vector.