This proc is too similar to dosend(). Remove the duplication please.