add comments and fix offline sending