Refactored OS-specific functions, PEP8