Added feature to insert results into table if desired