Added defragmentation methods to cpp and python bindings.