get alex's magic into my fork

Just getting your changes into my fork @aredington