Working with Legacy Code: Tips and Best Practices