tidying
added intersection logic rather than hard coding union
tidying