Changes in set() function, and a test() function added.