generalize code to eliminate templates, use slice types instead of structs