Refactor Shell API, which is a lot.