viewer improved, intersection check added