Added support for image migrations by using common code from instance migrations.. Code cleanup