added debugging code
resolved merge conflicts
merged with work done on tarnhelm