abstracted check logged in function to services.js