implemented reverse iteration