moved client only code to a macro; solves #11