Wrote basic insert/select logic