Final code after demos