basic implementation of intersection