Improved usage of db_ functions