added option for reverse flag