control.lua by rk84 as starting point