Modified to work with form