There is virtually no shared code for the client, extract it into its own module and do away with the switches.