modify math logic