added code to check for admin logged in