Security changes. Some refactor ant tmp-things cleaning