unified 'else if' clause into 'elseif' for better performance