Refactor refresh token handling