Trying to fix the wrapping function.

Failed to fix the wrapping function, ended up breaking it, so I reverted
it to an earlier less usable way of doing it, before I kill something.
I'll come back and work on it later.