optimizing and debugging