still needs timing and has a few warnings during compile.