Security, small redesign and refactoring