Refactor to db.clear, WIP