Refactoring: eliminate duplication (OMS-332)
Formatting for PEP8 (OMS-332)