extracted function for setting where statements