merged with formhub master

brings in optimization work done on templates and submission counts, reduced queries.