Fixed some JS issues and added delete function.