various tweaks here and there and revised debugging a little. Still probably should pull the debugging out a little more what I have is a bit of a hack.