switched to python version for more organized code