Beginning massive refactor - removing global  stuff and making things more node-able