Finished the python script
's core functionality