Boilerplate code for client handling