Made authetication work as intended