Rewrite get_cursor(); factor out database info; add command