More refactorings and add some fixes around centerize image