Add several functions for DB writing.