remove hard coded limits, use template to determine array sizes