Delete function.
Refactor JS