Changed '== None' and '!= None' to 'is None' and 'is not None', respectively.
Encapsulated log file and lock into a Log object. Commented out port changing logic until bugs are resolved.