added completed flag and end event