so..spent all morning messing with this and the last test I did seemed to work pretty good. Going to commit, need to clean a lot of the code though