spigot algorithms