Updated code to simplify map usage