Cleaned up code extensively, still need comments on lots of lines. All

obsolete code is gone.