move some memory alloc to relevant problem