Refactoring after dygraph integration