Added secong if to conditional.