Made python source more modular and proper