writing reply generating routines