Final code