added timestamping and made client more flexible