clean and update code