more code clean up and update