Refactored to python coding standards