updated form logic