Some more changes, needs testing.