Cleaned up a bit, added deallocations for the integers