Move client functionality into a dedicated file
Add an uncut function to parse raw payload