replaced math functions