memory v5 - changes to pass test

removed reuse of variable name by removing unnecessary function