Places gc call in more appropriate places