Lots of changes for img sync