Major refactoring due to static void issues