STEP 5 - LOGGING (code organized better for readability)