work in progress. about to remove a lot of code
started creating tests for error and insert