Fixed an issue with multiple functions and made the expression handling better