Implemented sqlite database functionality