Re-implement all communication between client and server with .type flags, functional again