Increased memory limit and included some memory cleanup