initial flicker() function, improve setOutput()