Moved Python code to separate file