Move cleanup_db() up so that it does not show as a big diff