made the algorithm dynamic, it can take either int or strings and convert them into the proper format.