Updated python code blocks