some snippet for parsing template