minor changes. struggling to find memory leak