refactor use of derby-templates