Fixes

Bugfixes + changes to code