Cleanup/bugfixes