getting closer to a working implementation