Added comments explaining the select statement checking integrity