Fixing notation issues and improving semantincs around the codebase