some clean up, and started to use eigen