added some changes, not bugfree!