used sub templates for code reuse