tip calc refactor