Fixed bug which gave an error when more than two elements were calculated. Also, added a check to speed-up processing of multi-elements.