updated form function