some cleanup

removes 'rows' since it is not used anywhere
replaced 'popen' with 'subprocess' since popen call is deprecated