Created a function to check for logged on users