New version with some fixes in pointers