refactored access loggin