save memory by using ptr