Mas code cleanup