FInalised login functionality