Remove redundant array, fixed png and jpeg printing