added write entry function