Added support for multiple functions and multiple units