Controller logic added, start procedure and output optimized.