code refactor. Extracted commitRange logic into separate class