Implemented the second part of exercise 3.4 (memory access)