First working copy with appmessage
Fixed logging
Seperated gui update code into seperate function