more testing; more refactoring; fixed the client template