Replaced tmp() and logs() with 'defer' syntax