first working implementation.
first working implementation