Added addapted version of serialthread and message def