added reverse gecoding logic