Improvements to the input API.
Work in progress.