getting security to work and cleanup