written most of library functions for sender