diff --git a/src/management/nfd-controller.cpp b/src/management/nfd-controller.cpp
index 7a99693..19e98f8 100644
--- a/src/management/nfd-controller.cpp
+++ b/src/management/nfd-controller.cpp
@@ -10,6 +10,7 @@
 #include "nfd-controller.hpp"
 #include "nfd-fib-management-options.hpp"
 #include "nfd-face-management-options.hpp"
+#include "nfd-strategy-choice-options.hpp"
 #include "nfd-control-response.hpp"
 
 namespace ndn {
@@ -123,29 +124,73 @@
                               onSuccess, onFail),
                          bind(onFail, "Command Interest timed out"));
 }
-
+  
 void
 Controller::processFaceCommandResponse(Data& data,
                                        const FaceCommandSucceedCallback& onSuccess,
                                        const FailCallback& onFail)
 {
   /// \todo Add validation of incoming Data
-
+  
   try
-    {
-      ControlResponse response(data.getContent().blockFromValue());
-      if (response.getCode() != 200)
-        return onFail(response.getText());
-
-      FaceManagementOptions options(response.getBody());
-      return onSuccess(options);
-    }
+  {
+    ControlResponse response(data.getContent().blockFromValue());
+    if (response.getCode() != 200)
+      return onFail(response.getText());
+    
+    FaceManagementOptions options(response.getBody());
+    return onSuccess(options);
+  }
   catch(ndn::Tlv::Error& e)
-    {
-      if (static_cast<bool>(onFail))
-        return onFail(e.what());
-    }
+  {
+    if (static_cast<bool>(onFail))
+      return onFail(e.what());
+  }
 }
 
+void
+Controller::startStrategyChoiceCommand(const std::string& command,
+                                       const StrategyChoiceOptions& options,
+                                       const StrategyChoiceCommandSucceedCallback& onSuccess,
+                                       const FailCallback& onFail)
+{
+  Name strategyChoiceCommandInterestName("/localhost/nfd/strategy-choice");
+  strategyChoiceCommandInterestName
+    .append(command)
+    .append(options.wireEncode());
+  
+  Interest strategyChoiceCommandInterest(strategyChoiceCommandInterestName);
+  m_commandInterestGenerator.generate(strategyChoiceCommandInterest);
+  
+  m_face.expressInterest(strategyChoiceCommandInterest,
+                         bind(&Controller::processStrategyChoiceCommandResponse, this, _2,
+                              onSuccess, onFail),
+                         bind(onFail, "Command Interest timed out"));
+}
+void
+Controller::processStrategyChoiceCommandResponse(
+    Data& data,
+    const StrategyChoiceCommandSucceedCallback& onSuccess,
+    const FailCallback& onFail)
+{
+  /// \todo Add validation of incoming Data
+  
+  try
+  {
+    ControlResponse response(data.getContent().blockFromValue());
+    if (response.getCode() != 200)
+      return onFail(response.getText());
+    
+    StrategyChoiceOptions options(response.getBody());
+    return onSuccess(options);
+  }
+  catch (ndn::Tlv::Error& error)
+  {
+    if (static_cast<bool>(onFail))
+      return onFail(error.what());
+  }
+}
+
+  
 } // namespace nfd
 } // namespace ndn
diff --git a/src/management/nfd-controller.hpp b/src/management/nfd-controller.hpp
index a864db3..cb7f37b 100644
--- a/src/management/nfd-controller.hpp
+++ b/src/management/nfd-controller.hpp
@@ -16,13 +16,15 @@
 
 class FibManagementOptions;
 class FaceManagementOptions;
-
+class StrategyChoiceOptions;
+  
 class Controller : public ndn::Controller
 {
 public:
   typedef function<void(const FibManagementOptions&)> FibCommandSucceedCallback;
   typedef function<void(const FaceManagementOptions&)> FaceCommandSucceedCallback;
-
+  typedef function<void(const StrategyChoiceOptions&)> StrategyChoiceCommandSucceedCallback;
+  
   /**
    * @brief Construct ndnd::Control object
    */
@@ -88,6 +90,12 @@
                    const FaceCommandSucceedCallback& onSuccess,
                    const FailCallback& onFailure);
 
+  void
+  startStrategyChoiceCommand(const std::string& command,
+                             const StrategyChoiceOptions& options,
+                             const StrategyChoiceCommandSucceedCallback& onSuccess,
+                             const FailCallback& onFailure);
+  
 private:
   void
   processFibCommandResponse(Data& data,
@@ -99,6 +107,11 @@
                              const FaceCommandSucceedCallback& onSuccess,
                              const FailCallback& onFail);
 
