put back conditional elements code
fix indentation
forgot to put previous_element lines in