Merge "Refactor partition and image handling."