replaced unix calls with python functions