change write methods to use more generic calls