Updated the code with test classes and changed all Lists to Sets