add sqlite manager, refactor code