Implement reordering. Closes #3