Remove database file and refactor code