some variable changes and indentation,+ server sends messages now