added formatting, more db ops