Restructured code for editing rule and Updated route for edit