Moved memory to variable and cleaned up comments