implement writeCard