Update extract.rb

major overhaul