fixed structure of the package added background send thread added close function for terminating the background thread