Fixed smartform and added tests.