Switched to stack allocation, leak memory in remove