a few bugs gone, code still doesn't work, I'll try to spend some time with it in the evening.