Refactored initial search (still is progress)