Refactor to use non-dynamic memory (arduino not good with extensive heap use)