add math functions and some docs