complete contrl logic