Sort imports and address minor PEP 8 style issues