Removing ind2sub calls from functions