Add code for deallocate() and test output