Index: flowtimer/RecurringPhaseSequence.py
===================================================================
--- flowtimer/RecurringPhaseSequence.py	(revision 813e855eac7ce0884d4d8b35d681840957775bae)
+++ flowtimer/RecurringPhaseSequence.py	(revision 8f41b95d4b55aa3b2af4f8c54fb96896aee07fef)
@@ -37,5 +37,5 @@
         self.current_phase = phases[0]
         self.initial_repetitions = repetitions
-        self.passes_left = repetitions
+        self.passes_left = repetitions - 1
 
     def to_json(self):
@@ -80,4 +80,5 @@
 
     def is_final_round(self):
+        print("Final round", self.passes_left)
         return self.passes_left == 0
 
@@ -107,8 +108,10 @@
         else:
             if self.is_final_round():
+                print("Abort on final round")
                 self.abort()
                 return
             else:
                 self.passes_left -= 1
+                print("Skip", self.passes_left)
                 self.current_phase.reset()
                 self.current_phase = self.phases[0]
@@ -125,4 +128,5 @@
             if self.passes_left < 1:
                 self._state = "completed"
+                print("Passes left", self.passes_left)
             else:
                 self.current_phase.reset()
Index: flowtimer/Schedule.py
===================================================================
--- flowtimer/Schedule.py	(revision 813e855eac7ce0884d4d8b35d681840957775bae)
+++ flowtimer/Schedule.py	(revision 8f41b95d4b55aa3b2af4f8c54fb96896aee07fef)
@@ -114,4 +114,10 @@
         self._state = "aborted"
 
+    def current_phase(self):
+        if self.current_block.is_sequence():
+            return self.current_block.current_phase
+        else:
+            return self.current_block
+
     def current_block_is_final(self):
         index = self.blocks.index(self.current_block)
@@ -150,6 +156,5 @@
             self.abort()
             return
-        index = self.blocks.index(self.current_block)
-        self.current_block = self.blocks[index+1]
+        self.advance_to_next_block()
         return
 
@@ -167,10 +172,4 @@
         return []
 
-    def current_phase(self):
-        if self.current_block.is_sequence():
-            return self.current_block.current_phase
-        else:
-            return self.current_block
-
     def tick(self, ticks):
         if not self.is_completed():
Index: flowtimer/__init__.py
===================================================================
--- flowtimer/__init__.py	(revision 813e855eac7ce0884d4d8b35d681840957775bae)
+++ flowtimer/__init__.py	(revision 8f41b95d4b55aa3b2af4f8c54fb96896aee07fef)
@@ -0,0 +1,25 @@
+import logging
+import logging.config
+import os
+from pathlib import Path
+
+# FIXME: change the default log path to /var/log/flowtimer/flowtimer.log when system configuration created this dir
+# with the appropriate rights
+
+log_dir = Path(os.environ.get('FLOWTIMER_LOG_DIR', '/tmp/'))
+
+log_path = log_dir / 'flowtimer.log'
+
+if not log_path.exists():
+    try:
+        log_path.touch()
+    except PermissionError:
+        conf_file = Path(__file__).parent / 'flowtimer_logging.conf'
+        print("Conf file", conf_file)
+        logging.config.fileConfig(conf_file)
+else:
+    logging.basicConfig(filename=str(log_path), encoding='utf-8', level=logging.DEBUG)
+
+logger = logging.getLogger(__name__)
+
+logger.setLevel(os.environ.get('FLOWTIMER_LOG_LEVEL', logger.getEffectiveLevel()))
Index: tests/test_recurring_phase_sequence.py
===================================================================
--- tests/test_recurring_phase_sequence.py	(revision 813e855eac7ce0884d4d8b35d681840957775bae)
+++ tests/test_recurring_phase_sequence.py	(revision 8f41b95d4b55aa3b2af4f8c54fb96896aee07fef)
@@ -24,5 +24,5 @@
         assert data['_state'] == "initial"
         assert data['initial_repetitions'] == 3
-        assert data['passes_left'] == 3
+        assert data['passes_left'] == 2
         assert len(data['phases']) == 3
 
@@ -30,5 +30,5 @@
         assert recurring_phase_sequence.state() == "initial"
         assert recurring_phase_sequence.current_phase.title == "Tasking"
-        assert recurring_phase_sequence.passes_left == 3
+        assert recurring_phase_sequence.passes_left == 2
 
     def test_current_phase_number(self, recurring_phase_sequence):
@@ -70,13 +70,13 @@
         recurring_phase_sequence.tick(6)
         assert recurring_phase_sequence.current_phase.title == "Work"
-        assert recurring_phase_sequence.passes_left == 3
+        assert recurring_phase_sequence.passes_left == 2
 
         recurring_phase_sequence.tick(45)
         assert recurring_phase_sequence.current_phase.title == "Break"
-        assert recurring_phase_sequence.passes_left == 3
+        assert recurring_phase_sequence.passes_left == 2
 
         recurring_phase_sequence.tick(15)
         assert recurring_phase_sequence.current_phase.title == "Tasking"
-        assert recurring_phase_sequence.passes_left == 2
+        assert recurring_phase_sequence.passes_left == 1
 
     def test_unrolled(self, recurring_phase_sequence):
