Half-done work on restructuring. Fix later.