made changes to use eigen