Added free() to destructor to avoid memory leak