better handling of elses and else-ifs