Some refactoring
Template changes