added cluster detection code to router object