Small errors fixed. still prob with template