cleanup of templates, implemented grid better