added array support for the reverse method