improvements math functions template