removed the value check for null;
looped through indexes while set