added tests and template for ending