Refactoring of the core. Files renamed. Some logic moved from bat to sh