starting to implement the autowrap feature (intermediate, not working yet)