Fix issue #5 Code repetition