added tip calculation logic