adding logic for handling forms