Major refactoring of runtime handling to support starting and stopping etc