add db singleton; clean up EOF newlines