compilation fixes

merged your changes and got code to at least compile cleanly, still some way to go