Altered array pre-allocation to use memory in case of tests
Fixed bad function reference