Adapting templates to design