Be smarter about -x and stuff. Closes #689