getting closer.  still a few bugs and edge cases i need to account for