Added a few security checks