James' changes reimplemented

Sorry, James! They're back.