Refactoring png.rb (just a little bit)