diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb
index e161f6acded699c35bd8e51e452caac9bc0a90e3..f530489145cab5b426d3b9d13f99e446f8a755e6 100644
--- a/app/controllers/people_controller.rb
+++ b/app/controllers/people_controller.rb
@@ -6,7 +6,7 @@ class PeopleController < ApplicationController
       @people = current_user.friends.paginate :page => params[:page], :order => 'created_at DESC'
       render :index
     else
-      @people = Person.search_for_friends(params[:q])
+      @people = Person.search(params[:q])
       render :json => @people.to_json(:only => :_id)
     end
   end
diff --git a/app/models/person.rb b/app/models/person.rb
index afd48bea51cc311d77ac053f1f0d5fca0e2fe0f5..5ce5394bd3901fd2a2045b40f32e9fe74019106b 100644
--- a/app/models/person.rb
+++ b/app/models/person.rb
@@ -35,8 +35,10 @@ class Person
   after_destroy :remove_all_traces
 
   
-  def self.search_for_friends(query)
-    Person.all('$where' => "function() { return this.profile.first_name.match(/^#{query}/i) || this.profile.last_name.match(/^#{query}/i); }")
+  def self.search(query)
+    Person.all('$where' => "function() { return this.email.match(/^#{query}/i) ||
+               this.profile.first_name.match(/^#{query}/i) ||
+               this.profile.last_name.match(/^#{query}/i); }")
   end
  
   def real_name
diff --git a/spec/controllers/people_controller_spec.rb b/spec/controllers/people_controller_spec.rb
index f0cea02799f1dee5660dbe1c0d94a0106febb968..f448f9f364a1921ec06a9d76edce47588d28e309 100644
--- a/spec/controllers/people_controller_spec.rb
+++ b/spec/controllers/people_controller_spec.rb
@@ -3,59 +3,16 @@ require File.dirname(__FILE__) + '/../spec_helper'
 describe PeopleController do
   render_views
   before do
-    @user = Factory.create(:user, :profile => Profile.new( :first_name => "bob", :last_name => "smith"))
+    @user = Factory.create(:user)
     request.env['warden'] = mock_model(Warden, :authenticate? => @user, :authenticate! => @user, :authenticate => @user)
 
     sign_in :user, @user   
   end
 
   it "index should yield search results for substring of person name" do
-    friend_one = Factory.create(:person)
-    friend_two = Factory.create(:person)
-    friend_three = Factory.create(:person)
-    friend_four = Factory.create(:person)
-
-    friend_one.profile.first_name = "Robert"
-    friend_one.profile.last_name = "Grimm"
-    friend_one.profile.save
-
-    friend_two.profile.first_name = "Eugene"
-    friend_two.profile.last_name = "Weinstein"
-    friend_two.save
-
-    friend_three.profile.first_name = "Yevgeniy"
-    friend_three.profile.last_name = "Dodis"
-    friend_three.save
-
-    friend_four.profile.first_name = "Casey"
-    friend_four.profile.last_name = "Grippi"
-    friend_four.save
-
-
-    puts Person.friends.count
+    Person.should_receive(:search)
 
     get :index, :q => "Eu"
-
-
-    assigns[:people].include?(friend_two).should == true
-    assigns[:people].include?(friend_one).should == false
-    assigns[:people].include?(friend_three).should == false
-    assigns[:people].include?(friend_four).should == false
-
-    get :index, :q => "Wei"
-    assigns[:people].include?(friend_two).should == true
-    assigns[:people].include?(friend_one).should == false
-    assigns[:people].include?(friend_three).should == false
-    assigns[:people].include?(friend_four).should == false
-
-    get :index, :q => "Gri"
-    assigns[:people].include?(friend_one).should == true
-    assigns[:people].include?(friend_four).should == true
-    assigns[:people].include?(friend_two).should == false
-    assigns[:people].include?(friend_three).should == false
-
-    get :index
-    assigns[:people].should == Person.friends.all
   end
 
 end
diff --git a/spec/controllers/requests_controller_spec.rb b/spec/controllers/requests_controller_spec.rb
new file mode 100644
index 0000000000000000000000000000000000000000..579ee620efa8ab2b76442d0d762c11b32af4d4cb
--- /dev/null
+++ b/spec/controllers/requests_controller_spec.rb
@@ -0,0 +1,15 @@
+require File.dirname(__FILE__) + '/../spec_helper'
+include ApplicationHelper 
+include RequestsHelper 
+describe RequestsController do
+    before do 
+    @tom = Redfinger.finger('tom@tom.joindiaspora.com')
+    @evan = Redfinger.finger('evan@status.net')
+    @max = Redfinger.finger('mbs348@gmail.com')
+  end
+    it 'should return the correct tag and url for a given address' do
+      relationship_flow('tom@tom.joindiaspora.com')[:friend].include?("receive/user").should ==  true
+    end
+
+
+end
diff --git a/spec/models/person_spec.rb b/spec/models/person_spec.rb
index c062d396b65222007c77b7acd38e779902ae5585..44ca3c8347965260de15976c48e0e784349a3ea3 100644
--- a/spec/models/person_spec.rb
+++ b/spec/models/person_spec.rb
@@ -96,5 +96,47 @@ describe Person do
       Person.all.count.should == 3
     end
   end
-
+  describe 'searching' do
+    before do
+      @friend_one = Factory.create(:person)
+      @friend_two = Factory.create(:person)
+      @friend_three = Factory.create(:person)
+      @friend_four = Factory.create(:person)
+
+      @friend_one.profile.first_name = "Robert"
+      @friend_one.profile.last_name = "Grimm"
+      @friend_one.profile.save
+
+      @friend_two.profile.first_name = "Eugene"
+      @friend_two.profile.last_name = "Weinstein"
+      @friend_two.save
+
+      @friend_three.profile.first_name = "Yevgeniy"
+      @friend_three.profile.last_name = "Dodis"
+      @friend_three.save
+
+      @friend_four.profile.first_name = "Casey"
+      @friend_four.profile.last_name = "Grippi"
+      @friend_four.save
+    end
+    it 'should yield search results on partial names' do
+      people = Person.search("Eu") 
+      people.include?(@friend_two).should == true
+      people.include?(@friend_one).should == false
+      people.include?(@friend_three).should == false
+      people.include?(@friend_four).should == false
+
+      people = Person.search("Wei") 
+      people.include?(@friend_two).should == true
+      people.include?(@friend_one).should == false
+      people.include?(@friend_three).should == false
+      people.include?(@friend_four).should == false
+
+      people = Person.search("Gri") 
+      people.include?(@friend_one).should == true
+      people.include?(@friend_four).should == true
+      people.include?(@friend_two).should == false
+      people.include?(@friend_three).should == false
+    end
+  end
 end