fixing the formatting for EXISTS
adding some support for semicolons