Improved messages and socket communication