Cleaned up code and remove the unnecessary pass to build pointers.