refactored to be eloquent ruby
fixed to_frac to handle casses when string is nil
fixed the nil exception