copied form function into module