Adding some needed conditions and removing some extra whitespace.