Some refactoring, added sets