added dynamic criteria building