Code cleaning and update