code clean up phase 1