Refactoring default callback for possible memory leak.