correction isset to !isset
functions file, refactor function logged in