Fix Mac addr to yaml bug and some small refactors