caption adding mechnic nokogiri refactored