changing template helper class strucure to avoid as much code duplication as possible