added dynamic fill method, trim text, replace multiple spaces with a single space, minified