Corrected some error handling issues.
Corrected missing variable reference
Console output tweak
Removed unnecessary if statement and console output.