removed code duplication and allocated right amount of memory

shaved of 0.5 seconds for whitted integrator and soaps