added the free function