Implement list function and use it in reverse function