updated code to reflect new learning