Used subprocess some more and made the logout part a bit more modular