Added comments explaining python code