reorganization functions js