Added clear listener and cleaned up _db reference