implementing auto and manual mode