Refactor on function containsDot