added another method for getting text width & performance improvements