simplied server code and got the messages ready