Fixing the case where a single char is provided from breaking the algorithm
- Also making the algorithm more verbose, for the sake of readability