added logic to form