added algebraic functions
improved enormously