Improvment when clearing databse