Added algorithm for getting marker matrix.