Updated Code with changes requested by Andrea