replaced arrays with sets