improved the logic and loops examples