refactoring process.py code to not use dataframe unnecessarily, closes #41