Refactored gift code