Updated to do security checks multiple places