Fixed error checking on the queries. Added a .destroy function