step 1 - refactor authentication