Fixed main RAM usage bug.  Added lots of small changes.