Added database functionality and filter functionality