Cleaned up code and added capability to delete definitions