with autoload and a bit of cleaning up