implemented reverse and map