Complete refactoring of train class for PEP8 compliance.