tested + minor bugfixes