added template, cleaned up