Code modifications based on review by Jeremy