refactor loyalty