Copyright notices, new magic number for socket

Also code cleanup