added reverse mode