added an option to invert signals