Refactor map to use dynamic size