I reinserted all previous changes lost because I'm an idiot. See previous
commits to see what is included here.