moved array resize code into a different source file