code cleanup, new counter for memory checks