added send confirmation, cleaned code