cleaned up logic

added some functionality
Merge pull request #8 from danbonilla/math_logic_v2

cleaned up logic