added shutter sequence and main loop code