Changed messagehandler to have a connection variable instead of passing it around...