code refactorign, now joined user will be stored in db