refactor centerNode()