bunch of improvements, multiple inputs, counters, etc.