used index for better performance, and changed the find method