File cleanup: fix space/tab whitespace, fix indentation, removed commented code, added error logging in exception catches.