Added a simple mark-and-sweep garbage collection. Running the gc twice currently still results in an error.