It ain't pretty but it appears to be working.

TODO:
Clean up main, make the the getting of bugs more streamlined and easier to implement.