refactoring and bugfixes; usernames in chat