changed structure a bit, has errors