Added the joi function