Created two calculating functions, +1 for cleanliness