optimize the code for qa shells