Added logout confirmation, fixed bugs