improved rotation in dtopotools.py