Bug fix to imports management and code cleanup