Changed protocol code, tested it and fixed some things.