use defer chaining instead of inlinecallbacks and yield statement for command sequence