minor refactoring, fixed d3-layer issue