Added logout function (again)

Could get the branche merged again, don't really understand what's
going on and what i'm missing so i copypasted it again