New function (combineStocks) and little changes on diagnostic function.

Signed-off-by: Luis Lau <luis.laum@gmail.com>