Modified to replace # when we ant to count items in an array. Code currently not cleaned after correction.