Consolidate & update Python code