give each thread its own db connection
add events orders errors
refactor to make sql orientated
update