logout added + cleanere code