Security updates and layer deletion

Added dedicated functions to check security profiles
Changed security checks to be exception based
Added function to delete layers