converting form to function