Revert "Lots of small fixes, some merged from dropbox integration branch"

This reverts commit 43c04b60d4b388668dd20fdc315c9a34911d4392.