Implemented scoping for message class methods and some other refactoring related to names and typedefs.