Update security check to be smarter