Refactor module upgrade.
Merge pull request #18 from Ormira/mergev1.2

Refactor module upgrade.