Edited order of if,elses