Major refactor to help support spyd being a standalone application and be more easily configurable.