added some basic loop checks
upgraded loop checker with expression calculator