working on math logic