eig function working