Refactor and added tests for imx_mach_id