refactor increasing loc for readability