refactor tip calculator