Python code readability + fixes