implement primary deallocation

some docstrings would be nice that explain how this deallocator works