finished a working implementation.