Merge pull request #80 from Edzelopez/RG-141

RG-141 Fixed allocation algorithm for batch calculations
RG-141 Fixed finalize function