Cleaned code involving pointers