refactored and tested OOP string calc