Refactored array deallocation to be moar better