same refactoring. Images output improved