Make session form generation more generic