Added heap setup. Refactoring.

Also added description of mark-sweep collection.