You have the exact same nested function above - move out of nested scopes and consolidate. And also check for 0xFFFE.