made improvements by using database recipe