More SQL backend stuff, i'll push more later but perhaps somebody is bored and wants to review code

although now that I'm reworking exit code checking I'm starting to wonder if we even need the local db
Yeah I'm thinking I'll somehow use some kind of code. Maybe I should add that in