Adapt code
Fixes
Cleanup