Initial work at freeing memory