finished implementing find-related middleware