MyMp = new Mongo.Collection('mp');

if (Meteor.isClient) {

  Session.setDefault('searching', false);

  Tracker.autorun(function(){
    if(Session.get('postcode')){
      var twfyHandle = Meteor.subscribe('twfySearch', Session.get('postcode'));
      Session.set('searching', ! twfyHandle.ready());
    }
  });



  Template.searchForm.events({
    'submit form': function(event, template) {
      event.preventDefault();
      var postcode = template.$('input[type=text]').val();

      if (postcode) {
        Session.set('postcode', postcode);
      }
    }
  });

  Template.body.helpers({
    mymp: function() {
      return MyMp.find();
    },
    searching: function() {
      return Session.get('searching');
    }
  });


}

if (Meteor.isServer) {
  Meteor.startup(function () {
    // code to run on server at startup
  });

  Meteor.publish('twfySearch', function(postcode){

    console.log(postcode);
    var self = this;
    var APIKEY = '';

    try {
      var resp = HTTP.get('http://www.theyworkforyou.com/api/getMP', {
        params: {
          'postcode': postcode,
          'output': 'js',
          'key': APIKEY
        }
      });
      console.log(resp);

      self.added('mymp', Random.id(), resp);
      self.ready();

    } catch (error) {
      console.log(error);
    }
  });
}

@@ -271,17 +271,16 @@
 hing', !
- 
 twfyHand
@@ -305,18 +305,16 @@
 %0A  %7D);%0A%0A
-%0A%0A
   Templa
@@ -761,196 +761,69 @@
 eor.
-startup(function () %7B%0A    // code to run on server at startup%0A  %7D);%0A%0A  Meteor.publish('twfySearch', function(postcode)%7B%0A%0A    console.log(postcode);%0A    var self = this;%0A    var APIKEY = ''
+publish('twfySearch', function(postcode)%7B%0A    var self = this
 ;%0A%0A 
@@ -995,16 +995,20 @@
  'key': 
+TWFY
 APIKEY%0A 
@@ -1029,33 +1029,8 @@
  %7D);
-%0A      console.log(resp);
 %0A%0A  

Tidy up of code