Update desktops.py

Broke one function into several other functions.