Updated to work with loginbefore join