Modifications to allow moaiimages to be explicitly cleared. Also add the stack check thing that was reccomended