UPDATE - Final code