Moved utility functions to MGComponent class