caution: added some debugging stuff (mainly printfs) which are not really neccessary and have to get removed some time.
-camoz