Merge the last bit of Diego's code with the modifications: