shuffling code around to clear errors in webform