image grid creation unified, Refactoring