Added conditional to the code.