Refactored gratuity.php into component files