Fixed allocation bugs (it was allocating one too small vectors) but it still is very buggy, thus not applied.