refactoring and security updateand better example.