fixed reverse() so it runs in-place instead of as new-returning