Code cleanup

Changed the scope of variables.
Started working on code that deletes events.
Event removal now working.