Added proper initialization of counter value.
Added map memory.