Fixes and cleanup