using containsKey instead of null checking