support unconnected inputs, and some cleanup