added tests for for branches and updated the visitor to handle special for cases