Updated pull request for pointer arithmetic and clearing issues

Hi Andy, I've rearranged my commits as per what we discussed before.
Thanks,
Yitzik