Upgraded definition checking and cleaning