working, more efficient version of inputs.py