Refactored tax calc