added new structure and improved userLogged