cleaned up form validation and configured JSON only responses for cleaner code