Added code for creating the internal map