code clean up and changes