added database and delete options and some additional fixes