add math functions for main program, change return types for math functions