Added logout functionality with its E2E and unit tests and did some tidy up