Altered JS code to fix edit button press