adding more handling of edge cases regarding what inputs are available. and some more stupid debug code.