refactored usage of integers as algorithm and rewrite identifier