make the code more readable and replaced further statements with "mem"
functions!