Added finished code with migration