updated version from @yr