Probably should use numpy here.