Calculate refactored and tested

Refactored to return a fraction instead