refactor unwind.rb

refactored for code climate.