Cleaned up a lot of redundant code in the estimate sat3d program.