Applications provider refactoring, memory leak fixed