Refactored for PEP8, Pylint, multiple ui inheritance, clearer var names, file encoding, etc.