added wrapping by words algorithm