second implementation
reverse works
a better reverse