Taken locks and resources refactored. Statics eliminated