Cleanup entitlement code - add validation function