Rewritten the try / exception handling for better pythonic standards..