+  void
+  processStrategyChoiceCommandResponse(Data& data,
+                                       const StrategyChoiceCommandSucceedCallback& onSuccess,
+                                       const FailCallback& onFail);
+
 protected:
   Face& m_face;
   CommandInterestGenerator m_commandInterestGenerator;
diff --git a/src/management/nfd-strategy-choice-options.hpp b/src/management/nfd-strategy-choice-options.hpp
new file mode 100644
index 0000000..60d846d
--- /dev/null
+++ b/src/management/nfd-strategy-choice-options.hpp
@@ -0,0 +1,163 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+* Copyright (C) 2014 Named Data Networking Project
+* See COPYING for copyright and distribution information.
+*/
+
+#ifndef NDN_MANAGEMENT_NFD_STRATEGY_CHOICE_OPTIONS_HPP
+#define NDN_MANAGEMENT_NFD_STRATEGY_CHOICE_OPTIONS_HPP
+
+#include "../encoding/block.hpp"
+#include "../encoding/encoding-buffer.hpp"
+#include "../encoding/tlv-nfd.hpp"
+#include "../name.hpp"
+
+namespace ndn {
+namespace nfd {
+
+class StrategyChoiceOptions{
+public:
+  struct Error : public Tlv::Error
+  {
+    Error(const std::string& what) : Tlv::Error(what)
+    {
+    }
+  };
+  
+  StrategyChoiceOptions()
+  {
+  }
+  
+  StrategyChoiceOptions(const Block& block)
+  {
+    wireDecode(block);
+  }
+  
+  const Name&
+  getName() const
+  {
+    return m_name;
+  }
+  
+  StrategyChoiceOptions&
+  setName(const Name& name)
+  {
+    m_name = name;
+    m_wire.reset();
+    return *this;
+  }
+  
+  const Name&
+  getStrategy() const
+  {
+    return m_strategy;
+  }
+  
+  StrategyChoiceOptions&
+  setStrategy(const Name& strategy)
+  {
+    m_strategy = strategy;
+    m_wire.reset();
+    return *this;
+  }
+  
+  template<bool T>
+  size_t
+  wireEncode(EncodingImpl<T>& block) const;
+  
+  const Block&
+  wireEncode() const;
+  
+  void
+  wireDecode(const Block& wire);
+  
+private:
+  Name m_name;
+  Name m_strategy;
+  
+  mutable Block m_wire;
+};
+
+template<bool T>
+inline size_t
+StrategyChoiceOptions::wireEncode(EncodingImpl<T>& block) const
+{
+  size_t totalLength = 0;
+  
+  if (!m_strategy.empty())
+  {
+    totalLength += prependNestedBlock(block, tlv::nfd::Strategy, m_strategy);
+  }
+  
+  totalLength += m_name.wireEncode(block);
+  
+  totalLength += block.prependVarNumber(totalLength);
+  totalLength += block.prependVarNumber(tlv::nfd::StrategyChoiceOptions);
+  return totalLength;
+}
+
+inline const Block&
+StrategyChoiceOptions::wireEncode() const
+{
+  if (m_wire.hasWire())
+    return m_wire;
+  
+  EncodingEstimator estimator;
+  size_t estimatedSize = wireEncode(estimator);
+  
+  EncodingBuffer buffer(estimatedSize, 0);
+  wireEncode(buffer);
+  
+  m_wire = buffer.block();
+  return m_wire;
+}
+
+inline void
+StrategyChoiceOptions::wireDecode(const Block& wire)
+{
+  m_name.clear();
+  m_strategy.clear();
+  
+  m_wire = wire;
+  
+  if (m_wire.type() != tlv::nfd::StrategyChoiceOptions)
+    throw Error("Requested decoding of StrategyChoiceOptions, but Block is of different type");
+  
+  m_wire.parse();
+  
+  // Name
+  Block::element_const_iterator val = m_wire.find(Tlv::Name);
+  if (val != m_wire.elements_end())
+  {
+    m_name.wireDecode(*val);
+  }
+  
+  // Strategy
+  val = m_wire.find(tlv::nfd::Strategy);
+  if (val != m_wire.elements_end())
+  {
+    val->parse();
+    if (!val->elements().empty())
+      m_strategy.wireDecode(*val->elements_begin());
+  }
+}
+
+inline std::ostream&
+operator << (std::ostream& os, const StrategyChoiceOptions& option)
+{
+  os << "StrategyChoiceOptions(";
+  
+  // Name
+  os << "Name: " << option.getName() << ", ";
+  
+  // Strategy
+  os << "Strategy: " << option.getStrategy() << ", ";
+  
+  os << ")";
+  return os;
+}
+
+} // namespace nfd
+} // namespace ndn
+
+#endif // NDN_MANAGEMENT_NFD_STRATEGY_CHOICE_MANAGEMENT_OPTIONS_HPP
