Fix another issue where an input was used twice. Add unit tests, again.