performance improvement: reduce num of call of setTo