Started refactoring and working on getting search groups function