Main and core modules refactored and improved