First version of unbalanced code