for the whole previous code, adjust indentations with do, if and else, and check indentation of rest