major overhaul and refactor, seperated various logic out into different files, changed external messages to be sqlite driven rather than flat file