merged joe's code into mine. still not working, but getting closer.