Eliminate ptr variable