Proper nesting for else if - fixes #1