Refactored tip calculator