How would you refactor your project code to improve modularity, and what additional unit tests would you write to prevent regressions?