redesign template; trivial optimize