important bugfixes and updates:
the code is yet not cleaned and might contain useless print statements
DSG