Refactoring code by encapsulating chain inside Dollar namespace