update and clean code