Added check for valid signatures