fixed database and added search functionality