Refactor earnXP logic.