A fully working implementation.