Added exclude bad id's code