Cleaning some stuff up, changes untested.