moved encapsulation to index template