1. added logging code for performance tracking