refactored formSearch and added sample