Add migrate function that reads yaml

Fix #2