Cleaned python code