Initial commit of code. It seems to run for the samples I tested, so hopefully its mostly working. As bugs are found, I will try to fix them.