Implemented module scoping (for memory optimization)