making type inference work with multiple axes and proper handling of axis=None
figuring out recursive application of optimizations