converted all templates to proper parts
converted to proper library.