refactoring, singleton application & template manager