This is constant space.  I think it could be less code