Move default assigments inside corresponding ifs