improved readability through replacing if != nil with unless nil?