Re implemented add_code