code clean up, and several improvements