added logic to populate a form with existing data