Updated some math functions