refactor and fix string in stroke calculator