Improved weight vector generation a lot by tweaking how the memory is allocated
Further improvements to performance