allocate function now returns starting positions