Made changes to add some more debug information
not sure what has changed here.