added memory purge script and housekeeping