Improved command sending functionality