Some minor changes - needs test.