Exec refactoring

Remember to merge https://github.com/appium/appium/pull/4103 after this.
same here?