Added / changed some code to help with debugging.