finished essential math funcs