rewritten function with returning set of Integer