Done some radical changes in functions and expressions.