Converted all code to Python and fixed majority of logic bugs