Added support for function inputs, simplifications