Added check for "" case in map.

And moved checks into a separate method.