extracted method
changed to none recursive call