diff --git a/pykd/dllmain.cpp b/pykd/dllmain.cpp
index 8a4edd3..93034ff 100644
--- a/pykd/dllmain.cpp
+++ b/pykd/dllmain.cpp
@@ -1,6 +1,8 @@
 // dllmain.cpp : Defines the entry point for the DLL application.
 #include "stdafx.h"
 
+#include "kdlib/kdlib.h"
+
 BOOL APIENTRY DllMain( HMODULE hModule,
                        DWORD  ul_reason_for_call,
                        LPVOID lpReserved
@@ -8,10 +10,16 @@ BOOL APIENTRY DllMain( HMODULE hModule,
 {
 	switch (ul_reason_for_call)
 	{
-	case DLL_PROCESS_ATTACH:
+    case DLL_PROCESS_ATTACH:
+        kdlib::initialize();
+        break;
+
 	case DLL_THREAD_ATTACH:
 	case DLL_THREAD_DETACH:
+        break;
+
 	case DLL_PROCESS_DETACH:
+        kdlib::uninitialize();
 		break;
 	}
 	return TRUE;
diff --git a/pykd/pykd.vcxproj b/pykd/pykd.vcxproj
index 842d8f6..58b0b19 100644
--- a/pykd/pykd.vcxproj
+++ b/pykd/pykd.vcxproj
@@ -55,6 +55,7 @@
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_2.7|Win32'">
     <LinkIncremental>true</LinkIncremental>
     <TargetExt>.pyd</TargetExt>
+    <PostBuildEventUseInBuild>true</PostBuildEventUseInBuild>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <LinkIncremental>false</LinkIncremental>
@@ -72,6 +73,14 @@
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <ModuleDefinitionFile>pykd.def</ModuleDefinitionFile>
     </Link>
+    <PreBuildEvent>
+      <Command>
+      </Command>
+    </PreBuildEvent>
+    <PostBuildEvent>
+      <Command>
+      </Command>
+    </PostBuildEvent>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_2.7|Win32'">
     <ClCompile>
@@ -88,8 +97,12 @@
       <AdditionalLibraryDirectories>$(PYTHON_27_X86_ROOT)\libs;$(BOOST_ROOT)\stage_2.7\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
     </Link>
     <PostBuildEvent>
-      <Command>"$(ProjectDir)..\test\scripts\_run_pykdtest.cmd" "$(TargetDir)targetapp.exe" $(PlatformName)</Command>
+      <Command>copy $(ProjectDir)..\Debug\targetapp.exe $(OutDir)targetapp.exe</Command>
     </PostBuildEvent>
+    <CustomBuildStep>
+      <Command>
+      </Command>
+    </CustomBuildStep>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <ClCompile>
@@ -112,6 +125,7 @@
   <ItemGroup>
     <ClInclude Include="stdafx.h" />
     <ClInclude Include="targetver.h" />
+    <ClInclude Include="windbgext.h" />
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="dllmain.cpp">
diff --git a/pykd/pykd.vcxproj.filters b/pykd/pykd.vcxproj.filters
index 0e70538..5147b86 100644
--- a/pykd/pykd.vcxproj.filters
+++ b/pykd/pykd.vcxproj.filters
@@ -21,6 +21,9 @@
     <ClInclude Include="targetver.h">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="windbgext.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="stdafx.cpp">
diff --git a/pykd/pymod.cpp b/pykd/pymod.cpp
index a85b29d..d3b7dbc 100644
--- a/pykd/pymod.cpp
+++ b/pykd/pymod.cpp
@@ -2,7 +2,7 @@
 #include "stdafx.h"
 
 
-#include "kdlib/dbgio.h"
+#include "kdlib/kdlib.h"
 
 using namespace kdlib;
 
@@ -95,26 +95,26 @@ BOOST_PYTHON_MODULE( pykd )
    //     "Call a WinDBG extension's routine. Parameters: handle returned by loadExt; string command line" );
 
 
-   // // Manage debug target 
+   // Manage debug target 
 
-   // python::def( "startProcess", &startProcess,
-   //     "Start process for debugging" ); 
-   // python::def( "attachProcess", &attachProcess,
-   //     "Attach debugger to a exsisting process" );
-   // python::def( "detachProcess", &detachProcess, detachProcess_( boost::python::args( "pid" ),
-   //     "Stop process debugging") ); 
-   // python::def( "killProcess", &terminateProcess,
-   //     "Stop debugging and terminate current process" );
-   // python::def( "loadDump", &loadDump,
-   //     "Load crash dump");
-   // python::def( "isDumpAnalyzing", &isDumpAnalyzing,
-   //     "Check if it is a dump analyzing ( not living debuggee )" );
-   // python::def( "isKernelDebugging", &isKernelDebugging,
-   //     "Check if kernel dubugging is running" );
-   // python::def( "isWindbgExt", &WindbgGlobalSession::isInit,
-   //     "Check if script works in windbg context" );
-   // python::def( "writeDump", &writeDump,
-   //     "Create memory dump file" );
+    python::def( "startProcess", &startProcess,
+        "Start process for debugging" ); 
+    python::def( "attachProcess", &attachProcess,
+        "Attach debugger to a exsisting process" );
+    //python::def( "detachProcess", &detachProcess, detachProcess_( boost::python::args( "pid" ),
+    //    "Stop process debugging") ); 
+    python::def( "killProcess", &terminateProcess,
+        "Stop debugging and terminate current process" );
+    python::def( "loadDump", &loadDump,
+        "Load crash dump");
+    python::def( "isDumpAnalyzing", &isDumpAnalyzing,
+        "Check if it is a dump analyzing ( not living debuggee )" );
+    python::def( "isKernelDebugging", &isKernelDebugging,
+        "Check if kernel dubugging is running" );
+    //python::def( "isWindbgExt", &WindbgGlobalSession::isInit,
+    //    "Check if script works in windbg context" );
+    python::def( "writeDump", &writeDump,
+        "Create memory dump file" );
 
    // python::def( "breakin", &debugBreak,
    //     "Break into debugger" );
diff --git a/pykd/windbgext.cpp b/pykd/windbgext.cpp
index 08717cd..1a3c6cc 100644
--- a/pykd/windbgext.cpp
+++ b/pykd/windbgext.cpp
@@ -3,50 +3,46 @@
 #include "kdlib/kdlib.h"
 #include "kdlib/windbg.h"
 
+#include "windbgext.h"
+
 using namespace kdlib;
 using namespace kdlib::windbg;
 
+///////////////////////////////////////////////////////////////////////////////
+
+KDLIB_WINDBG_EXTENSION_INIT( PykdExt );
+
+
 ///////////////////////////////////////////////////////////////////////////////
 
 extern "C" void initpykd();
 
-class PykdExt : public WindbgExtension
+void PykdExt::setUp() 
 {
-public:
-    KDLIB_EXT_COMMAND_METHOD(py);
+    WindbgExtension::setUp();
 
-private:
+    PyImport_AppendInittab("pykd", initpykd ); 
 
-    void startConsole();
+    Py_Initialize();
 
-    virtual void setUp() 
-    {
-        WindbgExtension::setUp();
+    boost::python::import( "pykd" );
 
-        PyImport_AppendInittab("pykd", initpykd ); 
+    // ��������������� ����������� ������� ��
+    python::object       sys = python::import("sys");
 
-        Py_Initialize();
+    sys.attr("stdout") = python::ptr( dbgout  );
+    sys.attr("stderr") = python::ptr( dbgout );
+    sys.attr("stdin") = python::ptr( dbgin );
+}
 
-        boost::python::import( "pykd" );
+///////////////////////////////////////////////////////////////////////////////
 
-        // ��������������� ����������� ������� ��
-        python::object       sys = python::import("sys");
+void PykdExt::tearDown()
+{
+    Py_Finalize();
 
-        sys.attr("stdout") = python::ptr( dbgout  );
-        sys.attr("stderr") = python::ptr( dbgout );
-        sys.attr("stdin") = python::ptr( dbgin );
-    }
-
-    virtual void tearDown()
-    {
-        Py_Finalize();
-
-        WindbgExtension::tearDown();
-    }
-
-};
-
-KDLIB_WINDBG_EXTENSION_INIT( PykdExt );
+    WindbgExtension::tearDown();
+}
 
 ///////////////////////////////////////////////////////////////////////////////
 
diff --git a/pykd/windbgext.h b/pykd/windbgext.h
new file mode 100644
index 0000000..cd57ac8
--- /dev/null
+++ b/pykd/windbgext.h
@@ -0,0 +1,24 @@
+#pragma once
+
+#include "kdlib/windbg.h"
+
+///////////////////////////////////////////////////////////////////////////////
+
+class PykdExt : public kdlib::windbg::WindbgExtension
+{
+public:
+
+    KDLIB_EXT_COMMAND_METHOD(py);
+
+private:
+
+    void startConsole();
+
+    virtual void setUp();
+
+    virtual void tearDown();
+
+};
+
+///////////////////////////////////////////////////////////////////////////////
+
diff --git a/test/scripts/pykdtest.py b/test/scripts/pykdtest.py
index 1c20f3a..c4f5a92 100644
--- a/test/scripts/pykdtest.py
+++ b/test/scripts/pykdtest.py
@@ -28,16 +28,16 @@ import target
 
 class StartProcessWithoutParamsTest(unittest.TestCase):
     def testStart(self):
-        target.processId = pykd.startProcess( target.appPath )
-        target.module = pykd.module( target.moduleName )
-        target.module.reload();
-        print "\n" + str( pykd.getSystemVersion() )
-        pykd.go()
+       target.processId = pykd.startProcess( target.appPath )
+      # target.module = pykd.module( target.moduleName )
+      #  target.module.reload();
+      #  print "\n" + str( pykd.getSystemVersion() )
+      #  pykd.go()
 
 class TerminateProcessTest(unittest.TestCase):
     def testKill(self):
         pykd.killProcess( target.processId )
-        pykd.detachProcess( target.processId )
+        #pykd.detachProcess( target.processId )
 
 def getTestSuite( singleName = "" ):
     if singleName == "":
@@ -76,6 +76,4 @@ if __name__ == "__main__":
     target.appPath = sys.argv[1]
     target.moduleName = os.path.splitext(os.path.basename(target.appPath))[0]
     
-    unittest.TextTestRunner(stream=sys.stdout, verbosity=2).run( getTestSuite() )
-
-
+    unittest.TextTestRunner(stream=sys.stdout, verbosity=2).run( getTestSuite() )\