Lots of stuff fixed, see description

User can now login, logout, recieves messages and passes all the tests
for UC1 and UC2. UC3 functionality left to implement and test.