Cleanup and provide helper function.