finalized classifyByTemplate, database header in sp class