created a filter proc, reducing main proc code