Merge tag 'rel/celix-2.0.0.rc1'

CELIX-282: Tagging celix-2.0.0.rc1
diff --git a/.travis.yml b/.travis.yml
index 8f8042a..5d955b6 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -25,6 +25,7 @@
         - COVERITY_SCAN_TOKEN="iomLSuaE8KOZLDog-KK7Ug"
         - COVERITY_SCAN_BUILD_URL="https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh"
         - COVERITY_SCAN_BUILD="curl -s $COVERITY_SCAN_BUILD_URL | sed 's/https:\/\/scan.coverity.com\/builds/https:\/\/scan.coverity.com\/builds?project=Apache+Celix/g' | bash"
+        - COVERITY_SCAN_ALWAYS_ON="n"
 
 matrix:
     include:
@@ -44,11 +45,11 @@
 before_script:
     - wget https://github.com/cpputest/cpputest.github.io/blob/master/releases/cpputest-3.7.1.tar.gz?raw=true -O /tmp/cpputest.tar.gz
     - tar -xzvf /tmp/cpputest.tar.gz -C /tmp
-    - if [ "$CC" = "clang" ]; then export CXX="clang++"; fi && cd /tmp/cpputest-3.7.1 && ./configure --prefix=/usr && make && sudo make install && cd -
-    - cd /tmp/cpputest-3.7.1 && ./configure --prefix=/usr && make && sudo make install && cd -
+    - if [ "$CC" = "clang" ]; then export CXX="clang++"; fi && cd /tmp/cpputest-3.7.1 && ./configure --prefix=/usr/local && make && sudo make install && cd -
+    - cd /tmp/cpputest-3.7.1 && ./configure --prefix=/usr/local && make && sudo make install && cd -
     - git clone https://github.com/akheron/jansson.git jansson-build
     - cd jansson-build && git checkout 2.7
-    - cmake -DJANSSON_BUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=/usr . && make
+    - cmake -DJANSSON_BUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=/usr/local . && make
     - sudo make install
     - cd -
     - mkdir build install
@@ -95,5 +96,6 @@
         gem install coveralls-lcov &&
         make coverage &&
         lcx="lcov --output-file=coverage.info " && for i in `find . -name "*.info.cleaned"`; do lcx+=" --add-tracefile=$i"; done && $lcx && coveralls-lcov --repo-token=9dpeTAjiGoQU5hgXFe0ezk65iu40oc3WY coverage.info;
-        if [ $(( $TRAVIS_BUILD_NUMBER  % 5 )) -eq 0 ]; then make clean & eval "$COVERITY_SCAN_BUILD"; fi
+        if [ $(( $TRAVIS_BUILD_NUMBER  % 5 )) -eq 0 -o ${COVERITY_SCAN_ALWAYS_ON} = "y" ]; then make clean & eval "$COVERITY_SCAN_BUILD"; fi
       fi;
+
diff --git a/BUILDING b/BUILDING
index 819d42b..fb87152 100644
--- a/BUILDING
+++ b/BUILDING
@@ -10,73 +10,7 @@
 * More information about the build system, and how to extend it, can be found at
   the website: http://celix.apache.org/documentation.html
 	
-	
-Quick Start
------------
+Building
+--------
 
-  # Create a build directory next to the celix source directory
-  $ mkdir celix-build; cd celix-build
-  $ ccmake ../celix
-  
-  # When this is the first time the CMake cache is created, a configuration has to be created
-  # This is done by running Configure (c) in CMake.
-  
-  # Enable/Disable the required sub projects (BUILD_{NAME} entries)
-  # Optionally, enable advanced mode (t) and change CMAKE_INSTALL_PREFIX
-  # Run Configure (might be needed multiple times)
-  # Run Generate (this also returns to the shell)
-  $ make
-  
-  # To deploy the included examples
-  $ make deploy
-  # Navigate to <subproject>/deploy/<deployname>
-  $ sh run.sh
-  
-  # To install the release (framework, headers and bundles)
-  $ make install-all
-  
-  # To see a list of all available targets
-  $ make help
-
-  
-Unit testing using CppUTest
----------------------------
-
-Apache Celix has build options that enable a set of unit tests for each component. These tests
-are based on CppUTest, which needs to be installed separately.
-To run the tests
-  $ make test
-To get a HTML page with the test coverage
-  $ make coverage
-The coverage results are found in <build_dir>/coverage_results/index.html
-
-Background information
-----------------------
-
-Apache Celix uses CMake to generate the build files needed for compilation.
-deployment and installation.
-
-* CMake (http://www.cmake.org)
-  CMake generated build files based on specific CMake files. To setup a build
-  a console (ccmake) and GUI (cmake-gui) method is provided. With these editors
-  include paths, installation prefix etc can be changed.
-  CMake stores the configuration in a cache, which is used during the build.
-  To keep the cache/build files separate from the source, a out-of-source build
-  is preferred. To start from scratch, the build directory can be deleted and
-  new build files can be generated.
-* Apache Celix Subprojects
-  Since Apache Celix provides a modular framework, it makes sense to provide the
-  available components as modules as well. To enable/disable these modules cmake
-  is used. In the GUI or console there are settings named BUILD_{NAME} which can
-  be switched on or off. On http://celix.apache.org/subprojects.html a
-  list of all subprojects is given.
-* Apache Celix deployment/installation
-  With a modular system it doesn't make sense to simply install everything to
-  the file system. Depending on the needs different version/modules can be 
-  needed.
-  To cater for this, Celix provides deployment support which takes care of 
-  copying the required bundles to a named target. A basic run script is 
-  created as well.
-  Installing the framework (and its dependencies) might make sense, every target
-  needs the framework. To install only the framework a dedicated target is 
-  available: make install-release.
+See documents/building/readme.md for howto build Apache Celix	
diff --git a/CHANGES b/CHANGES
index c4816cf..2d8ff39 100644
--- a/CHANGES
+++ b/CHANGES
@@ -13,67 +13,203 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-Changes for 1.0.0.incubating
+Changes for 2.0.0
+** New Features
+    [CELIX-77] Configuration Admin Implementation
+    [CELIX-116] Event admin
+    [CELIX-119] Remove apr usage from framework
+    [CELIX-172] Bonjour Shell
+    [CELIX-237] RSA with libffi
+    [CELIX-269] New Dependency Manager
+    [CELIX-370] Add C++ support
+** Improvements
+    [CELIX-63] make cmake directory useable for custom bundle projects
+    [CELIX-66] Refactor shell service struct
+    [CELIX-90] add additional build options for RSA components
+    [CELIX-111] Support multiple libraries
+    [CELIX-115] logservice bundle entries list grows indefinitely
+    [CELIX-118] Deployment Admin - Support auditlog of Apache ACE
+    [CELIX-123] enable code coverage for utils_test
+    [CELIX-125] CMakeCelix module
+    [CELIX-134] Update source from incubator structure to TLP
+    [CELIX-138] Parameterise launcher
+    [CELIX-144] Document Developing Celix with Eclipse
+    [CELIX-146] Replace printfs wit fw_log calls
+    [CELIX-149] Add log_writer_syslog
+    [CELIX-152] Added Discovery/ETCD support
+    [CELIX-153] add cmake configuration options for rsa_bundles
+    [CELIX-156] Enable all warnings
+    [CELIX-158] RSA is unable to re-use already started proxy factory
+    [CELIX-165] Add port collision auto-correction to RSA
+    [CELIX-169] Add port collision auto-correction to discovery
+    [CELIX-182] loghelper eases log_service tracking
+    [CELIX-187] discovery_etcd: add watchindex, handle expire action
+    [CELIX-193] support portable celix_thread_t initalization
+    [CELIX-199] Code Coverage should be optional rather than required by cmake
+    [CELIX-200] SEGFAULT occurs when remote services are closed
+    [CELIX-216] Replace strtok with strtok_r
+    [CELIX-230] Refactoring of the shell command service
+    [CELIX-242] Fix Warnings
+    [CELIX-245] Update civetweb to latest version
+    [CELIX-246] enable Travis CI for Apache Celix
+    [CELIX-247] Enable ANDROID support
+    [CELIX-249] Refactor most char * usage to const char *
+    [CELIX-251] missing includes in device access example
+    [CELIX-255] Update default BUILD option
+    [CELIX-258] framework uses  dlopen/dlsym to set the bundleActivator
+    [CELIX-259] dispatcherThread does not perform a graceful shutdown
+    [CELIX-275] Can't do mkstemp on root system (deploymentAdmin_download)
+    [CELIX-278] Adding tags to ACE target through deployment admin
+    [CELIX-284] Restrict export and imports based on properties
+    [CELIX-285] Discovery SHM: remove obsolete jansson dependency
+    [CELIX-295] Many compiling warnings in unit tests
+    [CELIX-296] Framework unit tests improvement
+    [CELIX-309] Make DFI available for common use
+    [CELIX-317] Dependency Manager suspend state
+    [CELIX-320] outdated utils tests (threads, hashmap)
+    [CELIX-323] Version and version_range moved from framework to utils
+    [CELIX-326] Add service version support to dependency manager
+    [CELIX-327] Filter does not support greater than and lesser than operators
+    [CELIX-328] Service version support for RSA DFI
+    [CELIX-330] document using markdown
+    [CELIX-333] integrate coverity scans
+    [CELIX-335] Refactor deploying bundles with cmake
+    [CELIX-339] celix_log_mock doesnt show logs to the user
+    [CELIX-341] Fix coverity issues in Shell / Shell TUI
+    [CELIX-348] The utils_stringHash does not generate unique hashes.
+    [CELIX-352] RSA_DFI and embedded celix
+    [CELIX-353] Make bundle context retrievable form dm component
+    [CELIX-365] Refactor some usage of void* to const void*
 ** Bug
-    * [CELIX-28] - celix_strerror in celix_errno.h does not give error correct error strings for errno.h errors
-    * [CELIX-43] - Update bundle creation and deployment
-    * [CELIX-45] - remote_services/discovery does not compile
-    * [CELIX-46] - Add .DS_Store to .gitignore
-    * [CELIX-47] - FindSLP.cmake and FindJansson.cmake include dir location typo
-    * [CELIX-50] - driverAttributes_getDriverId does not return DriverId
-    * [CELIX-58] - BUNDLE_STATE doesn't have an UNKNOWN state
-    * [CELIX-59] - Remote service examples generate segmentation fault on start.
-    * [CELIX-73] - CUint include directory used directly then header included via <CUint/Automated.h> can't be found in Xcode 
-    * [CELIX-74] - The serviceTrackerCustomizer header uses, but does not include, the serviceReference header.
-    * [CELIX-75] - CMake does not install the Deployment Admin bundle
-    * [CELIX-76] - Deployment Admin multiline manifest
-    * [CELIX-78] - CMake does not install the Device Manager bundle 
-    * [CELIX-79] - DeviceManager DriverTracker and DeviceTracker callbacks wrong
-    * [CELIX-82] - segfault when stopping remote services (server)
-    * [CELIX-83] - memory pool bad access issue when starting with cache
-    * [CELIX-84] - Update shell commands to provide better feedback
-    * [CELIX-85] - During shutdown celix sometimes segfaults
-    * [CELIX-86] - missing include
-    * [CELIX-88] - Missing export of endpoint_listener.h
-    * [CELIX-92] - Moving manifest from bundle to bundle_revision
-    * [CELIX-93] - Manifest with multiple files
-    * [CELIX-95] - not initialized variable leads to segFault 
-    * [CELIX-96] - missing include
-    * [CELIX-97] - Inspect command only prints objectClass
-    * [CELIX-98] - Callback method for RSA proxies
-    * [CELIX-99] - Extract common RSA headers
-    * [CELIX-100] - Add release guide to website
-    * [CELIX-103] - log_service segfault on bundle stop/destroy
-    * [CELIX-105] - Fixed array_list_test
-** Improvement
-    * [CELIX-27] - Add create function for the SERVICE_TRACKER_CUSTIMIZER struct
-    * [CELIX-42] - Support Visual Studio
-    * [CELIX-52] - Typedef MANIFEST shall be changed to lower case
-    * [CELIX-53] - Typedef ACTIVATOR shall be lower case
-    * [CELIX-54] - Use one convention for linefeeds
-    * [CELIX-60] - Support framework embedding
-    * [CELIX-62] - rename suffix of pointer type from _t to _pt
-    * [CELIX-64] - Add support for ccputest
-    * [CELIX-66] - Refactor shell service struct
-    * [CELIX-71] - FindAPR does not look in default APR directories
-    * [CELIX-72] - 'Header Files' sub folder not included in all folders in generated Xcode project
-    * [CELIX-87] - Improve framework logging
-    * [CELIX-89] - Align Remote Services with Amdatu Remote Services
-    * [CELIX-91] - exporting serviceRegistration_setProperties(..) 
-    * [CELIX-94] - extend properties support for escaping equals sign
-    * [CELIX-101] - Prefixing public constants
-    * [CELIX-102] - Improve cache options
-    * [CELIX-106] - Add configurable framework logger
-    * [CELIX-107] - Add Apache Rat as make target
-** New Feature
-    * [CELIX-25] - Allow NULL value for the SERVICE_TRACKER_CUSTOMIZER struct
-    * [CELIX-80] - Netstring support
-    * [CELIX-81] - Remote Services - Shared Memory Support
-** Task
-    * [CELIX-40] - Refactor bundle macro to generate Manifest file
-    * [CELIX-67] - Check for dependency manager usage
-    * [CELIX-68] - Check for memory leaks
-    * [CELIX-108] - Prepare 1.0.0 release
-** Wish
-    * [CELIX-51] - Improve maintainability code
-
+    [CELIX-104] deployment_admin bundle won't start when missing properties
+    [CELIX-105] Fixed array_list_test
+    [CELIX-114] Potential deadlock in log_service bundle during stop
+    [CELIX-122] missing dependency uuid
+    [CELIX-124] Celix memory leaks fixing
+    [CELIX-127] Makefiles not generated using CMake 3.0
+    [CELIX-128] remote_shell port cannot be changed
+    [CELIX-129] Update RSA to be compatible with the Amdatu RSA implementation
+    [CELIX-130] Implement Configured Endpoint discovery compatible with Amdatu RSA
+    [CELIX-136] [contrib] Configured endpoint discovery
+    [CELIX-137] Possible concurrency issues in topology manager
+    [CELIX-139] Update tests and mocks to latest CppUTest
+    [CELIX-147] RSA_SHM: concurrency issue when client segfaults
+    [CELIX-150] Topology Manager segfaults when RSA/bundle w/ exp. service stops in wrong order
+    [CELIX-154] echo exampe not working
+    [CELIX-155] Fix CMake warnings during configuration
+    [CELIX-157] service_reference misses functions to get property keys and values
+    [CELIX-159] PThread usage not correct for Linux
+    [CELIX-161] newly added RSA cannot manage already exported/imported services
+    [CELIX-162] Update encoding/decoding of replies.
+    [CELIX-167] Update command to be able to pass a pointer (handle)
+    [CELIX-168] discovery_etcd:Make root-path configurable
+    [CELIX-170] Remote services can fail to restart when felix restarts
+    [CELIX-173] stopping rsa_http bundle does not stop rsa webserver
+    [CELIX-174]  invalid bundle_context during fw shutdown
+    [CELIX-175] segfault during shutdown when calculator is already stopped
+    [CELIX-177] not all endpoints are unistalled when rsa_http bundle is stopped
+    [CELIX-178] Shell_Tui bundle hangs on stop
+    [CELIX-179] memory leak in rsa_http callback
+    [CELIX-180] framework_tests do not compile
+    [CELIX-181] Incorrect reply status when no data is returned on a remote call.
+    [CELIX-185] Memory leaks in Discovery Endpoint Descriptor Reader
+    [CELIX-186] deployment_admin segfaults while downloading bundle
+    [CELIX-188] Add missing log_service headers to installations
+    [CELIX-189] LogService segfaults when log message pointer is overwritten
+    [CELIX-190] remote services memory leaks
+    [CELIX-192] rsa_http: add locking
+    [CELIX-194] Refactor RemoteService proxy factory
+    [CELIX-195] SEGFAULT occurs when running a log command.
+    [CELIX-197] insufficient memory allocated
+    [CELIX-198] Logging can segfault for strings 512 characters or longer
+    [CELIX-201] SEGFAULT occurs when restarting apache_celix_rs_topology_manager
+    [CELIX-202] Not all components are disabled with a clean build
+    [CELIX-205] RSA Discovery (Configured) bundle gets stuck
+    [CELIX-213] SEGFAULT occurs due to memory access after memory is free'd
+    [CELIX-215] curl_global_init() not called directly
+    [CELIX-218] Memory leaks in service_registry.c
+    [CELIX-219] Memory Leaks
+    [CELIX-221] Deployment admin segfaults when deploying a bundle
+    [CELIX-223] Celix crashes because of wrong bundle versions
+    [CELIX-224] Wrong use of errno in launcher.c
+    [CELIX-226] __unused atttibute does not work with  Linux
+    [CELIX-227] compile error under linux due to missing header include
+    [CELIX-229] Make APR optional
+    [CELIX-231] Missing log_helper creation in discovery_etcd
+    [CELIX-238] Contributing page links incorrect
+    [CELIX-239] TopologyManager does not maintain exportedServices
+    [CELIX-240] RSA: deadlock when stopping
+    [CELIX-241] remote_interface incorrect
+    [CELIX-248] too many arguments for format
+    [CELIX-250] config.h is not exported
+    [CELIX-252] discovery_etcd cannot handle celix restarts
+    [CELIX-253] Deployment admin does not always download the latest version from ACE
+    [CELIX-254] Memory leakage in deployment_admin
+    [CELIX-260] missing include in deployment admin
+    [CELIX-262] Fix minor issues in hashMap/linkedList
+    [CELIX-263] replace utils cunit tests w/ cpputest tests
+    [CELIX-264] Missing strdup leads to invalid free
+    [CELIX-270] Fix Code Coverage
+    [CELIX-271] setup coveralls.io
+    [CELIX-272] framework: improve locking / synchronization
+    [CELIX-274] waitForShutdown issue when starting two embedded celix frameworks.
+    [CELIX-279] Celix fails to compile w/ CMake 3.3
+    [CELIX-280] deployment_admin misses proper shutdown functionality
+    [CELIX-287] racecondition for framework event listener
+    [CELIX-288] Archive directory not properly read
+    [CELIX-289] Fix celix mocks
+    [CELIX-290] Mock fixes, CMakelist fix, build warning fix
+    [CELIX-292] Memory leak in refactored shell
+    [CELIX-294] changed dfi library from static to shared
+    [CELIX-298] Memory leaks in rsa_dfi
+    [CELIX-300] Invalid read in serviceRegistry during framework_shutdown
+    [CELIX-301] Memory leaks in rsa_shm
+    [CELIX-302] Service Tracker Test error breaks the build
+    [CELIX-304] Memory leaks in manifest parser, requirement, capability; out-of-date tests
+    [CELIX-305] Memory leaks in RSA_SHM, RSA_DFI, RSA_HTTP
+    [CELIX-306] Memory leaks in remote_proxy_factory, unit tests issues
+    [CELIX-307] "service registration set properties" deadlocks
+    [CELIX-308] Dependency Manager memory leaks
+    [CELIX-310] "serviceRegistry_getRegisteredServices" deadlocks
+    [CELIX-311] Framework Tests Build broken
+    [CELIX-312] ServiceReference usage counter inconsistent state
+    [CELIX-313] out of date/defunct tests
+    [CELIX-316] Wrong conversion for 'N' type in json_serializer
+    [CELIX-322] Memory leaks in resolver and framework tests
+    [CELIX-324] Version support in dfi library
+    [CELIX-325] Bundle test sporadicly fails
+    [CELIX-329] framework "service_" tests are outdates, some small bugs in the sources
+    [CELIX-331] test configuraiton needs update for newer CMake
+    [CELIX-332] filter tests absent, small bugs in the source
+    [CELIX-334] Race Condition in Topology Manager causes spurious segfaults
+    [CELIX-336] resolver_test doesn't compile
+    [CELIX-343] configuration_unbind never called
+    [CELIX-344] service tracker removes wrong service
+    [CELIX-345] Typo in Dependency Manager interface
+    [CELIX-346] celix-bootstrap problems
+    [CELIX-347] Memory leaks in dm_service_dependency
+    [CELIX-349] ServiceTracker update references list after invoking added callback
+    [CELIX-350] shell_tui wrong handling service reference
+    [CELIX-354] Coverity High Impact issues
+    [CELIX-356] Import libraries not supported in revamped cmake commands
+    [CELIX-357] Coverity Medium Impact issues
+    [CELIX-358] Coverity Low+New High Impact issues
+    [CELIX-359] Android build stopped working
+    [CELIX-360] Coverity leftover issues
+    [CELIX-361] etcd_watcher notifications loss when ETCD transaction rate is high
+    [CELIX-363] Memory leak in DFI exportRegistration_create
+    [CELIX-364] Incorrect destroy of dependency manager info struct
+    [CELIX-366] eclipse launch file not correctly generated
+    [CELIX-367] Memory leak in properties
+    [CELIX-369] Tests fail with sanitizer
+    [CELIX-371] Due to a fixed maximum length of lines in property file not all bundles are started
+    [CELIX-372] serviceRegistry_clearReferencesFor warning info unclear
+    [CELIX-373] Endpoint Server number is fixed and too low
+    [CELIX-374] RTLD_NODELETE flag
+    [CELIX-375] Topology manager deadlocks when interacts with dependency manager
+    [CELIX-377] wrong rpath setup in CMake files
+    [CELIX-378] Travis build errors on Max OSX
+    [CELIX-379] Extend cmake fucntion add_deploy with an option to specify the launcher
+    [CELIX-376] serviceRegistration sometimes paired to invalidated serviceReference
+    [CELIX-380] PROPERTIES_FOR_EACH macro does not iterate over all keys
+    [CELIX-381] Invoke set for dependency manager called before suspending the component
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5b95566..d8dba55 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,15 +16,15 @@
 # under the License.
 
 cmake_minimum_required (VERSION 3.2)
+cmake_policy(SET CMP0012 NEW)
+cmake_policy(SET CMP0042 NEW)
+
 project (Celix C CXX)
 
-cmake_policy(SET CMP0012 NEW)
+include(GNUInstallDirs)                                                                                                                                                                             
 
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
 
-set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
-set(CMAKE_INSTALL_NAME_DIR "@rpath")
-
 SET(CMAKE_BUILD_TYPE "Debug")
 
 # see https://public.kitware.com/Bug/view.php?id=15696
@@ -36,16 +36,22 @@
     SET(CMAKE_C_FLAGS "-D_GNU_SOURCE -std=gnu99 -Wall ${CMAKE_C_FLAGS}")
 ENDIF()
 IF(UNIX AND NOT ANDROID)
-    SET(CMAKE_C_FLAGS "-D_GNU_SOURCE -std=gnu99 -Wall -Werror ${CMAKE_C_FLAGS}")
-    #SET(CMAKE_CXX_FLAGS "-Wall -Werror ${CMAKE_CXX_FLAGS}")
+    SET(CMAKE_C_FLAGS "-D_GNU_SOURCE -std=gnu99 -Wall -Werror -fPIC ${CMAKE_C_FLAGS}")
+    SET(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}") #TODO enable -Wall -Werror -> warning in cpputest
+    SET(CMAKE_C_FLAGS_DEBUG "-g -DDEBUG")
+    SET(CMAKE_CXX_FLAGS_DEBUG "-g -DDEBUG")
 ENDIF()
 IF(UNIX AND NOT APPLE) 
 	SET(CMAKE_C_FLAGS "-pthread ${CMAKE_C_FLAGS}")
+    set(CMAKE_CXX_FLAGS "-pthread ${CMAKE_CXX_FLAGS}")
     set(CMAKE_EXE_LINKER_FLAGS "-pthread ${CMAKE_EXE_LINKER_FLAGS}")
 ENDIF()
 IF(WIN32)
 	SET(CMAKE_C_FLAGS "-D_CRT_SECURE_NO_WARNINGS ${CMAKE_C_FLAGS}")
 ENDIF()
+IF(APPLE)
+    set(CMAKE_MACOSX_RPATH 1)
+ENDIF()
 
 # Set version for the framework package/release
 SET(CELIX_MAJOR "1")
@@ -70,22 +76,25 @@
 ## Sub projects depending on another sub project automatically enable these dependencies
 ## For this to work, the order off "add_subdirectory" has to be correct (ie backwards)
 add_subdirectory(config_admin)
-add_subdirectory(examples)
 add_subdirectory(device_access)
 add_subdirectory(deployment_admin)
 add_subdirectory(remote_services)
 add_subdirectory(remote_shell)
-#add_subdirectory(shell_bonjour) shell_bonjour is still based on APR and old shell command service
+add_subdirectory(shell_bonjour)
 add_subdirectory(shell_tui)
 add_subdirectory(shell)
 add_subdirectory(log_writer)
 add_subdirectory(log_service)
 
-#add_subdirectory(event_admin) event_admin is still bases on APR
+#add_subdirectory(event_admin)# event_admin is unstable
 add_subdirectory(dependency_manager)
+add_subdirectory(dependency_manager_cxx)
 #add_subdirectory(scr) scr still needs APR
 
 add_subdirectory(launcher)
 add_subdirectory(framework)
 add_subdirectory(utils)
 add_subdirectory(dfi)
+
+#Example as last, because some example will check if underlining options are enabled
+add_subdirectory(examples)
diff --git a/Dockerfile.Android b/Dockerfile.Android
index 6ba8f0a..879ee9e 100644
--- a/Dockerfile.Android
+++ b/Dockerfile.Android
@@ -49,7 +49,7 @@
 
 # install needed tools
 
-RUN apt-get install -y software-properties-common && add-apt-repository ppa:george-edison55/cmake-3.x
+RUN apt-get update && apt-get install -y software-properties-common && add-apt-repository ppa:george-edison55/cmake-3.x && apt-get clean
 
 RUN apt-get update && apt-get install -y \
     automake \
@@ -60,7 +60,8 @@
     curl \
     cmake \
     git \
-    vim 
+    vim \
+    && apt-get clean
 
 
 RUN mkdir -p build/output
@@ -130,6 +131,6 @@
 
 RUN git clone -b develop --single-branch https://github.com/apache/celix.git celix
 
-CMD mkdir -p celix/build-android && cd celix/build-android && cmake -DANDROID=TRUE -DENABLE_TESTING=OFF -DBUILD_EXAMPLES=OFF -DBUILD_REMOTE_SERVICE_ADMIN=ON -DBUILD_REMOTE_SHELL=ON -DBUILD_RSA_DISCOVERY_CONFIGURED=ON -DBUILD_RSA_DISCOVERY_ETCD=ON -DBUILD_RSA_EXAMPLES=ON -DBUILD_RSA_REMOTE_SERVICE_ADMIN_HTTP=ON -DBUILD_RSA_REMOTE_SERVICE_ADMIN_DFI=OFF -DBUILD_RSA_TOPOLOGY_MANAGER=ON -DFFI_LIBRARY=/build/output/libffi/lib/libffi.a -DFFI_INCLUDE_DIR=/build/output/libffi/lib/libffi-3.2.1/include -DJANSSON_LIBRARY=/build/output/jansson/lib/libjansson.a -DJANSSON_INCLUDE_DIR=/build/output/jansson/include -DCURL_LIBRARY=/build/output/curl/lib/libcurl.a -DCURL_INCLUDE_DIR=/build/output/curl/include -DLIBXML2_LIBRARIES=/build/output/libxml2/lib/libxml2.a -DLIBXML2_INCLUDE_DIR=/build/output/libxml2/include/libxml2 -DZLIB_LIBRARY=/build/output/zlib/lib/libz.a -DZLIB_INCLUDE_DIR=/build/output/zlib/include -DUUID_LIBRARY=/build/output/uuid/lib/libuuid.a -DUUID_INCLUDE_DIR=/build/output/uuid/include -DCMAKE_INSTALL_PREFIX:PATH=/build/output/celix .. && make && make install
+CMD mkdir -p celix/build-android && cd celix/build-android && cmake -DANDROID=TRUE -DENABLE_TESTING=OFF -DBUILD_EXAMPLES=OFF -DBUILD_DEPENDENCY_MANAGER_CXX=OFF -DBUILD_REMOTE_SERVICE_ADMIN=ON -DBUILD_REMOTE_SHELL=ON -DBUILD_RSA_DISCOVERY_CONFIGURED=ON -DBUILD_RSA_DISCOVERY_ETCD=ON -DBUILD_RSA_EXAMPLES=ON -DBUILD_RSA_REMOTE_SERVICE_ADMIN_HTTP=ON -DBUILD_RSA_REMOTE_SERVICE_ADMIN_DFI=OFF -DBUILD_RSA_TOPOLOGY_MANAGER=ON -DFFI_LIBRARY=/build/output/libffi/lib/libffi.a -DFFI_INCLUDE_DIR=/build/output/libffi/lib/libffi-3.2.1/include -DJANSSON_LIBRARY=/build/output/jansson/lib/libjansson.a -DJANSSON_INCLUDE_DIR=/build/output/jansson/include -DCURL_LIBRARY=/build/output/curl/lib/libcurl.a -DCURL_INCLUDE_DIR=/build/output/curl/include -DLIBXML2_LIBRARIES=/build/output/libxml2/lib/libxml2.a -DLIBXML2_INCLUDE_DIR=/build/output/libxml2/include/libxml2 -DZLIB_LIBRARY=/build/output/zlib/lib/libz.a -DZLIB_INCLUDE_DIR=/build/output/zlib/include -DUUID_LIBRARY=/build/output/uuid/lib/libuuid.a -DUUID_INCLUDE_DIR=/build/output/uuid/include -DCMAKE_INSTALL_PREFIX:PATH=/build/output/celix .. && make && make install
 
 # done
diff --git a/KEYS b/KEYS
index 0e7133e..fc22f80 100644
--- a/KEYS
+++ b/KEYS
@@ -68,3 +68,62 @@
 lgk16W9izi4Ig9MKh8xZwd7hYY/a4+PumxM/Wvc0nX0sqTDWUlKu1R3GRU54zA==
 =Zm9I
 -----END PGP PUBLIC KEY BLOCK-----
+
+pub   4096R/9F60113D 2016-04-29
+uid                  Pepijn Noltes (CODE SIGNING KEY) <pnoltes@apache.org>
+sig 3        9F60113D 2016-04-29  Pepijn Noltes (CODE SIGNING KEY) <pnoltes@apache.org>
+sub   4096R/F613B74E 2016-04-29
+sig          9F60113D 2016-04-29  Pepijn Noltes (CODE SIGNING KEY) <pnoltes@apache.org>
+
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v2
+
+mQINBFcjZGABEACyJI0jM79pJt73v3NJ+2rSTcS7mdrWNubzojGtPAaegihjYdgh
+f/v5IO/Zq9OMKUkhdx9JeMdhRPHYpnelebTAmF4vDYz9z4CIOQ7wD+0dhUS1933P
+e3OAIp3Km75svRRCPY9rqc9l8XYaBi20pGx2xdELjkDe3KMiwwRrGh3Go9ZAuWhC
+WhtrsGPqa89oiejf+yT0FswUXoIxNOw8G1TLifwvd3mjqipd5ApjDCXPVJKng63q
+TGCFJr+C9PESEkchTvwVqZvFe7FJ1nsVvPi3+SrrFUK2G35qnHvaImJW7umJEGpo
+JblEfSIo6ut8Oc+SYrGIJVRHXI67ZMQIxvs1V4cq2SiS9yaSfD+RSorhIyXdP/Ws
++gblzDlFiP/1fTAGTS4hwbpPIbjRtx8c+xLmngu/fGltHhpnRZbsvlbLzg5SmP6L
+y3g2isifU+T8rd8gmTPXPoEgOceMQ470U9YOGhggwl8/jdocOkeqMkQgDiZhXbk+
+pz7kewDkGKL7HZiKIUvK1ID+bsTsvbFLZt74CaFQULeMaVxp8VBY56drTdt+yC9u
+y5JkTleSR4BV9vNynoNTVmdGUn/A7FuhyzVAsgxwZ2pKDQmwLpzoBVm4hldDNw9H
+KisU7PxUwlnFe6TlOtWLl1byNImeUYSyawZ1zDHUb9rZoKzk0mwgD+A7yQARAQAB
+tDVQZXBpam4gTm9sdGVzIChDT0RFIFNJR05JTkcgS0VZKSA8cG5vbHRlc0BhcGFj
+aGUub3JnPokCNwQTAQoAIQUCVyNkYAIbAwULCQgHAwUVCgkICwUWAgMBAAIeAQIX
+gAAKCRDoWoGsn2ARPfa6D/sGNKgSKxssW2lV4YjYppMyNTlXUWnBhDLeM0q2zaIL
+B/yiWi/Sz1QWGyDH5bII2slG4mukGQ5yPdBaA9Q4WnCkPc4ZGsxi/aRelOqicJaz
+tXZmiX8Y8jrf7wZ1dV7kbkLm3RTU9sv6o7g9k525z4R4Wtdcb8OeaLEpl3dbg8fH
+RiIREDKiRU2TRcLxq/9NI89BM8jGUw9zMitYcMDlU7Fv8F9OKBzK8/BM7zKMb6fe
+wmo/C8MeqMjM6ObpMzLREF7DuY+tO3OlX0JcPa8kO3vRXQiXOWIqz0Y9xaal99Xk
+zfghwX0Blzom/pbr/slaKo/TJ+O2vlKcdmYgxHtK3xciZNC3llvGqtXgTqzFCMFs
+triYLDj7wSSYZBZmG4PZKA5DE9qCVxWJiU5G/j5x/XZfyrB5CiDki67RfrbTrQdz
+UWhwmga4QyrECUTormYag2x0qoACLaq8fdsTpfjSKgW4yeYfxs45i9CY7TiGSZhL
+YqrwyzOqxS8oM+xBvqH0nHhfFZIrcOhjb4hYRJGhBKPpyCiZw8/Ptq6XcoMAoav/
+8DRbs5/cCliEC19dpy/eWDERmQCyJPW0NjztX5ZScQJW1S697NDIYGlz5um3srzg
+yMa6o/pcen8UdQYT9iwZiujOLMl670gc//ck6LV1HyMFTFGT4ENyWqCYwKN7OAjy
+zrkCDQRXI2RgARAAxbDRwFDBZ8gqrf+7HVw9GhIe02etMc7abAycxzZ05n0Z0k6G
+46VSQB7ixOcBrVaB8VQtfpRNOHABwCvFG+jutH9pK1N3cXcke2hToGcuTUuU28zn
+T6PtlSpCmZoh2JZSgSuRtR/C7l6AgA/2ifSx0PIj/fv7fcIkNv6PQ0mFXdfAUuhW
+a8uqyg6l0HkpDPzA6LMyriDGIkdiBC6hkBQKo4erLDwBoMsW2sOiJIylrcXpOORT
+dOfdAfgJYf+G/hYLnLadMw0sefNjyVex6DkTVFEoXBFFE/yGLiGrl339nEdfEtUI
+SLaet/IrGljiO+4TLj9PHIINTYtEHx7tI8pwk90lqU4cuwCtxWqwpfJGd5YCdcPm
+lxevWpBHZtb7+2H8wKU9r7b7IM7wZ6zjPR1Yzh8NGje7e0rfpuG1EJ3Wo5NTWS4z
+YlXhbdDtme7+r18pnLkhMkeET1ZaAgqTYjfntvQiFqkH1WzUtKx1l8vKjRBVrbeX
+K0VoAZPpXFi3goq5zSYyLMXCOERYsHfKgPg6P9XUleNQt/5Hwbog7DcQFZ8B4lOO
+BhZ5kBs4sggv2rnEdPORHgrw5OApItY4be3xNRv7y2dBGLYeW9VO8ETBjjvUryx5
+HPOgUVYOTlMkipCuf4tB2DBmgTTDT5mLkTe2KeLF1ysWOD90JJmVjnUXg2UAEQEA
+AYkCHwQYAQoACQUCVyNkYAIbDAAKCRDoWoGsn2ARPXNnD/9/tyX83VxafeUOmHLo
+ilnoPssdB+qlpW3+vAO7FjTuB+YwG2sW0g/RuJZG4cmq3L7NVEWwG1+G1kUAeqVA
+OMgQyhjHqfPja1Iy8sbCYlraIRMbEm23Y2nV+2Y7s8wuBXqOY5ELuxFpmgCRl4Uu
+UvrJV6eZ+TKNDZ3qUm/WRVfPBZ/AhPdPse5XItSs538k2bELoTl/ZvJy1kWTdyjz
+ptaeuDpZeSOg0FrXSAlkj2B4SAjPw3UaeFoLVL8lzltGC4xV/ikKYQV5JJYc5UTr
+CN4y8sV0Mi3REYiZ5a25SYduvspjOW6HMRWhelPoEbjUEChVR0qWbKvPVFV0PmI3
+xPMAeH6VWx9TQ+PAg+V0bqJso8cS4WUlNm+bHG6w1tNPkF/fUCmGZqAjB2rRZXJy
+AbrsEDtYI/plCXE4YNZpKrRR2r7hvoJPFY+HbBuwgKNA92uI1AWYRhqjGjNmQ7Lt
+nKQAR8oqiMUSoBtakd9akiN3uezgUZkDoOj1VXEHPlihsrToMwkWjZIONXOfeF9x
+vyh0dz13F4TbdhVioaLs/7VOiFbCdQ2RjglEEV4jCfWi+hOue/tCdQ1W9Ny+NdnT
+wmzm0Np85+1mjPpBpcgpjZ97vBDv/MzUKYTO0UPhy8AMuI7kASruD2f3GHuPxdXD
+NnVt2h/2kW18Z3P8yJJuLaEMLg==
+=HfMZ
+-----END PGP PUBLIC KEY BLOCK-----
diff --git a/NOTICE b/NOTICE
index acdab24..1f09306 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,5 +1,5 @@
 Apache Celix
-Copyright [2012] The Apache Software Foundation
+Copyright [2016] The Apache Software Foundation
 
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).
diff --git a/README.md b/README.md
index bef8d53..4f7b9d0 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,12 @@
 #Apache Celix [![Build Status](https://travis-ci.org/apache/celix.svg?branch=develop)](https://travis-ci.org/apache/celix) [![Coverage Status](https://coveralls.io/repos/apache/celix/badge.svg?branch=develop&service=github)](https://coveralls.io/github/apache/celix?branch=develop) [![Coverity Scan Build Status](https://scan.coverity.com/projects/6685/badge.svg)](https://scan.coverity.com/projects/6685)
-Apache Celix is an implementation of the OSGi specification adapted to C. It will follow the API as close as possible, but since the OSGi specification is written primarily for Java, there will be differences (Java is OO, C is procedural). An important aspect of the implementation is interoperability between Java and C. This interoperability is achieved by porting and implementing the Remote Services specification in Celix.
+Apache Celix is an implementation of the OSGi specification] adapted to C and C++ (C++11). It is a provides a framework to develop (dynamic) modular software applications using component and/or service-oriented programming.
 
 ##Building
-For information how to build Apache Celix see BUILDING
+For information how to build Apache Celix see [Building Apache Celix](documents/building/readme.md)
 
 ##Introduction to Apache Celix
-For an introduction into Apache Celix see [Getting Started Guide](https://celix.apache.org/documentation/getting_started.html)
+For an introduction into Apache Celix see [Apache Celix Intro](documents/intro/readme.md)
+
+##Getting Started with Apache Celix
+For a guide how to start writing your own bundles and services see [Getting Started Guide](documents/getting_started/readme.md)
+
diff --git a/RELEASE_NOTES b/RELEASE_NOTES
index 0bc86e9..002260c 100644
--- a/RELEASE_NOTES
+++ b/RELEASE_NOTES
@@ -1,10 +1,14 @@
-Release Notes for 1.0.0.incubating
+Release Notes for 2.0.0
 Remarks:
- * Components that are 1.0.0 are
+ * Components that are 2.0.0 are
    - Framework
    - Utils
    - Shell
+
+* Components that are 1.0.0
    - Shell TUI
    - Log Service
    - Log Writer
-   - Launcher
\ No newline at end of file
+   - Launcher
+   - C Dependency Manager
+   - C++ Dependency Manager
diff --git a/celix-bootstrap/README.md b/celix-bootstrap/README.md
deleted file mode 100644
index 0bc5553..0000000
--- a/celix-bootstrap/README.md
+++ /dev/null
@@ -1,64 +0,0 @@
-# celix-bootstrap
-A (python based) code generation tool for [Apache Celix](https://celix.apache.org/) projects and bundles.
-
-##Installation
-
-###Option 1 (install with distutils)
-
-* Install PyYAML: `pip install pyyaml`
-* Download Cog from https://pypi.python.org/pypi/cogapp
-* Unpack and run `python setup.py install' in the cogapp directory
-* Clone this repository
-* Run `python setup.py install` in the celix-bootstrap directory
-
-###Option 2 (configure with alias)
-
-* Install PyYAML: `pip install pyyaml`
-* Download Cog from https://pypi.python.org/pypi/cogapp
-* Unpack it in a convenient directory 
-* Clone this repository
-* Create a celix-bootstrap alias:
-```
-alias celix-bootstrap='PYTHONPATH=${cog_dir}:${celix-boostrap_dir} python -m celix.bootstrap'
-```
-
-#Concept
-The idea behind celix-boostrap is to enable users of Apache Celix to very fast setup of Apache Celix bundle projects. And after that to be able to generate and update the initial bundle code based on some declaritive attributes.
-
-celix-boostrap is build on top of [Cog](https://celix.apache.org/). "Cog is a file generation tool. It lets you use pieces of Python code as generators in your source files to generate whatever text you need." 
-
-The code generation code is added in the comments of the source code (in this case C or CMake syntax). This enables a
-source files which contains manual code and generated code to coexists and to able to rerun code generation after manual editing source files.
-
-Is good to known that you should not edit anything between the following comments.
-```
-{{
-{{end}}
-```
-
-#Usage
-
-You can setup a new Apache Celix project by executing following steps:
-* Choose a project directory and cd to it
-* Run `celix-bootstrap create_project .`
-* Edit the project.yaml file and ensure that the celix_install_dir points to the directory where Apache Celix is installed
-* Run `celix-bootstrap update .` to generate the needed files
-* (Optional) Update the project.yaml file and run `celix-bootstrap update .` again to update the generated files
-* (Optional) Run `celix-bootstrap update . -e` to update the project source files one more time and remove the code generation parts
-
-You can create a new bundle by executing the following steps:
-* cd to the project directory
-* Run `celix-bootstrap create_bundle mybundle`
-* Edit the `mybundle/bundle.yaml` file to declare which components you like to create and what services those components depends on and/or provide
-* Run `celix-bootstrap update mybundle` to generate the neccesary files
-* Run `celix-bootstrap update .` to include the new bundle into the CMakeLists.txt 
-* Add code to the component and when providing service also add the necesarry code to the bundle activator
-* (Optional) Run `celix-bootstrap update . -e` to update the bundle source files one more time and remove the code generation parts
-
-You can build your whole project with the following step:
-* cd to the project directory
-* Run `celix-bootstrap build buildDirectory` to build and the deploy the code within the buildDirectory
-* In case the build was successful, you'll find several deployed configuration at buildDirectory/deploy
-
-Additional Info
-* You can use the -t argument to use a different set of template (project & bundle) files. The original template files can be found at ${celix-bootstrap_dir}/templates
diff --git a/celix-bootstrap/celix/__init__.py b/celix-bootstrap/celix/__init__.py
deleted file mode 100644
index 00ae6c0..0000000
--- a/celix-bootstrap/celix/__init__.py
+++ /dev/null
@@ -1,17 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
diff --git a/celix-bootstrap/celix/bootstrap/__init__.py b/celix-bootstrap/celix/bootstrap/__init__.py
deleted file mode 100644
index 978b68a..0000000
--- a/celix-bootstrap/celix/bootstrap/__init__.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
diff --git a/celix-bootstrap/celix/bootstrap/__main__.py b/celix-bootstrap/celix/bootstrap/__main__.py
deleted file mode 100644
index d43e983..0000000
--- a/celix-bootstrap/celix/bootstrap/__main__.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#!/usr/bin/env python
-
-from . import argument_parser
-
-argument_parser.main()
diff --git a/celix-bootstrap/celix/bootstrap/argument_parser.py b/celix-bootstrap/celix/bootstrap/argument_parser.py
deleted file mode 100644
index be7f5dc..0000000
--- a/celix-bootstrap/celix/bootstrap/argument_parser.py
+++ /dev/null
@@ -1,94 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-#!/usr/bin/env python
-import os
-import argparse
-from . import generators
-import subprocess
-
-def main() :
-	parser = argparse.ArgumentParser("celix-bootstrap")
-
-	CREATE_PROJECT_COMMAND = "create_project"	
-	CREATE_BUNDLE_COMMAND = "create_bundle"
-
-	UPDATE_COMMAND = "update"
-	BUILD_COMMAND = "build"
-
-	#positional
-	parser.add_argument("command", help="The command to execute", choices=(CREATE_PROJECT_COMMAND, CREATE_BUNDLE_COMMAND, UPDATE_COMMAND, BUILD_COMMAND))
-	parser.add_argument("directory", help="The directory to work on")
-
-	#optional
-	parser.add_argument("-e", "--erase", help="erase cog code when updating", action="store_true")
-	parser.add_argument("-t", "--template_dir", help="define which template directory to use. Default is '%s/templates'" % os.path.dirname(__file__), action="store")
-
-	args = parser.parse_args()
-	
-	gm = GeneratorMediator(args.directory, args.erase, args.template_dir)
-
-	if args.command == CREATE_BUNDLE_COMMAND :
-		gm.createBundle()
-	elif args.command == CREATE_PROJECT_COMMAND :
-		gm.createProject()
-	elif args.command == UPDATE_COMMAND :
-		gm.update()
-	elif args.command == BUILD_COMMAND :
-		gm.build()
-	else :
-		sys.exit()
-
-
-class GeneratorMediator :
-	
-	gendir = None
-	bundleGenerator = None
-	projectGenerator = None
-	
-	def __init__(self, gendir, erase, template_dir) :		
-		self.gendir = gendir
-		self.bundleGenerator = generators.Bundle(gendir, erase, template_dir)
-		self.projectGenerator = generators.Project(gendir, erase, template_dir)
-
-	def createBundle(self) :
-		self.bundleGenerator.create()
-	
-	def createProject(self) :
-		self.projectGenerator.create()	
-	
-
-	def update(self) :
-		if os.path.isfile(os.path.join(self.gendir, "bundle.yaml")) :
-			print("Generating/updating bundle code")
-			self.bundleGenerator.update()
-		if os.path.isfile(os.path.join(self.gendir, "project.yaml")) :
-			print("Generating/updating project code")
-			self.projectGenerator.update()
-
-	def build(self) :
-		if not os.path.exists(self.gendir):
-			print("Creating Directory " + self.gendir)
-			os.makedirs(self.gendir)
-
-		cmake = subprocess.Popen(["cmake", os.getcwd()], cwd=self.gendir, stderr=subprocess.STDOUT)
-		if cmake.wait() != 0:
-			print("Cmake run failed. Do you perform to need an update run first?")
-		else:
-			make = subprocess.Popen(["make", "all", "deploy"], cwd=self.gendir, stderr=subprocess.STDOUT)
-			if make.wait() != 0:
-				print("Compilation failed. Please check your code")
diff --git a/celix-bootstrap/celix/bootstrap/celix_utils.py b/celix-bootstrap/celix/bootstrap/celix_utils.py
deleted file mode 100644
index 167b955..0000000
--- a/celix-bootstrap/celix/bootstrap/celix_utils.py
+++ /dev/null
@@ -1,155 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-import cmd
-import glob
-import os.path
-import re
-import readline
-import sys
-
-class PathCompleter(object):
-
-    def __init__(self, suffix=None):
-        self.suffix=suffix
-
-    def _listdir(self, root=''):
-        res = []
-        for name in glob.glob(root + '*'): 
-            path = os.path.join(root, name)
-            if os.path.isdir(path):
-                name += os.sep
-            	res.append(name)
-	    else:
-		if self.suffix is None:
-            		res.append(name)
-		elif name.endswith(self.suffix):
-            		res.append(name)
-
-        return res
-
-    def complete(self, text, state):
-        buffer = readline.get_line_buffer()
-        return self._listdir(buffer.strip())[state]
-
-
-class FileContentCompleter(object):
-    def __init__(self, filename, keywords=[]):
-        self._indexFile(filename, keywords)
-
-    def _indexFile(self, filename, keywords=[], delimiter_chars=":;#,.!?{}*)(=\\\"/"):
-        try:
-	    txt_fil = open(filename, "r")
-	    self.found_words = []
-
-            for line in txt_fil:
-		# ignore commented lines
-		if not (line.strip()).startswith(("/*", "*", "//")):
-                    words = line.split()
-                    words2 = [ word.strip(delimiter_chars) for word in words ]
-
-                    for word in words2:
-                        if not word in self.found_words and not word in keywords and not word.isdigit() and not any(i in word for i in delimiter_chars):
-                            self.found_words.append(word)
-
-            txt_fil.close()
-        except IOError as ioe:
-             sys.stderr.write("Caught IOError: " + repr(ioe) + "\n")
-        except Exception as e:
-             sys.stderr.write("Caught Exception: " + repr(e) + "\n")
-
-    def checkWord(self, word):
-        if word in self.found_words:
-		return True
-	else:
-		return False
-
-    def complete(self, text, state):
-        buffr = readline.get_line_buffer()
-	wordlist = [w for w in self.found_words if w.startswith(buffr)]
-
-        return wordlist[state]
-
-def checkInput(msg, regex='', default=''):
-	while True:
-		msgDefault = msg + ' [' + default + ']: ' if default is not '' else msg + ': '
- 		inpt = raw_input(msgDefault).strip() or default
-		
-		if regex is not '':
-			res = re.match(regex, inpt);
-			if res is not None and inpt == res.group():
-				return inpt
-			else:
-				print('Invalid Input.')
-		else:
-			return inpt
-
-def yn(msg, default = 'y'):
-	while True:
-		addComponent = raw_input("%s [%s]:" % (msg, default)) or default
-      		if addComponent.lower() in ('y', 'yes', 'n', 'no'):
-			return addComponent.lower() in ('y', 'yes')
-		else:
-			print("Invalid Input.")
-
-
-def checkCelixInstallation():
-	while True:
-		comp = PathCompleter()
-		# we want to treat '/' as part of a word, so override the delimiters
-		readline.set_completer_delims(' \t\n;')
-		readline.parse_and_bind("tab: complete")
-		readline.set_completer(comp.complete)
-
- 		installDir = checkInput('Please enter celix installation location', '(?:/[^/]+)*$', '/usr/local')
-
-		if os.path.exists(installDir + '/bin/celix'):
-			return installDir
-		else:
-			print('celix launcher could not be found at ' + installDir + '/bin/celix')
-
-
-
-def checkInclude(msg, regex):
-	comp = PathCompleter(".h")
-	# we want to treat '/' as part of a word, so override the delimiters
-	readline.set_completer_delims(' \t\n;')
-	readline.parse_and_bind("tab: complete")
-	readline.set_completer(comp.complete)
-
-	headerFile = checkInput(msg, regex)
-
-	return headerFile
-
-def checkIncludeContent(msg, filename):
-	keywords = ["auto","break","case","char","const","continue","define", "default","do","double","else","endif", "enum","extern","float","for","goto","if","ifndef", "include", "inline","int","long","register","restrict","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while", "celix_status_t"];
-
-	comp = None	
-
-	if os.path.exists(filename):
-		comp = FileContentCompleter(filename, keywords)
-		readline.set_completer_delims(' \t\n;')
-		readline.parse_and_bind("tab: complete")
-		readline.set_completer(comp.complete)
-
-	inpt = checkInput(msg, '[^\s]+');
-
-	if comp is not None:
-		while(comp.checkWord(inpt) == False and yn('\''+ inpt + '\'  was not found in the given include file. Do you really want to use it?', 'n') == False):
-			inpt = checkInput(msg, '[^\s]+');
-
-	return inpt
diff --git a/celix-bootstrap/celix/bootstrap/generators.py b/celix-bootstrap/celix/bootstrap/generators.py
deleted file mode 100644
index 1bf3058..0000000
--- a/celix-bootstrap/celix/bootstrap/generators.py
+++ /dev/null
@@ -1,172 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-import shutil
-import os
-import sys
-import yaml
-import cogapp
-
-class BaseGenerator(object):
-	gendir = None
-	descriptor = None
-	erase_cog = False
-	template_dir = None
-	profile= None
-	gen_code_suffix = "do not edit, generated code"
-	markers="{{ }} {{end}}"
-
-	def __init__(self, gendir, profile, erase, template_dir) :
-		self.gendir = gendir
-		self.descriptor = "%s/%s.yaml" % (gendir, profile)
-		self.template_dir = os.path.join(os.getcwd(), os.path.dirname(__file__), "templates")
-		self.profile = profile
-		self.erase_cog = erase
-		if template_dir is not None :
-			self.template_dir = template_dir
-
-	def set_erase_cog(self, erase) :
-		self.erase_cog = erase
-
-	def set_template_dir(self, tdir) :
-		self.template_dir = tdir
-
-	def set_gen_cod_suffic(self, suffix) :
-		self.gen_code_suffic = suffix
-
-	def set_cog_markers(markers) :
-		self.markers = markers
-		
-	def create(self) :
-		if os.path.exists(self.descriptor) :
-			print("%s Already exists. Will not override existing %s.yaml" % (self.descriptor, self.profile))
-		else :
-			if not os.path.exists(self.gendir) :
-				os.makedirs(self.gendir)
-			shutil.copyfile(os.path.join(self.template_dir, self.profile, "%s.yaml" % self.profile), self.descriptor)
-			
-			print("Edit the %s file and run 'celix-bootstrap update %s' to generate the source files" % (self.descriptor, self.gendir))
-
-	def read_descriptor(self) :
-		if os.path.isdir(self.gendir) and os.path.exists(self.descriptor) :
-			with open(self.descriptor) as inputFile :
-				try :
-					return yaml.load(inputFile)
-				except ValueError as e:
-					print("ERROR: %s is not a valid yaml file: %s" % (self.descriptor, e))
-					sys.exit(1)
-
-	def update_file(self, template, targetFile, options=[], commentsPrefix="//") :
-		print("Creating file %s %s" % (self.gendir, targetFile))
-		cog_file = os.path.join(self.gendir, targetFile)
-#		cog_file = os.path.join('.', targetFile)
-		if not os.path.exists(cog_file) :
-			print("Creating file %s" % cog_file)
-			if not os.path.exists(os.path.dirname(cog_file)) :
-				os.makedirs(os.path.dirname(cog_file))
-			template_abs = os.path.join(self.template_dir, self.profile,  template)
-			shutil.copyfile(template_abs, cog_file)
-	
-		backup_cog_file = "%s/.cog/%s" % (self.gendir, targetFile)
-		if self.erase_cog :
-			if os.path.exists(backup_cog_file) :
-				print("Will not erase cog code, backup file (%s) for source already exists." % backup_cog_file)
-				sys.exit(1)
-			else :
-				if not os.path.exists(os.path.dirname(backup_cog_file)) :
-					os.makedirs(os.path.dirname(backup_cog_file))
-				shutil.copy(cog_file, backup_cog_file)
-		
-		cog = cogapp.Cog()
-		cog_options = ["cog", "--markers=%s" % self.markers] + options 
-		if self.erase_cog :
-			cog_options += ["-d", "-o", cog_file, backup_cog_file]
-		else :
-			cog_options += ["-r", "-e" ]
-			if commentsPrefix is not None: 
-				cog_options += [ "-s", " %s%s" %(commentsPrefix, self.gen_code_suffix)]
-			cog_options += [cog_file]
-
-		cog.main(cog_options)
-	
-
-class Bundle(BaseGenerator):
-
-	def __init__(self, gendir, erase, template_dir) :
-		BaseGenerator.__init__(self, gendir, "bundle", erase, template_dir)
-		#python3 super(Bundle, self).__init__(gendir, "bundle")
-
-	def update_cmakelists(self) :
-		options = ["-D", "bundleFile=%s" % self.descriptor]
-		self.update_file("CMakeLists.txt", "CMakeLists.txt", options, "#")	
-		
-	def update_activator(self) :
-		options = ["-D", "bundleFile=%s" % self.descriptor]
-		self.update_file("bundle_activator.c", "private/src/bundle_activator.c", options)
-
-	def update_component_header(self, componentName) :
-		genfile = "private/include/%s.h" % componentName
-		options = ["-D", "bundleFile=%s" % self.descriptor, "-D", "componentName=%s" % componentName]
-		self.update_file("component.h", genfile, options)
-
-	def update_component_source(self, componentName) :
-		genfile = "private/src/%s.c" % componentName
-		options = ["-D", "bundleFile=%s" % self.descriptor, "-D", "componentName=%s" % componentName]
-		self.update_file("component.c", genfile, options)
-
-	def update_service_header(self, componentName, service) :
-		genfile = "public/include/%s" % service['include']
-		options = ["-D", "bundleFile=%s" % self.descriptor,  "-D", "componentName=%s" % componentName, "-D", "serviceName=%s" % service['name']]
-		self.update_file("service.h", genfile, options)
-
-	def create(self) :
-		self.update_file(os.path.join(self.template_dir, self.profile, "%s.yaml" % self.profile), "%s.yaml" % self.profile, [], None)
-
-	def update(self) :
-		bd = self.read_descriptor()
-		if bd is None :
-			print("%s does not exist or does not contain a bundle.yaml file" % self.gendir)
-		else :
-			self.update_cmakelists()	
-			self.update_activator()
-			if 'components' in bd and bd['components'] is not None:
-				for comp in bd['components'] :
-					self.update_component_header(comp['name'])
-					self.update_component_source(comp['name'])
-					if 'providedServices' in comp and comp['providedServices'] is not None:
-						for service in comp['providedServices']:
-							self.update_service_header(comp['name'], service)
-
-class Project(BaseGenerator):
-
-	def __init__(self, gendir, erase, template_dir) :
-		BaseGenerator.__init__(self, gendir, "project", erase, template_dir)
-		#python3 super(Project, self).__init__(gendir, "project")
-
-	def update_cmakelists(self) :
-                options = ["-D", "projectFile=%s" % self.descriptor]
-                self.update_file("CMakeLists.txt", "CMakeLists.txt", options, "#")      
-
-        def create(self) :
-                self.update_file(os.path.join(self.template_dir, self.profile, "%s.yaml" % self.profile),  "%s.yaml" % self.profile, [], None)  
-
-	def update(self) :
-		descriptor = self.read_descriptor()
-		if descriptor is None :
-                        print("%s does not exist or does not contain a project.yaml file" % self.gendir)
-                else :
-                        self.update_cmakelists()        
diff --git a/celix-bootstrap/celix/bootstrap/templates/bundle/CMakeLists.txt b/celix-bootstrap/celix/bootstrap/templates/bundle/CMakeLists.txt
deleted file mode 100644
index 8e8e607..0000000
--- a/celix-bootstrap/celix/bootstrap/templates/bundle/CMakeLists.txt
+++ /dev/null
@@ -1,96 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-#{{
-#import os, yaml
-#bundle = None 
-#with open(bundleFile) as input :
-#	bundle = yaml.load(input)
-#
-#if not 'components' in bundle or bundle['components'] is None:
-# 	bundle['components'] = []
-#else:
-#	for comp in bundle['components'] : 
-#		if not 'serviceDependencies' in comp or comp['serviceDependencies'] is None:
-#			comp['serviceDependencies'] = []
-#
-#}}
-#{{end}}
-
-include_directories(
-        ${CELIX_INCLUDE_DIR}/dependency_manager
-        "private/include"
-        "public/include"
-#{{ 
-#for comp in bundle['components'] : 
-#       for service in comp['serviceDependencies']:
-#                       cog.outl("\t\"%s\"" % os.path.abspath(os.path.dirname(service['include']))) 
-#}}
-"org.example.mybundle" #do not edit, generated code
-#{{end}}
-
-)
-
-add_bundle(
-#{{ 
-#cog.outl("\t%s" % bundle['name'])
-#cog.outl("\tNAME \"%s\"" % bundle['name'])
-#cog.outl("\tSYMBOLIC_NAME \"%s\"" % bundle['symbolicName']) 
-#cog.outl("\tVERSION \"0.0.1\"")
-#cog.outl("\t%s SOURCES") 
-#cog.outl("\t\tprivate/src/bundle_activator")
-#for comp in bundle['components'] :
-#	cog.outl("\t\tprivate/src/%s" % comp['name'])
-#}}
-mybundle SOURCES #do not edit, generated code
-	private/src/bundle_activator #do not edit, generated code
-	private/src/example #do not edit, generated code
-#{{end}}
-)
-
-
-#{{ 
-#cog.outl("SET(BUNDLE_LIB \"%s\")" % bundle['name']) 
-#}}
-SET(BUNDLE_LIB "mybundle") #do not edit, generated code
-#{{end}}
-
-IF(APPLE)
-target_link_libraries(${BUNDLE_LIB} ${CELIX_FRAMEWORK_LIBRARY} -Wl,-all_load dependency_manager  ${CELIX_UTILS_LIBRARY})
-else()
-target_link_libraries(${BUNDLE_LIB} -Wl,--whole-archive dependency_manager -Wl,--no-whole-archive ${CELIX_FRAMEWORK_LIBRARY} ${CELIX_UTILS_LIBRARY})
-ENDIF()
-
-#{{
-#cog.outl("add_deploy(%s_deploy" % bundle['name'])
-#cog.outl("\tCOPY")
-#cog.outl("\tNAME \"%s\"" % bundle['name'])
-#cog.outl("\tBUNDLES")
-#cog.outl("\t\t${CELIX_BUNDLES_DIR}/shell.zip")
-#cog.outl("\t\t${CELIX_BUNDLES_DIR}/dm_shell.zip")
-#cog.outl("\t\t${CELIX_BUNDLES_DIR}/shell_tui.zip")
-#cog.outl("\t\t${CELIX_BUNDLES_DIR}/log_service.zip")
-#cog.outl("\t\t%s" % bundle['name'])
-#cog.outl(")")
-#}}
-add_deploy(mybundle_deploy
-    COPY
-    NAME "mybundle"
-    BUNDLES 
-        mybundle
-)
-#{{end}}
diff --git a/celix-bootstrap/celix/bootstrap/templates/bundle/bundle.yaml b/celix-bootstrap/celix/bootstrap/templates/bundle/bundle.yaml
deleted file mode 100644
index 797795f..0000000
--- a/celix-bootstrap/celix/bootstrap/templates/bundle/bundle.yaml
+++ /dev/null
@@ -1,91 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-
-
-
-
-#{{
-#from celix.bootstrap.celix_utils import *
-#}}
-#{{end}}
-
-
-#{{ 
-# name = checkInput('\nPlease enter bundleName', '([a-zA-Z_][a-zA-Z0-9_]*)', 'mybundle')
-# cog.out('name : \'%s\'' % name )
-#}}
-name: 'mybundle'
-#{{end}}
-
-#{{
-# symName = checkInput('\nPlease enter symbolicName', '([a-zA-Z_][a-zA-Z0-9_.]*)', 'org.example.mybundle') 
-# cog.out('symbolicName: \'%s\'' % symName )
-#}}
-symbolicName: 'org.example.mybundle'
-#{{end}}
-
-components: 
-    #{{
-    #
-    #while yn('Do you want to add ' + ('a' if 'componentName' not in vars() else 'another') + ' component?'):
-    #		componentName = checkInput('\nPlease enter componentName', '([a-zA-Z_][a-zA-Z0-9_]*)', 'example') 
-    #		cog.outl('- name: \'%s\'' % componentName )
-    #		cog.outl('  providedServices:')
-    #		while yn('Should component \'%s\' provide %s service?' % (componentName, 'a' if 'psInclude' not in vars() else 'another')):
-    #			psServiceName1 = checkInput('(1) Please enter a name, which can be used for the filename and the include guards', '([a-zA-Z_][a-zA-Z0-9_]*)'); 
-    #			psServiceName2 = checkInput('(2) Please enter a name, which is used to register and lookup the service', '([a-zA-Z_][a-zA-Z0-9_]*)', (psServiceName1.lower() + ('_service' if not psServiceName1.endswith('_service') else ''))); 
-    #			psServiceVersion = checkInput('(3) Please enter a version number', '(\d+\.)?(\d+\.)?(\d+\.)?(\*|\d+)', '1.0.0.0'); 
-    #			psServiceType = checkInput('(4) Please enter a type', '([a-zA-Z_][a-zA-Z0-9_]*)',  (psServiceName1.lower() + ('_service_t' if not psServiceName1.endswith('_service_t') else ''))  );
-    #			psInclude = checkInput('(5) Please enter the name of the include file', '(.+?)(\.[^.]*$|$)', psServiceName1.lower() + '.h'); 
-    #
-    #			print("\n Summary:")	
-    #			print("\tname :\t%s" % (psServiceName1))	
-    #			print("\tservice_name:\t%s" % (psServiceName2))	
-    #			print("\tservice_version:\t%s" % (psServiceVersion))	
-    #			print("\tservice_type:\t%s" % (psServiceType))	
-    #			print("\tinclude file:\t%s" % (psInclude)) 
-    #			if yn('Are those information correct?'):
-    #				cog.outl('      - {include: \'%s\', name: \'%s\', service_name: \'%s\', service_version: \'%s\', type: \'%s\'}' % (psInclude, psServiceName1, psServiceName2, psServiceVersion, psServiceType))
-    #			else:
-    #				print("Service was not added.")
-    #
-    #		cog.outl('  serviceDependencies:')
-    #		while yn('Should component \'%s\' depend on %s service?' % (componentName, 'a' if 'sdInclude' not in vars() else 'another')):
-    #			sdInclude = checkInclude('(1) Please enter the include filename, which describes the service', '(.+?)(\.[^.]*$|$)'); 
-    #			sdServiceName1 = checkInput('(2) Please enter a name, which is used to generate the code', '([a-zA-Z_][a-zA-Z0-9_]*)'); 
-    #			sdServiceName2 = checkIncludeContent('(3) Please enter the variable/constants, which is used to register the service within the framework', sdInclude); 
-    #			sdServiceRange = checkIncludeContent('(4) Please enter the variable/constants, which contains the version range', sdInclude); 
-    #			sdServiceType = checkIncludeContent('(5) Please enter the type of the service', sdInclude);
-    #			sdCardinality = checkInput('(6) Please enter the cardinality (one|many|optional)', '(one)|(many)|(optional)');
-    #
-    #			print("\n Summary:")	
-    #			print("\tname :\t%s" % (sdServiceName1))	
-    #			print("\tservice_name:\t%s" % (sdServiceName2))	
-    #			print("\tservice_range:\t%s" % (sdServiceRange))	
-    #			print("\tservice_type:\t%s" % (sdServiceType))	
-    #			print("\tcardinality:\t%s" % (sdCardinality)) 
-    #			print("\tinclude file:\t%s" % (sdInclude)) 
-    #			if yn('Are those information correct?'):
-    #				cog.outl('      - {include: \'%s\', name: \'%s\', service_name: \'%s\', service_versionrange: \'%s\', type: \'%s\', cardinality: \'%s\'}' % (sdInclude, sdServiceName1, sdServiceName2, sdServiceRange, sdServiceType, sdCardinality))
-    #			else:
-    #				print("Service dependency was not added.")
-    #}}
-    #{{end}}
-
-
-
diff --git a/celix-bootstrap/celix/bootstrap/templates/bundle/bundle_activator.c b/celix-bootstrap/celix/bootstrap/templates/bundle/bundle_activator.c
deleted file mode 100644
index 025eed4..0000000
--- a/celix-bootstrap/celix/bootstrap/templates/bundle/bundle_activator.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-//{{
-//import os, yaml
-//bundle = None 
-//with open(bundleFile) as input :
-//	bundle = yaml.load(input)
-//
-//if not 'components' in bundle or bundle['components'] is None:
-// 	bundle['components'] = []
-//else:
-//	for comp in bundle['components'] : 
-//		if not 'serviceDependencies' in comp or comp['serviceDependencies'] is None:
-//			comp['serviceDependencies'] = []
-//		if not 'providedServices' in comp or comp['providedServices'] is None:
-//			comp['providedServices'] = []
-//}}
-//{{end}}
-#include <stdlib.h>
-#include <pthread.h>
-
-#include <constants.h>
-#include <bundle_context.h>
-#include <service_tracker.h>
-#include <hash_map.h>
-
-#include "bundle_activator.h"
-#include "dm_activator_base.h"
-
-//Includes for the services / components
-//{{
-//for comp in bundle['components'] : 
-//	cog.outl("#include \"%s.h\"" % comp['name'])
-//	for service in comp['providedServices'] :
-//		cog.outl("#include <%s>" % service['include'])
-//	for service in comp['serviceDependencies'] :
-//		cog.outl("#include <%s>" % os.path.split(service['include'])[1])
-//}}
-//{{end}}
-
-//{{
-//cog.outl("struct %s_activator_struct {" %(bundle['name']) )
-//for comp in bundle['components'] : 
-//      cog.outl("    %s_cmp_t *%sCmp;" %(comp['name'], comp['name']) )
-//      for service in comp['providedServices'] :
-//              cog.outl("      %s %sServ;" %(service['type'],service['name']) )
-//cog.outl("};");
-//}}
-struct example_activator_struct {
-        example_cmp_t* exampleCmp;
-        example_t exampleServ;  
-};
-//{{end}}
-
-
-celix_status_t dm_create(bundle_context_pt context, void **userData) {
-//{{
-//cog.outl("    printf(\"%s: dm_create\\n\");" %(bundle['name']) )
-//cog.outl("    *userData = calloc(1, sizeof(struct %s_activator_struct));" %(bundle['name']) )
-//}}
-        *userData = calloc(1, sizeof(struct example_activator_struct));
-        printf("example: dm_create\n");
-//{{end}}
-        return *userData != NULL ? CELIX_SUCCESS : CELIX_ENOMEM;
-}
-
-celix_status_t dm_init(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
-        celix_status_t status = CELIX_SUCCESS;
-//{{
-//cog.outl("    printf(\"%s: dm_init\\n\");" %(bundle['name']) )
-//cog.outl("    struct %s_activator_struct *act = (struct %s_activator_struct *) userData;" %(bundle['name'],bundle['name']) )
-//for comp in bundle['components'] : 
-//      cog.outl("      act->%sCmp = %s_create();" %(comp['name'],comp['name']) )
-//      cog.outl("      if (act->%sCmp != NULL) {" %(comp['name']) )
-//      cog.outl("              dm_component_pt cmp%s;" %(comp['name'].title()))
-//      cog.outl("              component_create(context, \"%s_PROCESSING_COMPONENT\", &cmp%s);" %(comp['name'].upper(), comp['name'].title()))
-//      cog.outl("              component_setImplementation(cmp%s, act->%sCmp);" %(comp['name'].title(), comp['name']) )
-//      cog.outl("              component_setCallbacksSafe(cmp%s, %s_cmp_t *, %s_init, %s_start, %s_stop, %s_deinit);" %(comp['name'].title(), comp['name'],comp['name'],comp['name'],comp['name'],comp['name']) )
-//
-//      for service in comp['providedServices'] :
-//              cog.outl("              properties_pt props%s = properties_create();" %(service['name'].title()))
-//              cog.outl("              act->%sServ.handle = act->%sCmp;" %(service['name'], comp['name']) )
-//              cog.outl("              act->%sServ.callService = (void *)%s%s_callService;" %(service['name'], comp['name'],service['name'].title()) )
-//              cog.outl("              properties_set(props%s, \"id\", \"%s\");" %(service['name'].title(), comp['name']) )
-//              cog.outl("              component_addInterface(cmp%s, %s_NAME, %s_VERSION, &act->%sServ, props%s);" %(comp['name'].title(), service['name'].upper(), service['name'].upper(), service['name'], service['name'].title()) )
-//
-//      for service in comp['serviceDependencies'] :
-//              cog.outl("              dm_service_dependency_pt dep%s;" %(service['name'].title()))
-//              cog.outl("              serviceDependency_create(&dep%s);" %(service['name'].title()))
-//              cog.outl("              serviceDependency_setService(dep%s, (char*) %s, (char*) %s, NULL);" %(service['name'].title(), service['service_name'], service['service_versionrange']))
-//              cog.outl("              serviceDependency_setCallbacksSafe(dep%s, %s_cmp_t *, %s, %s_set%s, NULL, NULL, NULL, NULL);" %(service['name'].title(), comp['name'], service['type'], comp['name'], service['name']) )
-//              cog.outl("              serviceDependency_setRequired(dep%s, true);" %(service['name'].title()))
-//              cog.outl("              component_addServiceDependency(cmp%s, dep%s);" %(comp['name'].title(), service['name'].title()))
-//
-//      cog.outl("              dependencyManager_add(manager, cmp%s);"  %(comp['name'].title()))
-//      cog.outl("      } else {")
-//      cog.outl("              status = CELIX_ENOMEM;")
-//      cog.outl("      }")
-//}}
-        struct example_activator_struct *act = (struct example_activator_struct *) userData;
-
-        printf("example: dm_init\n");
-
-        act->exampleCmp = example_create();
-        if (act->exampleCmp != NULL) {
-                dm_component_pt cmpExample;
-                component_create(context, "EXAMPLE_PROCESSING_COMPONENT", &cmpExample);
-                component_setImplementation(cmpExample, act->exampleCmp);
-                component_setCallbacksSafe(cmpExample, example_cmp_t *, example_init, example_start, example_stop, example_deinit);
-                
-                // provided services
-                properties_pt propsExample = properties_create();
-                act->exampleServ.handle = act->exampleCmp;
-                act->exampleServ.getDate = act->exampleServ_getData;
-                properties_set(propsExample, "id", "example");
-
-                component_addInterface(cmpExample, EXAMPLE_NAME, EXAMPLE_VERSION, &act->exampleServ, propsExample);
-                dependencyManager_add(manager, cmpExample);
-        }
-
-//{{end}}
-    return status;
-}
-
-
-celix_status_t dm_destroy(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
-//{{
-//cog.outl("    printf(\"%s: dm-destroy\\n\");" %(bundle['name']) )
-//cog.outl("    struct %s_activator_struct *act = (struct %s_activator_struct *)userData;" %(bundle['name'],bundle['name']) )
-//cog.outl("    if (act->%sCmp != NULL) {" %(comp['name']) )
-//cog.outl("            %s_destroy(act->%sCmp);" %(comp['name'],comp['name']) )
-//cog.outl("    }");
-//cog.outl("    free(act);")
-//}}
-        struct example_activator_struct *act = (struct example_activator_struct *) userData;
-        printf("example: dm_destroy\n");
-        
-        if (act->exampleCmp != NULL) {  
-                example_destroy(act->exampleCmp);
-        }
-//{{end}}
-        return CELIX_SUCCESS;
-}
-
diff --git a/celix-bootstrap/celix/bootstrap/templates/bundle/component.c b/celix-bootstrap/celix/bootstrap/templates/bundle/component.c
deleted file mode 100644
index b73cba7..0000000
--- a/celix-bootstrap/celix/bootstrap/templates/bundle/component.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * component.c
- *
- *  \date       Oct 29, 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
-//{{
-//import os, yaml
-//bundle = None 
-//with open(bundleFile) as input :
-//      bundle = yaml.load(input)
-//
-//if not 'components' in bundle or bundle['components'] is None:
-// 	bundle['components'] = []
-//else:
-//	for comp in bundle['components'] : 
-//		if not 'serviceDependencies' in comp or comp['serviceDependencies'] is None:
-//			comp['serviceDependencies'] = []
-//              if not 'providedServices' in comp or comp['providedServices'] is None:
-//                      comp['providedServices'] = []
-//
-//
-//for comp in bundle['components'] :
-//      if comp['name'] == componentName :
-//              component = comp
-//              break
-//}}
-//{{end}}
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <signal.h>
-
-#include "celix_threads.h"
-
-
-//Includes for the services / components
-//{{
-//cog.outl("#include \"%s.h\"" % component['name'])
-//for service in component['providedServices'] :
-//      cog.outl("#include <%s>" % service['include'])
-//for service in component['serviceDependencies'] :
-//      cog.outl("#include <%s>" % os.path.split(service['include'])[1])
-//}}
-//{{end}}
-
-
-//{{
-//cog.outl("struct %s_cmp_struct {" %(component['name']) )
-//for service in component['serviceDependencies'] :
-//      cog.outl("      %s %sServ;" %(service['type'], service['name']))
-//      cog.outl("      celix_thread_mutex_t %sMutex;" %(service['name']))
-//cog.outl("};");
-//}}
-struct example_cmp_struct {
-    phase1_t* phase1Serv;
-    celix_thread_mutex_t mutex;
-};
-//{{end}}
-
-
-
-//{{
-//cog.outl("%s_cmp_t *%s_create(void) {" %(component['name'], component['name']))
-//cog.outl("    %s_cmp_t *cmp = calloc(1, sizeof(*cmp));" %(component['name']))
-//cog.outl("    if (cmp != NULL) {")
-//for service in component['serviceDependencies'] :
-//      cog.outl("              celixThreadMutex_create(&cmp->%sMutex, NULL);" %(service['name']));
-//cog.outl("    }");
-//}}
-example_cmp_t* example_create(void) {
-        example_cmp_t* cmp = calloc(1, sizeof(*cmp));
-        if (cmp != NULL) {
-                celixThreadMutex_create(&cmp->mutex, NULL);
-        }
-//{{end}}
-
-        return cmp;
-}
-
-//{{
-//cog.outl("int %s_init(%s_cmp_t* cmp) {" %(component['name'], component['name']) )
-//cog.outl("    printf(\"init %s\\n\");" %(component['name']) )
-//}}
-int example_init(example_cmp_t* cmp) {
-        printf("init example\n");
-//{{end}}
-        return 0;
-}
-
-//{{
-//cog.outl("int %s_start(%s_cmp_t* cmp) {" %(component['name'], component['name']) )
-//cog.outl("    printf(\"start %s\\n\");" %(component['name']) )
-//}}
-int example_init(example_cmp_t* cmp) {
-        printf("start example\n");
-//{{end}}
-        return 0;
-}
-
-//{{
-//cog.outl("int %s_stop(%s_cmp_t* cmp) {" %(component['name'], component['name']) )
-//cog.outl("    printf(\"stop %s\\n\");" %(component['name']) )
-//}}
-int example_stop(example_cmp_t* cmp) {
-        printf("stop example\n");
-//{{end}}
-        return 0;
-}
-
-//{{
-//cog.outl("int %s_deinit(%s_cmp_t* cmp) {" %(component['name'], component['name']) )
-//cog.outl("    printf(\"deinit %s\\n\");" %(component['name']) )
-//}}
-int example_deinit(example_cmp_t* cmp) {
-        printf("deinit example\n");
-//{{end}}
-        return 0;
-}
-
-//{{
-//cog.outl("int %s_destroy(%s_cmp_t* cmp) {" %(component['name'], component['name']) )
-//cog.outl("    printf(\"destroy %s\\n\");" %(component['name']) )
-//}}
-int example_destroy(example_cmp_t* cmp) {
-        printf("destroy example\n");
-//{{end}}
-        free(cmp);
-        return 0;
-}
-
-
-//{{
-//for service in component['serviceDependencies'] :
-//      cog.outl("int %s_set%s(%s_cmp_t* cmp, %s srvc) {" %(component['name'], service['name'], component['name'], service['type']) )
-//      cog.outl("      printf(\"%s_set%s called!\\n\");" %(component['name'], service['name']) )
-//      cog.outl("      celixThreadMutex_lock(&cmp->%sMutex);" %(service['name']))
-//      cog.outl("      cmp->%sServ = srvc;" %(service['name']))
-//      cog.outl("      celixThreadMutex_unlock(&cmp->%sMutex);" %(service['name']))
-//      cog.outl("      return 0;")
-//      cog.outl("}")
-//}}
-int example_setDependendService(example_cmp_t* cmp, void* service) {
-        celixThreadMutex_lock(&cmp->mutex);
-        cmp->phase1Serv = service;
-        celixThreadMutex_unlock(&cmp->mutex);
-        return 0;
-}
-//{{end}}
-
-
-//{{
-//for service in component['providedServices'] :
-//      cog.outl("int %s%s_callService(%s_cmp_t* cmp, void* data) {" %(component['name'], service['name'].title(), component['name']) )
-//      cog.outl("      printf(\"%s%s callService\\n\");" %(component['name'], service['name'].title() ))
-//      cog.outl("      return 0;")
-//      cog.outl("}")
-//}}
-   
-int example_callService(example_cmp_t* cmp, void* data) {
-        printf("callService called!!\n");
-        return 0;
-}
-//{{end}}
-
diff --git a/celix-bootstrap/celix/bootstrap/templates/bundle/component.h b/celix-bootstrap/celix/bootstrap/templates/bundle/component.h
deleted file mode 100644
index ec43f81..0000000
--- a/celix-bootstrap/celix/bootstrap/templates/bundle/component.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * component.c
- *
- *  \date       Oct 29, 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
-//{{
-//import os, yaml
-//bundle = None 
-//with open(bundleFile) as input :
-//      bundle = yaml.load(input)
-//
-//if not 'components' in bundle or bundle['components'] is None:
-// 	bundle['components'] = []
-//else:
-//	for comp in bundle['components'] : 
-//		if not 'serviceDependencies' in comp or comp['serviceDependencies'] is None:
-//			comp['serviceDependencies'] = []
-//		if not 'providedServices' in comp or comp['providedServices'] is None:
-//			comp['providedServices'] = []
-//
-//for comp in bundle['components'] :
-//	if comp['name'] == componentName :
-//		component = comp
-//		break
-//
-//cog.outl("#ifndef __%s_H_" % componentName.upper())
-//cog.outl("#define __%s_H_" % componentName.upper())
-//cog.outl("")
-//
-//if 'serviceDependencies' in comp and component['serviceDependencies'] is not None:
-//      for service in component['serviceDependencies'] :
-//              cog.outl("#include <%s>" % os.path.split(service['include'])[1])
-//      cog.outl("")
-//
-//}}
-#ifndef __EXAMPLE_H_ //do not edit, generated code
-#define __EXAMPLE_H_ //do not edit, generated code
-//{{end}}
-#include <celix_errno.h>
-//{{
-//cog.outl("typedef struct %s_cmp_struct %s_cmp_t;" %(component['name'], component['name']))
-//cog.outl("%s_cmp_t *%s_create(void);" %(component['name'], component['name']))
-//cog.outl("int %s_init(%s_cmp_t *cmp);" %(component['name'], component['name']))
-//cog.outl("int %s_start(%s_cmp_t *cmp);" %(component['name'], component['name'])) 
-//cog.outl("int %s_stop(%s_cmp_t *cmp);" %(component['name'],component['name'])) 
-//cog.outl("int %s_deinit(%s_cmp_t *cmp);" %(component['name'],component['name'])) 
-//cog.outl("int %s_destroy(%s_cmp_t *cmp);" %(component['name'],component['name'])) 
-//}}
-//{{end}}
-//{{
-//for service in component['serviceDependencies'] :
-//      cog.outl("int %s_set%s(%s_cmp_t* cmp, %s srvc);" %(component['name'], service['name'], component['name'], service['type'] ) )
-//}}
-//{{end}}
-//{{
-//for service in component['providedServices'] :
-//      cog.outl("int %s%s_callService(%s_cmp_t* cmp, void* data);" %(component['name'], service['name'].title(), component['name']))
-//}}
-//{{end}}
-//{{
-//cog.outl("#endif //__%s_H_" % componentName.upper())
-//}}
-#endif //__EXAMPLE_H_ //do not edit, generated code
-//{{end}}
diff --git a/celix-bootstrap/celix/bootstrap/templates/bundle/service.h b/celix-bootstrap/celix/bootstrap/templates/bundle/service.h
deleted file mode 100644
index 2491350..0000000
--- a/celix-bootstrap/celix/bootstrap/templates/bundle/service.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-//{{
-//import yaml
-//bundle = None
-//with open(bundleFile) as input :
-//	bundle = yaml.load(input)
-//if not 'components' in bundle or bundle['components'] is None:
-// 	bundle['components'] = []
-//else:
-//	for comp in bundle['components'] : 
-//		if not 'providedServices' in comp or comp['providedServices'] is None:
-//			comp['providedServices'] = []
-//
-//for comp in bundle['components'] :
-//	if comp['name'] == componentName :
-//		component = comp
-//
-//		for serv in comp['providedServices'] :
-//			if serv['name'] == serviceName :
-//				service = serv
-//				break
-//
-//cog.outl("#ifndef __%s_H_" % service['name'].upper())
-//cog.outl("#define __%s_H_" % service['name'].upper())
-//cog.outl("")
-//
-//}}
-#ifndef __EXAMPLE_H_ //do not edit, generated code
-#define __EXAMPLE_H_ //do not edit, generated code
-//{{end}}
-
-//TODO add needed includes
-
-//{{
-//cog.outl("#define %s_NAME \"%s_service\"" % (service['name'].upper(), service['service_name']))
-//cog.outl("#define %s_VERSION \"1.0.0.0\"" % (service['name'].upper()))
-//cog.outl("")
-//cog.outl("typedef struct %s_service %s;" % (service['name'], service['type']))
-//cog.outl("")
-//cog.outl("struct %s_service {" % service['name'])
-//cog.outl("\tvoid *handle;")
-//}}
-#define BENCHMARK_SERVICE_NAME "benchmark_service"
-typedef struct benchmark_service *benchmark_service_pt;
-
-struct benchmark_service {
-        benchmark_handler_pt handler;
-//{{end}}}
-        void (*callService)(void *handle, void* data);
-
-//{{
-//cog.outl("};")
-//cog.outl("")
-//cog.outl("")
-//cog.outl("#endif /* __%s_H_ */" % service['name'])
-//}}
-};
-#endif /* BENCHMARK_SERVICE_H_ */
-//{{end}}
diff --git a/celix-bootstrap/celix/bootstrap/templates/project/CMakeLists.txt b/celix-bootstrap/celix/bootstrap/templates/project/CMakeLists.txt
deleted file mode 100644
index 639b7ec..0000000
--- a/celix-bootstrap/celix/bootstrap/templates/project/CMakeLists.txt
+++ /dev/null
@@ -1,53 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#{{
-#import fnmatch
-#import os
-#import yaml
-#project = None 
-#with open(projectFile) as input :
-#	project = yaml.load(input)
-#}}
-#{{end}}
-
-cmake_minimum_required(VERSION 2.8)
-
-#{{
-#	cog.outl("project(%s C)" % project['name'])
-#}}
-project(myproject C) #do not edit, generated code
-#{{end}}
-
-#{{ 
-#       cog.outl("set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} \"%s/share/celix/cmake/modules\")" % project['celix_install_dir'])
-#       cog.outl("link_directories(\"%s/lib\")" % project['celix_install_dir'])
-#}}
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "/usr/local/share/celix/cmake/modules") #do not edit, generated code
-#{{end}}
-
-find_package(CELIX REQUIRED)
-include_directories(${CELIX_INCLUDE_DIRS})
-
-
-#{{
-#for root, dirs, filenames in os.walk('.'):
-#	for foundFile in fnmatch.filter(filenames, 'bundle.yaml'):
-#		cog.outl("add_subdirectory(%s)" % root)
-#}}
-#
-#{{end}}
-
diff --git a/celix-bootstrap/celix/bootstrap/templates/project/deploy.cmake b/celix-bootstrap/celix/bootstrap/templates/project/deploy.cmake
deleted file mode 100644
index b2d49c5..0000000
--- a/celix-bootstrap/celix/bootstrap/templates/project/deploy.cmake
+++ /dev/null
@@ -1,44 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#{{
-#import fnmatch
-#import os
-#import yaml
-#
-#project = None 
-#bundle = None 
-#
-#with open(projectFile) as input :
-#	project = yaml.load(input)
-#
-#cog.outl("deploy( \"%s\" BUNDLES" % project['name'])
-#cog.outl("\t${CELIX_BUNDLES_DIR}/shell.zip")
-#cog.outl("\t${CELIX_BUNDLES_DIR}/dm_shell.zip")
-#cog.outl("\t${CELIX_BUNDLES_DIR}/shell_tui.zip")
-#cog.outl("\t${CELIX_BUNDLES_DIR}/log_service.zip")
-#
-#
-#for root, dirs, filenames in os.walk('.'):
-#	for foundFile in fnmatch.filter(filenames, 'bundle.yaml'):
-#		bundleFile = root + '/' + foundFile
-#		with open(bundleFile) as input :
-#                       bundle = yaml.load(input)
-#                       cog.outl("\t%s" % bundle['name'])
-#
-#cog.outl(")");
-#}}
-#{{end}}
diff --git a/celix-bootstrap/celix/bootstrap/templates/project/project.yaml b/celix-bootstrap/celix/bootstrap/templates/project/project.yaml
deleted file mode 100644
index c3969ea..0000000
--- a/celix-bootstrap/celix/bootstrap/templates/project/project.yaml
+++ /dev/null
@@ -1,35 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#{{
-#from celix.bootstrap.celix_utils import *
-#}}
-#{{end}}
-
-
-# {{ 
-# name = checkInput('\nPlease enter projectname', '([a-zA-Z_][a-zA-Z0-9_]*)', 'myproject')
-# cog.outl('name: \"%s\"' % name )
-# }}
-name: "myproject"
-# {{end}}
-
-# {{  
-# install = checkCelixInstallation()
-# cog.outl('celix_install_dir: \"%s\"' % install ) 
-# }}
-celix_install_dir: "/usr/local"
-# {{end}}
diff --git a/celix-bootstrap/scripts/celix-bootstrap b/celix-bootstrap/scripts/celix-bootstrap
deleted file mode 100755
index 6720cdd..0000000
--- a/celix-bootstrap/scripts/celix-bootstrap
+++ /dev/null
@@ -1,22 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-#!/usr/bin/env python
-
-import celix.bootstrap.argument_parser
-
-celix.bootstrap.argument_parser.main()
diff --git a/celix-bootstrap/setup.py b/celix-bootstrap/setup.py
deleted file mode 100644
index 3952f05..0000000
--- a/celix-bootstrap/setup.py
+++ /dev/null
@@ -1,48 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#!/usr/bin/python
-
-""" Setup.py for Cog
-    http://nedbatchelder.com/code/cog
-
-    Copyright 2004-2015, Ned Batchelder.
-"""
-
-from distutils.core import setup
-
-setup(
-    name = 'celix-bootstrap',    
-    version = '0.1.0',
-    url = '',
-    author = '',
-    author_email = '',
-    description =
-        'celix-bootstrap: A code generator / project generator for Apache Celix.',
-
-    license = 'Apache License, Version 2.0',
-
-    packages = [
-        'celix',
-	'celix/bootstrap'
-        ],
-
-    scripts = [
-        'scripts/celix-bootstrap',
-        ],
-
-    package_data={'celix' : ['bootstrap/templates/**/*']},
-)
diff --git a/cmake/FindCELIX.cmake b/cmake/FindCELIX.cmake
index b2789df..1ddb1ca 100644
--- a/cmake/FindCELIX.cmake
+++ b/cmake/FindCELIX.cmake
@@ -24,7 +24,10 @@
 #  CELIX_INCLUDE_DIRS - The Apache Celix include directories
 #  CELIX_LIBRARIES - The libraries needed to use Apache Celix
 #  CELIX_LAUNCHER - The path to the celix launcher
+#
 #  CELIX_BUNDLES_DIR - The path where the Celix provided bundles are installed
+#  CELIX_DM_STATIC_LIB - The Celix Dependency Manager static library
+#  CELIX_DM_CXX_STATIC_LIB - The Celix C++ Dependency Manager static library
 
 set(CELIX_DIR_FROM_FINDCELIX "${CMAKE_CURRENT_LIST_DIR}/../../../..")
 
@@ -64,18 +67,36 @@
 		PATHS ${CELIX_DIR_FROM_FINDCELIX} $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local
           	PATH_SUFFIXES share/celix/bundles
 )
-	
 
+find_library(CELIX_DM_STATIC_LIB NAMES dependency_manager_static
+		PATHS ${CELIX_DIR_FROM_FINDCELIX} $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local
+		PATH_SUFFIXES lib lib64
+)
+if (CELIX_DM_STATIC_LIB)
+    set(CELIX_DM_INCLUDE_DIR ${CELIX_INCLUDE_DIR}/dependency_manager)
+else()
+    set(CELIX_DM_INCLUDE_DIR )
+endif()
+
+find_library(CELIX_DM_CXX_STATIC_LIB NAMES dependency_manager_cxx_static
+		PATHS ${CELIX_DIR_FROM_FINDCELIX} $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local
+		PATH_SUFFIXES lib lib64
+)
+if (CELIX_DM_CXX_STATIC_LIB)
+    set(CELIX_DM_CXX_INCLUDE_DIR ${CELIX_INCLUDE_DIR}/dependency_manager_cxx)
+else()
+    set(CELIX_DM_CXX_INCLUDE_DIR )
+endif()
 
 include(FindPackageHandleStandardArgs)
 # handle the QUIETLY and REQUIRED arguments and set CELIX_FOUND to TRUE
 # if all listed variables are TRUE
 find_package_handle_standard_args(CELIX  DEFAULT_MSG
-                                  CELIX_FRAMEWORK_LIBRARY CELIX_UTILS_LIBRARY CELIX_INCLUDE_DIR CELIX_LAUNCHER CELIX_CMAKECELIX_FILE) 
+                                  CELIX_FRAMEWORK_LIBRARY CELIX_UTILS_LIBRARY CELIX_DFI_LIBRARY CELIX_DM_STATIC_LIB CELIX_DM_CXX_STATIC_LIB CELIX_INCLUDE_DIR CELIX_LAUNCHER CELIX_CMAKECELIX_FILE)
 mark_as_advanced(CELIX_INCLUDE_DIR CELIX_FRAMEWORK_LIBRARY CELIX_UTILS_LIBRARY CELIX_LAUNCHER CELIX_CMAKECELIX_FILE)
 
 if(CELIX_FOUND)
-	set(CELIX_LIBRARIES ${CELIX_FRAMEWORK_LIBRARY} ${CELIX_UTILS_LIBRARY})
-	set(CELIX_INCLUDE_DIRS ${CELIX_INCLUDE_DIR})
+	set(CELIX_LIBRARIES ${CELIX_FRAMEWORK_LIBRARY} ${CELIX_UTILS_LIBRARY} ${CELIX_DFI_LIBRARY})
+	set(CELIX_INCLUDE_DIRS ${CELIX_INCLUDE_DIR} ${CELIX_DM_INCLUDE_DIR} ${CELIX_DM_CXX_INCLUDE_DIR})
 	include(${CELIX_CMAKECELIX_FILE})
 endif()
diff --git a/cmake/cmake_celix/Manifest.template.in b/cmake/cmake_celix/Manifest.template.in
index d77588c..aeb9d67 100644
--- a/cmake/cmake_celix/Manifest.template.in
+++ b/cmake/cmake_celix/Manifest.template.in
@@ -1,3 +1,4 @@
+Manifest-Version: 1.0
 Bundle-SymbolicName: $<TARGET_PROPERTY:${BUNDLE_TARGET_NAME},BUNDLE_SYMBOLIC_NAME>
 Bundle-Name: $<TARGET_PROPERTY:${BUNDLE_TARGET_NAME},BUNDLE_NAME>
 Bundle-Version: $<TARGET_PROPERTY:${BUNDLE_TARGET_NAME},BUNDLE_VERSION>
diff --git a/cmake/cmake_celix/Packaging.cmake b/cmake/cmake_celix/Packaging.cmake
index 3cb1b71..881c2fd 100644
--- a/cmake/cmake_celix/Packaging.cmake
+++ b/cmake/cmake_celix/Packaging.cmake
@@ -104,7 +104,7 @@
 
     set(OPTIONS NO_ACTIVATOR)
     set(ONE_VAL_ARGS VERSION ACTIVATOR SYMBOLIC_NAME NAME DESCRIPTION) 
-    set(MULTI_VAL_ARGS SOURCES PRIVATE_LIBRARIES EXPORT_LIBRARIES HEADERS)
+    set(MULTI_VAL_ARGS SOURCES PRIVATE_LIBRARIES EXPORT_LIBRARIES IMPORT_LIBRARIES HEADERS)
     cmake_parse_arguments(BUNDLE "${OPTIONS}" "${ONE_VAL_ARGS}" "${MULTI_VAL_ARGS}" ${ARGN})
 
     ##check arguments
@@ -179,6 +179,7 @@
     ###### Packaging the bundle using using jar,zip or cpack and a content dir. Configuring dependencies ######
     if(JAR_COMMAND)
         add_custom_command(OUTPUT ${BUNDLE_FILE}
+            COMMAND ${CMAKE_COMMAND} -E make_directory ${BUNDLE_CONTENT_DIR}
             COMMAND ${JAR_COMMAND} -cfm ${BUNDLE_FILE} ${BUNDLE_GEN_DIR}/MANIFEST.MF -C ${BUNDLE_CONTENT_DIR} .
             COMMENT "Packaging ${BUNDLE_TARGET_NAME}"
             DEPENDS  ${BUNDLE_TARGET_NAME} "$<TARGET_PROPERTY:${BUNDLE_TARGET_NAME},BUNDLE_DEPEND_TARGETS>" ${BUNDLE_GEN_DIR}/MANIFEST.MF
@@ -186,6 +187,7 @@
         )
     elseif(ZIP_COMMAND)
         add_custom_command(OUTPUT ${BUNDLE_FILE}
+            COMMAND ${CMAKE_COMMAND} -E make_directory ${BUNDLE_CONTENT_DIR}
             COMMAND ${CMAKE_COMMAND} -E copy_if_different ${BUNDLE_GEN_DIR}/MANIFEST.MF META-INF/MANIFEST.MF
             COMMAND ${ZIP_COMMAND} -rq ${BUNDLE_FILE} *
             COMMENT "Packaging ${BUNDLE_TARGET_NAME}"
@@ -249,12 +251,15 @@
     if(BUNDLE_SOURCES) 
         bundle_private_libs(${BUNDLE_TARGET_NAME} ${BUNDLE_TARGET_NAME})
         set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_ACTIVATOR" "$<TARGET_SONAME_FILE_NAME:${BUNDLE_TARGET_NAME}>")
+        set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUILD_WITH_INSTALL_RPATH" true)
 
         if(APPLE)
             set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES INSTALL_RPATH "@loader_path")
         else()
             set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES INSTALL_RPATH "$ORIGIN")
         endif()
+    elseif(BUNDLE_NO_ACTIVATOR)
+        #do nothing
     else() #ACTIVATOR 
         bundle_private_libs(${BUNDLE_TARGET_NAME} ${BUNDLE_ACTIVATOR})
         get_filename_component(ACT_NAME ${BUNDLE_ACTIVATOR} NAME)
@@ -263,6 +268,7 @@
 
     bundle_private_libs(${BUNDLE_TARGET_NAME} ${BUNDLE_PRIVATE_LIBRARIES})
     bundle_export_libs(${BUNDLE_TARGET_NAME} ${BUNDLE_EXPORT_LIBRARIES})
+    bundle_import_libs(${BUNDLE_TARGET_NAME} ${BUNDLE_IMPORT_LIBRARIES})
     bundle_headers(${BUNDLE_TARGET_NAME} ${BUNDLE_HEADERS})
 endfunction()
 
@@ -338,19 +344,30 @@
     set_target_properties(${BUNDLE} PROPERTIES "BUNDLE_DEPEND_TARGETS" "${DEPS}")
 endfunction()
 
-#TODO
-#
-# bundle_import_libs(<target> LIB <lib> RANGE <version_range> ?)
-#
-#
 function(bundle_import_libs)
     #0 is bundle TARGET
-    #1..n is libs
+    #2..n is import libs
     list(GET ARGN 0 BUNDLE)
     list(REMOVE_AT ARGN 0)
 
-    message(WARNING "IMPORT BUNDLES STILL TODO")
+    #check if arg 0 is corrent
+    check_bundle(${BUNDLE})
 
+    get_target_property(LIBS ${BUNDLE} "BUNDLE_IMPORT_LIBS")
+    set(LIBS )
+
+    foreach(LIB IN ITEMS ${ARGN})
+        if(IS_ABSOLUTE ${LIB} AND EXISTS ${LIB})
+            list(APPEND LIBS ${LIB_NAME})
+        else()
+            list(APPEND LIBS "$<TARGET_SONAME_FILE_NAME:${LIB}>")
+        endif()
+
+        target_link_libraries(${BUNDLE} ${LIB})
+    endforeach()
+
+
+    set_target_properties(${BUNDLE} PROPERTIES "BUNDLE_IMPORT_LIBS" "${LIBS}")
 endfunction()
 
 function(bundle_files)
@@ -439,7 +456,7 @@
     list(REMOVE_AT ARGN 0)
 
     set(OPTIONS COPY)
-    set(ONE_VAL_ARGS GROUP NAME)
+    set(ONE_VAL_ARGS GROUP NAME LAUNCHER)
     set(MULTI_VAL_ARGS BUNDLES PROPERTIES)
     cmake_parse_arguments(DEPLOY "${OPTIONS}" "${ONE_VAL_ARGS}" "${MULTI_VAL_ARGS}" ${ARGN})
 
@@ -461,65 +478,114 @@
 
 
     ###### Setup deploy custom target and config.properties file
-    set(TIMESTAMP_FILE "${CMAKE_CURRENT_BINARY_DIR}/${DEPLOY_TARGET}-timestamp")
+    set(TIMESTAMP_FILE "${CMAKE_CURRENT_BINARY_DIR}/${DEPLOY_TARGET}-deploy-timestamp")
 
     add_custom_target(${DEPLOY_TARGET}
         DEPENDS ${TIMESTAMP_FILE}
     )
     add_dependencies(deploy ${DEPLOY_TARGET})
 
+    #FILE TARGETS FOR DEPLOY
+    set(DEPLOY_EXE "${DEPLOY_LOCATION}/${DEPLOY_NAME}")
+    set(DEPLOY_RUN_SH "${DEPLOY_LOCATION}/run.sh")
+    set(DEPLOY_PROPS "${DEPLOY_LOCATION}/config.properties")
+    set(DEPLOY_ECLIPSE_LAUNCHER "${DEPLOY_LOCATION}/${DEPLOY_NAME}.launch")
+    set(DEPLOY_RELEASE_SH "${DEPLOY_LOCATION}/release.sh")
+
+    find_program(LINK_CMD ln)
+    if (LINK_CMD) 
+        #if ln is available use a softlink to celix exe instead of a run.sh
+        list(APPEND DEPLOY_FILE_TARGETS ${DEPLOY_PROPS} ${DEPLOY_ECLIPSE_LAUNCHER} ${DEPLOY_RELEASE_SH} ${DEPLOY_RUN_SH} ${DEPLOY_EXE})
+    else()
+        list(APPEND DEPLOY_FILE_TARGETS ${DEPLOY_PROPS} ${DEPLOY_ECLIPSE_LAUNCHER} ${DEPLOY_RELEASE_SH} ${DEPLOY_RUN_SH})
+    endif()
+
+    #setup dependencies based on timestamp
     add_custom_command(OUTPUT "${TIMESTAMP_FILE}"
         COMMAND ${CMAKE_COMMAND} -E touch ${TIMESTAMP_FILE}
-        DEPENDS  "$<TARGET_PROPERTY:${DEPLOY_TARGET},DEPLOY_TARGET_DEPS>" "${DEPLOY_LOCATION}/config.properties" "${DEPLOY_LOCATION}/run.sh" 
+        DEPENDS  "$<TARGET_PROPERTY:${DEPLOY_TARGET},DEPLOY_TARGET_DEPS>" ${DEPLOY_FILE_TARGETS} 
         WORKING_DIRECTORY "${DEPLOY_LOCATION}"
         COMMENT "Deploying ${DEPLOY_PRINT_NAME}" VERBATIM
     )
 
+    #Setting CELIX_LIB_DIRS, CELIX_BIN_DIR and CELIX_LAUNCHER 
+    if (EXISTS ${CELIX_FRAMEWORK_LIBRARY}) 
+        #CELIX_FRAMEWORK_LIBRARY set by FindCelix.cmake -> Celix Based Project
+        get_filename_component(CELIX_LIB_DIR ${CELIX_FRAMEWORK_LIBRARY} DIRECTORY) #Note assuming all celix libs are in the same dir
+        set(CELIX_LIB_DIRS "${CELIX_LIB_DIR}")
+        #CELIX_LAUNCHER is set by FindCelix.cmake
+        get_filename_component(CELIX_BIN_DIR ${CELIX_LAUNCHER} DIRECTORY)
+    else()
+        #Celix Main Project
+        set(CELIX_LIB_DIRS "$<TARGET_FILE_DIR:celix_framework>:$<TARGET_FILE_DIR:celix_utils>:$<TARGET_FILE_DIR:celix_dfi>")
+        set(CELIX_LAUNCHER "$<TARGET_FILE:celix>")
+        set(CELIX_BIN_DIR  "$<TARGET_FILE_DIR:celix>")
+    endif()
 
+    #generate config.properties
+    set(STAGE1_PROPERTIES "${CMAKE_CURRENT_BINARY_DIR}/${DEPLOY_TARGET}-deploy-config-stage1.properties")
     file(GENERATE 
-        OUTPUT "${DEPLOY_LOCATION}/config.properties.step1"
+        OUTPUT "${STAGE1_PROPERTIES}"
         CONTENT "cosgi.auto.start.1=$<JOIN:$<TARGET_PROPERTY:${DEPLOY_TARGET},DEPLOY_BUNDLES>, >
 $<JOIN:$<TARGET_PROPERTY:${DEPLOY_TARGET},DEPLOY_PROPERTIES>,
 >
 "
     )
-
     file(GENERATE
-        OUTPUT "${DEPLOY_LOCATION}/config.properties"
-        INPUT "${DEPLOY_LOCATION}/config.properties.step1"
+        OUTPUT "${DEPLOY_PROPS}"
+        INPUT "${STAGE1_PROPERTIES}"
     )
 
-    set(CONTAINER_NAME ${DEPLOY_NAME})
-    set(PROGRAM_NAME "${CMAKE_BIN_DIRECTORY}/launcher/celix")
-    set(PROJECT_ATTR "build")
-    set(WORKING_DIRECTORY ${DEPLOY_LOCATION})
-    set(PATHS "${CMAKE_BIN_DIRECTORY}/framework:${CMAKE_BIN_DIRECTORY}/utils:${CMAKE_BIN_DIRECTORY}/dfi")
-    configure_file("${CELIX_CMAKE_DIRECTORY}/cmake_celix/RunConfig.in"  "${DEPLOY_LOCATION}/${DEPLOY_NAME}")
 
+    #Setup launcher using celix target, celix binary or custom launcher
+    if (DEPLOY_LAUNCHER)
+        if (IS_ABSOLUTE "${DEPLOY_LAUNCHER}")
+            #assuming target
+            set(LAUNCHER "${DEPLOY_LAUNCHER}")
+        else()
+            set(LAUNCHER "$<TARGET_FILE:${DEPLOY_LAUNCHER}>")
+        endif()
+    else()
+        #Use CELIX_LAUNCHER
+        set(LAUNCHER "${CELIX_LAUNCHER}")
+    endif()
+
+    #softlink celix exe file
+    add_custom_command(OUTPUT "${DEPLOY_EXE}"
+        COMMAND ${LINK_CMD} -s "${LAUNCHER}" "${DEPLOY_EXE}"
+        WORKING_DIRECTORY ${DEPLOY_LOCATION}
+        DEPENDS "${LAUNCHER}" 
+        COMMENT "Symbolic link launcher to ${DEPLOY_EXE}" VERBATIM
+    ) 
+
+
+    #generate release.sh and optional run.sh
     if(APPLE)
         set(LIB_PATH_NAME "DYLD_LIBRARY_PATH")
     else()
         set(LIB_PATH_NAME "LD_LIBRARY_PATH")
     endif()
-
-    if (EXISTS ${CELIX_FRAMEWORK_LIBRARY}) 
-        #Celix Based Project
-        get_filename_component(CELIX_LIB_DIR ${CELIX_FRAMEWORK_LIBRARY} DIRECTORY) #Note assuming all celix libs are in the same dir
-        set(RUN_CONTENT "export ${LIB_PATH_NAME}=${CELIX_LIB_DIR}:\${${LIB_PATH_NAME}}
-${CELIX_LAUNCHER} $@")
-    else()
-        #Celix Main Project
-        set(RUN_CONTENT "export ${LIB_PATH_NAME}=$<TARGET_FILE_DIR:celix_framework>:$<TARGET_FILE_DIR:celix_utils>:$<TARGET_FILE_DIR:celix_dfi>:\${${LIB_PATH_NAME}}
-$<TARGET_FILE:celix> $@")
-    endif()
-
+    set(RELEASE_CONTENT "#!/bin/sh\nexport ${LIB_PATH_NAME}=${CELIX_LIB_DIRS}:\${${LIB_PATH_NAME}}\nexport PATH=${CELIX_BIN_DIR}:\${PATH}")
     file(GENERATE
-        OUTPUT ${DEPLOY_LOCATION}/run.sh
+        OUTPUT ${DEPLOY_RELEASE_SH}
+        CONTENT ${RELEASE_CONTENT}
+    )
+    set(RUN_CONTENT "${RELEASE_CONTENT}\n${LAUNCHER} \$@\n")
+    file(GENERATE
+        OUTPUT ${DEPLOY_RUN_SH}
         CONTENT ${RUN_CONTENT}
     )
 
-    #TODO eclipse launcher file
-    #####
+    #generate eclipse project launch file
+    set(PROGRAM_NAME "${LAUNCHER}")
+    set(CONTAINER_NAME ${DEPLOY_NAME})
+    set(PROJECT_ATTR "${CMAKE_PROJECT_NAME}-build")
+    set(WORKING_DIRECTORY ${DEPLOY_LOCATION})
+    include("${CELIX_CMAKE_DIRECTORY}/cmake_celix/RunConfig.in.cmake") #set VAR RUN_CONFIG_IN
+    file(GENERATE
+        OUTPUT "${DEPLOY_ECLIPSE_LAUNCHER}"
+        CONTENT "${RUN_CONFIG_IN}"    
+    )
 
     ##### Deploy Target Properties #####
     #internal use
@@ -536,6 +602,7 @@
     deploy_properties(${DEPLOY_TARGET} ${DEPLOY_PROPERTIES})
 endfunction()
 
+
 #NOTE can be used for drivers/proxies/endpoints bundle dirs
 function(deploy_bundles_dir)
     list(GET ARGN 0 DEPLOY_NAME)
diff --git a/cmake/cmake_celix/RunConfig.in b/cmake/cmake_celix/RunConfig.in
deleted file mode 100644
index 888b992..0000000
--- a/cmake/cmake_celix/RunConfig.in
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType">
-    <stringAttribute key="bad_container_name" value="${CONTAINER_NAME}"/>
-    <intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="0"/>
-    <stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
-    <stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="${PROGRAM_NAME}"/>
-    <stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="${PROJECT_ATTR}"/>
-    <booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="true"/>
-    <stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="org.eclipse.cdt.core.default.config.1"/>
-    <stringAttribute key="org.eclipse.cdt.launch.WORKING_DIRECTORY" value="${WORKING_DIRECTORY}"/>
-    <booleanAttribute key="org.eclipse.cdt.launch.use_terminal" value="true"/>
-    <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-        <listEntry value="/${PROJECT_ATTR}"/>
-    </listAttribute>
-    <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-        <listEntry value="4"/>
-    </listAttribute>
-    <mapAttribute key="org.eclipse.debug.core.environmentVariables">
-        <mapEntry key="LD_LIBRARY_PATH" value="${PATHS}"/>
-        <mapEntry key="DYLD_LIBRARY_PATH" value="${PATHS}"/>
-    </mapAttribute>
-</launchConfiguration>
diff --git a/cmake/cmake_celix/RunConfig.in.cmake b/cmake/cmake_celix/RunConfig.in.cmake
new file mode 100644
index 0000000..3c62ab9
--- /dev/null
+++ b/cmake/cmake_celix/RunConfig.in.cmake
@@ -0,0 +1,41 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set(RUN_CONFIG_IN "\
+<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?> \n\
+<launchConfiguration type=\"org.eclipse.cdt.launch.applicationLaunchType\"> \n\
+    <stringAttribute key=\"bad_container_name\" value=\"${CONTAINER_NAME}\"/> \n\
+    <intAttribute key=\"org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR\" value=\"0\"/> \n\
+    <stringAttribute key=\"org.eclipse.cdt.launch.COREFILE_PATH\" value=\"\"/> \n\
+    <stringAttribute key=\"org.eclipse.cdt.launch.PROGRAM_NAME\" value=\"${PROGRAM_NAME}\"/> \n\
+    <stringAttribute key=\"org.eclipse.cdt.launch.PROJECT_ATTR\" value=\"${PROJECT_ATTR}\"/> \n\
+    <booleanAttribute key=\"org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR\" value=\"true\"/> \n\
+    <stringAttribute key=\"org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR\" value=\"org.eclipse.cdt.core.default.config.1\"/> \n\
+    <stringAttribute key=\"org.eclipse.cdt.launch.WORKING_DIRECTORY\" value=\"${WORKING_DIRECTORY}\"/> \n\
+    <booleanAttribute key=\"org.eclipse.cdt.launch.use_terminal\" value=\"true\"/> \n\
+    <listAttribute key=\"org.eclipse.debug.core.MAPPED_RESOURCE_PATHS\"> \n\
+        <listEntry value=\"/${PROJECT_ATTR}\"/> \n\
+    </listAttribute> \n\
+    <listAttribute key=\"org.eclipse.debug.core.MAPPED_RESOURCE_TYPES\"> \n\
+        <listEntry value=\"4\"/> \n\
+    </listAttribute> \n\
+    <mapAttribute key=\"org.eclipse.debug.core.environmentVariables\"> \n\
+    <mapEntry key=\"LD_LIBRARY_PATH\" value=\"${CELIX_LIB_DIRS}\"/> \n\
+    <mapEntry key=\"DYLD_LIBRARY_PATH\" value=\"${CELIX_LIB_DIRS}\"/> \n\
+    </mapAttribute> \n\
+</launchConfiguration> \n\
+")
diff --git a/config_admin/config_admin_tst/config_admin_test.cpp b/config_admin/config_admin_tst/config_admin_test.cpp
index 80f1480..04cd6d7 100644
--- a/config_admin/config_admin_tst/config_admin_test.cpp
+++ b/config_admin/config_admin_tst/config_admin_test.cpp
@@ -175,7 +175,7 @@
 		properties = NULL;
 		configuration->configuration_getProperties(configuration->handle, &properties);
 		if (properties != NULL) {
-			char *test_value = properties_get(properties, (char*)OSGI_FRAMEWORK_SERVICE_PID);
+			const char *test_value = properties_get(properties, (char*)OSGI_FRAMEWORK_SERVICE_PID);
 			CHECK_TEXT("base.device1", test_value);
 			test_value = properties_get(properties, (char *)prop1);
 			CHECK_TEXT("printer", test_value);
@@ -195,7 +195,7 @@
 			configuration->configuration_getProperties(configuration->handle, &properties);
 			CHECK((properties != NULL));
 			if (properties != NULL) {
-				char *test_value = properties_get(properties, (char*)OSGI_FRAMEWORK_SERVICE_PID);
+				const char *test_value = properties_get(properties, (char*)OSGI_FRAMEWORK_SERVICE_PID);
 				CHECK_TEXT("base.device1", test_value);
 				test_value = properties_get(properties, (char *)key);
 				CHECK_TEXT("printer", test_value);
@@ -238,14 +238,14 @@
 			properties = NULL;
 			configuration->configuration_getProperties(configuration->handle, &properties);
 			if (properties != NULL) {
-				char *test_value = properties_get(properties, (char*)OSGI_FRAMEWORK_SERVICE_PID);
+				const char *test_value = properties_get(properties, (char*)OSGI_FRAMEWORK_SERVICE_PID);
 				CHECK_TEXT("base.device1", test_value);
 				test_value = properties_get(properties, (char *)prop1);
 				CHECK_TEXT("printer", test_value);
 			}
 			configuration2->configuration_getProperties(configuration2->handle, &properties);
 			if (properties != NULL) {
-				char *test_value = properties_get(properties, (char*)OSGI_FRAMEWORK_SERVICE_PID);
+				const char *test_value = properties_get(properties, (char*)OSGI_FRAMEWORK_SERVICE_PID);
 				CHECK_TEXT("test2_pid", test_value);
 				test_value = properties_get(properties, (char *)prop1);
 				CHECK_TEXT("test2_printer", test_value);
@@ -295,7 +295,7 @@
 			bundle_pt   fwBundle = NULL;
 			bundle_archive_pt	archive = NULL;
 			bundle_context_pt   context = NULL;
-			char                *location = NULL;
+			const char                *location = NULL;
 			/* ------------------ get Configuration -------------------*/
 
 			configuration_pt configuration;
diff --git a/config_admin/config_admin_tst/example_test/private/src/example_managed_service_impl.c b/config_admin/config_admin_tst/example_test/private/src/example_managed_service_impl.c
index 309cc7a..7bcbf36 100644
--- a/config_admin/config_admin_tst/example_test/private/src/example_managed_service_impl.c
+++ b/config_admin/config_admin_tst/example_test/private/src/example_managed_service_impl.c
@@ -68,8 +68,8 @@
 		msp->store_props(msp->handle, "", "");
 	}else{
 		printf("[ managedServiceImpl ]: updated - Received New Properties \n");
-		char *value = properties_get(properties, "type");
-		char *value2 = properties_get(properties, "second_type");
+		char *value = (char*)properties_get(properties, "type");
+		char *value2 = (char*)properties_get(properties, "second_type");
 		msp->store_props(msp->handle, value, value2);
 		// it would be nicer if we get the property values here and store them in the activator structure.
 	}
diff --git a/config_admin/example/CMakeLists.txt b/config_admin/example/CMakeLists.txt
index 2d92d0a..c1c80bd 100644
--- a/config_admin/example/CMakeLists.txt
+++ b/config_admin/example/CMakeLists.txt
@@ -10,8 +10,6 @@
     "org.apache.celix.config_admin.example"
 )
 
-SET(BUNDLE_VERSION "0.0.1")
-
 include_directories(
 	"private/include"
 	"public/include"
@@ -19,10 +17,11 @@
     ../service/public/include
 )
 
-bundle(
-config_admin_example SOURCES
-	private/src/bundle_activator
-	private/src/example
+add_bundle(config_admin_example 
+	VERSION 0.0.1
+	SOURCES
+		private/src/bundle_activator
+		private/src/example
 )
 
 target_link_libraries(config_admin_example ${CELIX_FRAMEWORK_LIBRARY} ${CELIX_UTILS_LIBRARY})
diff --git a/config_admin/example/private/src/example.c b/config_admin/example/private/src/example.c
index e58e6ae..517b252 100644
--- a/config_admin/example/private/src/example.c
+++ b/config_admin/example/private/src/example.c
@@ -49,7 +49,7 @@
         hash_map_iterator_pt iter = hashMapIterator_create(map);
         while(hashMapIterator_hasNext(iter)) {
             char *key = hashMapIterator_nextKey(iter);
-            char *value = properties_get(updatedProperties, key);
+            const char *value = properties_get(updatedProperties, key);
             printf("got property %s:%s\n", key, value);
         }
     } else {
diff --git a/config_admin/service/private/include/framework_patch.h b/config_admin/service/private/include/framework_patch.h
index 32200b5..98194e1 100644
--- a/config_admin/service/private/include/framework_patch.h
+++ b/config_admin/service/private/include/framework_patch.h
@@ -34,6 +34,6 @@
 #include "bundle.h"
 #include "service_reference.h"
 
-celix_status_t bundle_getBundleLocation(bundle_pt bundle, char **location);
+celix_status_t bundle_getBundleLocation(bundle_pt bundle, const char **location);
 
 #endif /* BUNDLE_PATCH_H_ */
diff --git a/config_admin/service/private/src/configuration_admin_impl.c b/config_admin/service/private/src/configuration_admin_impl.c
index e88e191..6d01cb0 100644
--- a/config_admin/service/private/src/configuration_admin_impl.c
+++ b/config_admin/service/private/src/configuration_admin_impl.c
@@ -100,8 +100,8 @@
 celix_status_t configurationAdmin_getConfiguration(configuration_admin_pt configAdmin, char *pid, configuration_pt *configuration){
 	configuration_pt config;
 
-	char *configAdminBundleLocation;
-	char *configBundleLocation;
+	const char* configAdminBundleLocation;
+	const char* configBundleLocation;
 
 
 	// (1) configurationAdmin.checkPid
@@ -117,7 +117,7 @@
 	}
 
 	// (3) delegates to configurationStore.getConfiguration
-	if ( configurationStore_getConfiguration(configAdmin->configurationStore, pid, configAdminBundleLocation, &config) != CELIX_SUCCESS ){
+	if ( configurationStore_getConfiguration(configAdmin->configurationStore, pid, (char*)configAdminBundleLocation, &config) != CELIX_SUCCESS ){
 		*configuration = NULL;
 		return CELIX_ILLEGAL_ARGUMENT;
 	}
@@ -138,7 +138,7 @@
 
 
 	// (4) config.getBundleLocation != NULL ?
-	if ( configuration_getBundleLocation2(config->handle,false,&configBundleLocation) == CELIX_SUCCESS ){
+	if ( configuration_getBundleLocation2(config->handle,false,(char**)&configBundleLocation) == CELIX_SUCCESS ){
 
 		if ( strcmp(configAdminBundleLocation,configBundleLocation) != 0 ){
 
diff --git a/config_admin/service/private/src/configuration_impl.c b/config_admin/service/private/src/configuration_impl.c
index eed51ff..ed3c8c6 100644
--- a/config_admin/service/private/src/configuration_impl.c
+++ b/config_admin/service/private/src/configuration_impl.c
@@ -174,7 +174,7 @@
 	configuration_impl_pt conf_impl;
 
     celix_thread_mutexattr_t	mutex_attr;
-    char *value;
+    const char *value;
 
 	config = calloc(1, sizeof(struct configuration));
     if (config == NULL) return CELIX_ENOMEM;
@@ -415,7 +415,7 @@
 		// (2): it's the configuration located?
 		if ( configuration->bundleLocation != NULL ){//(2): Yes
 
-			if ( bundle_getBundleLocation(bundle, &bundleLocation) != CELIX_SUCCESS){
+			if ( bundle_getBundleLocation(bundle, (const char**)&bundleLocation) != CELIX_SUCCESS){
 				configuration_unlock(configuration);
 				return CELIX_ILLEGAL_ARGUMENT;
 			}
@@ -459,7 +459,7 @@
     return CELIX_SUCCESS;
 }
 
-celix_status_t configuration_getBundleLocation2(configuration_impl_pt configuration, bool checkPermission, char **location){
+celix_status_t configuration_getBundleLocation2(configuration_impl_pt configuration, bool checkPermission, char** location){
 
 	celix_status_t status;
 
@@ -488,7 +488,7 @@
 
 	// (5)
 	if ( configuration->boundBundle != NULL ){
-		status = bundle_getBundleLocation(configuration->boundBundle,location);
+		status = bundle_getBundleLocation(configuration->boundBundle,(const char**)location);
 		configuration_unlock(configuration);
 		return status;
 	}
diff --git a/config_admin/service/private/src/managed_service_tracker.c b/config_admin/service/private/src/managed_service_tracker.c
index 1ce5ac1..a42d565 100644
--- a/config_admin/service/private/src/managed_service_tracker.c
+++ b/config_admin/service/private/src/managed_service_tracker.c
@@ -202,7 +202,7 @@
 
     celix_status_t status;
 
-    char *pid = NULL;
+    const char* pid = NULL;
 
     bundle_context_pt context = NULL;
 
@@ -211,7 +211,7 @@
 
     // (1) reference.getPid
 
-    status = serviceReference_getProperty(reference, (char *) OSGI_FRAMEWORK_SERVICE_PID, &pid);
+    status = serviceReference_getProperty(reference, OSGI_FRAMEWORK_SERVICE_PID, &pid);
     if (status != CELIX_SUCCESS || pid == NULL) {
         *service = NULL;
         printf(" [ ERROR ]: Tracker - PID is NULL \n");
@@ -255,7 +255,7 @@
     // (3) trackerInstance.AddManagedServiceToLocalList
     configurationStore_lock(managedServiceTracker_i->configurationStore);
 
-    status = managedServiceTracker_add(managedServiceTracker_i, reference, pid, managedService_s);
+    status = managedServiceTracker_add(managedServiceTracker_i, reference, (char*)pid, managedService_s);
     if (status != CELIX_SUCCESS) {
         bundleContext_ungetService(context, reference, NULL);
     }
@@ -281,19 +281,19 @@
 
 celix_status_t managedServiceTracker_removedService(void * handle, service_reference_pt reference, void * service) {
     celix_status_t status = CELIX_SUCCESS;
-    char *pid;
+    const char* pid;
     managed_service_tracker_pt managedServiceTracker_i = handle;	//instance
     bundle_context_pt context;
 
 
-    status = serviceReference_getProperty(reference, (char *)OSGI_FRAMEWORK_SERVICE_PID, &pid);
+    status = serviceReference_getProperty(reference, OSGI_FRAMEWORK_SERVICE_PID, &pid);
     if (status != CELIX_SUCCESS || pid == NULL){
 	return CELIX_ILLEGAL_ARGUMENT;
     }
     if ( managedServiceTracker_getBundleContext(managedServiceTracker_i, &context) != CELIX_SUCCESS ){
 	return CELIX_ILLEGAL_ARGUMENT;
     }
-    status = managedServiceTracker_remove(managedServiceTracker_i, reference, pid);
+    status = managedServiceTracker_remove(managedServiceTracker_i, reference, (char*)pid);
 
     return status;
 
@@ -306,7 +306,7 @@
     celix_status_t status;
 
     bundle_pt bundle = NULL;
-    char *bundleLocation;
+    const char* bundleLocation;
 
     configuration_pt configuration = NULL;
     properties_pt properties = NULL;
@@ -328,7 +328,7 @@
             }
 
             // (1) creates a new Configuration for the ManagedService
-            if (configurationStore_getConfiguration(tracker->configurationStore, pid, bundleLocation, &configuration) != CELIX_SUCCESS || configuration == NULL) {
+            if (configurationStore_getConfiguration(tracker->configurationStore, pid, (char*)bundleLocation, &configuration) != CELIX_SUCCESS || configuration == NULL) {
                 return CELIX_ILLEGAL_ARGUMENT;
             }
 
diff --git a/dependency_manager/CMakeLists.txt b/dependency_manager/CMakeLists.txt
index 4c7c3f8..8f976c0 100644
--- a/dependency_manager/CMakeLists.txt
+++ b/dependency_manager/CMakeLists.txt
@@ -48,20 +48,22 @@
     	private/src/dm_event
     	private/src/dm_dependency_manager_impl
     )
+    #set_target_properties(dependency_manager_static PROPERTIES SOVERSION 1)
 
-    add_library(dependency_manager_so SHARED 
-    	private/src/dm_activator_base 
-    	private/src/dm_component_impl 
-    	private/src/dm_service_dependency
-    	private/src/dm_event
-        private/src/dm_dependency_manager_impl
-    )
-    set_target_properties(dependency_manager_so PROPERTIES SOVERSION 1)
-    if (APPLE) 
-        target_link_libraries(dependency_manager_so celix_framework "-undefined dynamic_lookup")
-    else()
-        target_link_libraries(dependency_manager_so celix_framework)
-    endif()
+    #add_library(dependency_manager_so SHARED 
+    # 	private/src/dm_activator_base 
+    #	private/src/dm_component_impl 
+    #	private/src/dm_service_dependency
+    # 	private/src/dm_event
+    #    private/src/dm_dependency_manager_impl
+    #)
+    #set_target_properties(dependency_manager_so PROPERTIES SOVERSION 1)
+
+    #if (APPLE) 
+    #    target_link_libraries(dependency_manager_so celix_framework "-undefined dynamic_lookup")
+    #else()
+    #    target_link_libraries(dependency_manager_so celix_framework)
+    #endif()
 
    	include_directories("public/include")
    	include_directories("private/include")
@@ -82,7 +84,6 @@
 			dependency_manager
 	)
     install_bundle(dm_shell)
-    #install(TARGETS dependency_manager dependency_manager_static DESTINATION lib COMPONENT dependency_manager)
-    install(TARGETS dependency_manager_static DESTINATION lib COMPONENT dependency_manager)
-    install(TARGETS dependency_manager_so DESTINATION lib COMPONENT dependency_manager)
+    install(TARGETS dependency_manager_static DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT dependency_manager)
+    #install(TARGETS dependency_manager_so DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT dependency_manager)
 endif (DEPENDENCY_MANAGER)
diff --git a/dependency_manager/doc-images/statediagram.png b/dependency_manager/doc-images/statediagram.png
new file mode 100644
index 0000000..4349633
--- /dev/null
+++ b/dependency_manager/doc-images/statediagram.png
Binary files differ
diff --git a/dependency_manager/private/include/dm_component_impl.h b/dependency_manager/private/include/dm_component_impl.h
index bb093ff..495197c 100644
--- a/dependency_manager/private/include/dm_component_impl.h
+++ b/dependency_manager/private/include/dm_component_impl.h
@@ -27,15 +27,22 @@
 #ifndef COMPONENT_IMPL_H_
 #define COMPONENT_IMPL_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "dm_component.h"
-
 #include "dm_service_dependency_impl.h"
-
 #include "dm_event.h"
 
 celix_status_t component_start(dm_component_pt component);
+
 celix_status_t component_stop(dm_component_pt component);
 
 celix_status_t component_handleEvent(dm_component_pt component, dm_service_dependency_pt dependency, dm_event_pt event);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* COMPONENT_IMPL_H_ */
diff --git a/dependency_manager/private/include/dm_dependency.h b/dependency_manager/private/include/dm_dependency.h
index e7ad5fb..6923239 100644
--- a/dependency_manager/private/include/dm_dependency.h
+++ b/dependency_manager/private/include/dm_dependency.h
@@ -27,8 +27,15 @@
 #ifndef DM_DEPENDENCY_H_
 #define DM_DEPENDENCY_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 
 
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* DM_DEPENDENCY_H_ */
diff --git a/dependency_manager/private/include/dm_dependency_manager_impl.h b/dependency_manager/private/include/dm_dependency_manager_impl.h
index 3c9db01..c673605 100644
--- a/dependency_manager/private/include/dm_dependency_manager_impl.h
+++ b/dependency_manager/private/include/dm_dependency_manager_impl.h
@@ -27,10 +27,19 @@
 #ifndef CELIX_DM_DEPENDENCY_MANAGER_IMPL_H
 #define CELIX_DM_DEPENDENCY_MANAGER_IMPL_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
 struct dm_dependency_manager {
     array_list_pt components;
 
     pthread_mutex_t mutex;
 };
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif //CELIX_DM_DEPENDENCY_MANAGER_IMPL_H
diff --git a/dependency_manager/private/include/dm_event.h b/dependency_manager/private/include/dm_event.h
index 21f9831..1cccd47 100644
--- a/dependency_manager/private/include/dm_event.h
+++ b/dependency_manager/private/include/dm_event.h
@@ -27,6 +27,10 @@
 #ifndef DM_EVENT_H_
 #define DM_EVENT_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "service_reference.h"
 #include "bundle_context.h"
 #include "bundle.h"
@@ -41,8 +45,8 @@
 typedef enum dm_event_type dm_event_type_e;
 
 struct dm_event {
-	void *service;
-	long serviceId;
+	const void* service;
+	unsigned long serviceId;
 	long ranking;
 	service_reference_pt reference;
 	bundle_context_pt context;
@@ -53,13 +57,16 @@
 typedef struct dm_event *dm_event_pt;
 
 
-celix_status_t event_create(dm_event_type_e event_type, bundle_pt bundle, bundle_context_pt context, service_reference_pt reference, void *service, dm_event_pt *event);
-celix_status_t event_destroy(dm_event_pt *event);
+celix_status_t event_create(dm_event_type_e event_type, bundle_pt bundle, bundle_context_pt context, service_reference_pt reference, const void* service, dm_event_pt *event);
+celix_status_t event_destroy(dm_event_pt* event);
 
-celix_status_t event_equals(void *a, void *b, bool *equals);
+celix_status_t event_equals(const void* a, const void* b, bool* equals);
 
-celix_status_t event_getService(dm_event_pt event, void **service);
-celix_status_t event_compareTo(dm_event_pt event, dm_event_pt compareTo, int *compare);
+celix_status_t event_getService(dm_event_pt event, const void** service);
+celix_status_t event_compareTo(dm_event_pt event, dm_event_pt compareTo, int* compare);
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* DM_EVENT_H_ */
diff --git a/dependency_manager/private/include/dm_service_dependency_impl.h b/dependency_manager/private/include/dm_service_dependency_impl.h
index 60bb113..7026ebf 100644
--- a/dependency_manager/private/include/dm_service_dependency_impl.h
+++ b/dependency_manager/private/include/dm_service_dependency_impl.h
@@ -27,6 +27,10 @@
 #ifndef DM_SERVICE_DEPENDENCY_IMPL_H_
 #define DM_SERVICE_DEPENDENCY_IMPL_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include <stdbool.h>
 
 #include "dm_event.h"
@@ -43,6 +47,7 @@
 	bool required;
 	dm_service_dependency_strategy_t strategy;
 
+	void* callbackHandle; //This handle can be set to be used instead of the component implementation
 	service_set_fpt set;
 	service_add_fpt add;
 	service_change_fpt change;
@@ -55,11 +60,12 @@
 	service_remove_with_ref_fpt remove_with_ref;
 	service_swap_with_ref_fpt swap_with_ref;
 
-	void **autoConfigure;
+	const void **autoConfigure;
 	celix_thread_mutex_t lock;
 
 	bool isStarted;
 
+	bool addCLanguageFilter;
 	char *tracked_service;
 	char *tracked_filter_unmodified;
 	char *tracked_filter;
@@ -87,9 +93,12 @@
 celix_status_t serviceDependency_isInstanceBound(dm_service_dependency_pt dependency, bool *instanceBound);
 celix_status_t serviceDependency_isAutoConfig(dm_service_dependency_pt dependency, bool *autoConfig);
 
-celix_status_t serviceDependency_getAutoConfig(dm_service_dependency_pt dependency, void ***autoConfigure);
+celix_status_t serviceDependency_getAutoConfig(dm_service_dependency_pt dependency, const void*** autoConfigure);
 celix_status_t serviceDependency_unlock(dm_service_dependency_pt dependency);
 celix_status_t serviceDependency_lock(dm_service_dependency_pt dependency);
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* DM_SERVICE_DEPENDENCY_IMPL_H_ */
diff --git a/dependency_manager/private/include/dm_shell_list_command.h b/dependency_manager/private/include/dm_shell_list_command.h
index 01c5065..e8405c2 100644
--- a/dependency_manager/private/include/dm_shell_list_command.h
+++ b/dependency_manager/private/include/dm_shell_list_command.h
@@ -16,16 +16,23 @@
  *specific language governing permissions and limitations
  *under the License.
  */
-/*
- * dm_shell_list_command.h
- *
- *  \date       Oct 16, 2015
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
+
+#ifndef DM_SHELL_LIST_COMMAND_H_
+#define DM_SHELL_LIST_COMMAND_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include <stdlib.h>
 #include <string.h>
 
 #include "command.h"
 
-void dmListCommand_execute(bundle_context_pt context, char * line, FILE *out, FILE *err);
\ No newline at end of file
+void dmListCommand_execute(bundle_context_pt context, char * line, FILE *out, FILE *err);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //DM_SHELL_LSIT_COMMAND_H_
\ No newline at end of file
diff --git a/dependency_manager/private/src/dm_activator_base.c b/dependency_manager/private/src/dm_activator_base.c
index a7e6500..cbd1762 100644
--- a/dependency_manager/private/src/dm_activator_base.c
+++ b/dependency_manager/private/src/dm_activator_base.c
@@ -112,6 +112,10 @@
 	celix_status_t status = CELIX_SUCCESS;
 	dependency_activator_base_pt dependency_activator = (dependency_activator_base_pt) userData;
 
+	if(dependency_activator==NULL){
+		return CELIX_ILLEGAL_ARGUMENT;
+	}
+
     status = dm_destroy(dependency_activator->userData, dependency_activator->context,
                         dependency_activator->manager);
 
diff --git a/dependency_manager/private/src/dm_component_impl.c b/dependency_manager/private/src/dm_component_impl.c
index 0d9745e..27db3a5 100644
--- a/dependency_manager/private/src/dm_component_impl.c
+++ b/dependency_manager/private/src/dm_component_impl.c
@@ -41,7 +41,7 @@
     bundle_context_pt context;
     array_list_pt dm_interfaces;
 
-    void *implementation;
+    void* implementation;
 
     init_fpt callbackInit;
     start_fpt callbackStart;
@@ -55,14 +55,16 @@
     bool isStarted;
     bool active;
 
+    bool setCLanguageProperty;
+
     hash_map_pt dependencyEvents; //protected by mutex
 
     dm_executor_pt executor;
 };
 
 typedef struct dm_interface_struct {
-    char *serviceName;
-    void *service;
+    char* serviceName;
+    const void* service;
     properties_pt properties;
     service_registration_pt registration;
 } dm_interface_t;
@@ -155,6 +157,8 @@
         component->isStarted = false;
         component->active = false;
 
+        component->setCLanguageProperty = false;
+
         component->dependencyEvents = hashMap_create(NULL, NULL, NULL, NULL);
 
         component->executor = NULL;
@@ -326,7 +330,12 @@
     return status;
 }
 
-celix_status_t component_addInterface(dm_component_pt component, char *serviceName, char *serviceVersion, void *service, properties_pt properties) {
+celix_status_t setCLanguageProperty(dm_component_pt component, bool setCLangProp) {
+    component->setCLanguageProperty = setCLangProp;
+    return CELIX_SUCCESS;
+}
+
+celix_status_t component_addInterface(dm_component_pt component, const char* serviceName, const char* serviceVersion, const void* service, properties_pt properties) {
     celix_status_t status = CELIX_SUCCESS;
 
     if (component->active) {
@@ -339,8 +348,12 @@
             properties = properties_create();
         }
 
-        if ((properties_get(properties, (char*) CELIX_FRAMEWORK_SERVICE_VERSION) == NULL) && (serviceVersion != NULL)) {
-            properties_set(properties, (char*) CELIX_FRAMEWORK_SERVICE_VERSION, serviceVersion);
+        if ((properties_get(properties, CELIX_FRAMEWORK_SERVICE_VERSION) == NULL) && (serviceVersion != NULL)) {
+            properties_set(properties, CELIX_FRAMEWORK_SERVICE_VERSION, serviceVersion);
+        }
+
+        if (component->setCLanguageProperty && properties_get(properties, CELIX_FRAMEWORK_SERVICE_LANGUAGE) == NULL) { //always set default lang to C
+            properties_set(properties, CELIX_FRAMEWORK_SERVICE_LANGUAGE, CELIX_FRAMEWORK_SERVICE_C_LANGUAGE);
         }
 
         if (interface && name) {
@@ -367,8 +380,11 @@
     int size = arrayList_size(component->dm_interfaces);
     int i;
     for (i = 0; i < size; i += 1) {
+        dm_interface_info_pt info = calloc(1, sizeof(*info));
         dm_interface_t *interface = arrayList_get(component->dm_interfaces, i);
-        arrayList_add(names, strdup(interface->serviceName));
+        info->name = strdup(interface->serviceName);
+        properties_copy(interface->properties, &info->properties);
+        arrayList_add(names, info);
     }
     celixThreadMutex_unlock(&component->mutex);
 
@@ -452,9 +468,9 @@
 
     serviceDependency_setAvailable(dependency, true);
 
-    serviceDependency_invokeSet(dependency, event);
     switch (component->state) {
         case DM_CMP_STATE_WAITING_FOR_REQUIRED: {
+            serviceDependency_invokeSet(dependency, event);
             bool required = false;
             serviceDependency_isRequired(dependency, &required);
             if (required) {
@@ -469,6 +485,7 @@
             serviceDependency_isRequired(dependency, &required);
             if (!instanceBound) {
                 if (required) {
+                    serviceDependency_invokeSet(dependency, event);
                     serviceDependency_invokeAdd(dependency, event);
                 }
                 dm_event_pt event = NULL;
@@ -482,9 +499,10 @@
             break;
         }
         case DM_CMP_STATE_TRACKING_OPTIONAL:
-		component_suspend(component,dependency);
+		    component_suspend(component,dependency);
+            serviceDependency_invokeSet(dependency, event);
             serviceDependency_invokeAdd(dependency, event);
-		component_resume(component,dependency);
+		    component_resume(component,dependency);
             dm_event_pt event = NULL;
             component_getDependencyEvent(component, dependency, &event);
             component_updateInstance(component, dependency, event, false, true);
@@ -503,6 +521,7 @@
     array_list_pt events = hashMap_get(component->dependencyEvents, dependency);
     int index = arrayList_indexOf(events, event);
     if (index < 0) {
+	pthread_mutex_unlock(&component->mutex);
         status = CELIX_BUNDLE_EXCEPTION;
     } else {
         dm_event_pt old = arrayList_remove(events, (unsigned int) index);
@@ -512,9 +531,9 @@
         serviceDependency_invokeSet(dependency, event);
         switch (component->state) {
             case DM_CMP_STATE_TRACKING_OPTIONAL:
-			component_suspend(component,dependency);
+			    component_suspend(component,dependency);
                 serviceDependency_invokeChange(dependency, event);
-			component_resume(component,dependency);
+			    component_resume(component,dependency);
                 dm_event_pt hevent = NULL;
                 component_getDependencyEvent(component, dependency, &hevent);
                 component_updateInstance(component, dependency, hevent, true, false);
@@ -556,6 +575,7 @@
     pthread_mutex_lock(&component->mutex);
     int index = arrayList_indexOf(events, event);
     if (index < 0) {
+	pthread_mutex_unlock(&component->mutex);
         status = CELIX_BUNDLE_EXCEPTION;
     } else {
         dm_event_pt old = arrayList_remove(events, (unsigned int) index);
@@ -580,10 +600,10 @@
                 break;
             }
             case DM_CMP_STATE_TRACKING_OPTIONAL:
-			component_suspend(component,dependency);
+			    component_suspend(component,dependency);
                 serviceDependency_invokeSet(dependency, event);
                 serviceDependency_invokeRemove(dependency, event);
-			component_resume(component,dependency);
+			    component_resume(component,dependency);
                 dm_event_pt hevent = NULL;
                 component_getDependencyEvent(component, dependency, &hevent);
                 component_updateInstance(component, dependency, hevent, false, false);
@@ -608,6 +628,7 @@
     array_list_pt events = hashMap_get(component->dependencyEvents, dependency);
     int index = arrayList_indexOf(events, event);
     if (index < 0) {
+	pthread_mutex_unlock(&component->mutex);
         status = CELIX_BUNDLE_EXCEPTION;
     } else {
         dm_event_pt old = arrayList_remove(events, (unsigned int) index);
@@ -632,9 +653,9 @@
                 break;
             }
             case DM_CMP_STATE_TRACKING_OPTIONAL:
-			component_suspend(component,dependency);
+			    component_suspend(component,dependency);
                 serviceDependency_invokeSwap(dependency, event, newEvent);
-			component_resume(component,dependency);
+			    component_resume(component,dependency);
                 break;
             default:
                 break;
@@ -657,8 +678,8 @@
     serviceDependency_isAutoConfig(dependency, &autoConfig);
 
     if (autoConfig) {
-        void *service = NULL;
-        void **field = NULL;
+        const void *service = NULL;
+        const void **field = NULL;
 
         if (event != NULL) {
             event_getService(event, &service);
@@ -1134,11 +1155,11 @@
 celix_status_t component_configureImplementation(dm_component_pt component, dm_service_dependency_pt dependency) {
     celix_status_t status = CELIX_SUCCESS;
 
-    void **field = NULL;
+    const void **field = NULL;
 
     array_list_pt events = hashMap_get(component->dependencyEvents, dependency);
     if (events) {
-        void *service = NULL;
+        const void *service = NULL;
         dm_event_pt event = NULL;
         component_getDependencyEvent(component, dependency, &event);
         if (event != NULL) {
@@ -1156,7 +1177,7 @@
 celix_status_t component_registerServices(dm_component_pt component) {
     celix_status_t status = CELIX_SUCCESS;
 
-    if (component->context) {
+    if (component->context != NULL) {
 	    unsigned int i;
         for (i = 0; i < arrayList_size(component->dm_interfaces); i++) {
             dm_interface_t *interface = arrayList_get(component->dm_interfaces, i);
@@ -1340,42 +1361,40 @@
     dm_component_info_pt info = NULL;
     info = calloc(1, sizeof(*info));
 
-
-    if (info != NULL) {
-        arrayList_create(&info->dependency_list);
-        component_getInterfaces(component, &info->interfaces);
-        info->active = false;
-        memcpy(info->id, component->id, DM_COMPONENT_MAX_ID_LENGTH);
-        memcpy(info->name, component->name, DM_COMPONENT_MAX_NAME_LENGTH);
-
-        switch (component->state) {
-            case DM_CMP_STATE_INACTIVE :
-                info->state = strdup("INACTIVE");
-                break;
-            case DM_CMP_STATE_WAITING_FOR_REQUIRED :
-                info->state = strdup("WAITING_FOR_REQUIRED");
-                break;
-            case DM_CMP_STATE_INSTANTIATED_AND_WAITING_FOR_REQUIRED :
-                info->state = strdup("INSTANTIATED_AND_WAITING_FOR_REQUIRED");
-                break;
-            case DM_CMP_STATE_TRACKING_OPTIONAL :
-                info->state = strdup("TRACKING_OPTIONAL");
-                info->active = true;
-                break;
-            default :
-                info->state = strdup("UNKNOWN");
-                break;
-        }
-    } else {
-        status = CELIX_ENOMEM;
+    if (info == NULL) {
+        return CELIX_ENOMEM;
     }
 
+    arrayList_create(&info->dependency_list);
+    component_getInterfaces(component, &info->interfaces);
+    info->active = false;
+    memcpy(info->id, component->id, DM_COMPONENT_MAX_ID_LENGTH);
+    memcpy(info->name, component->name, DM_COMPONENT_MAX_NAME_LENGTH);
+
+    switch (component->state) {
+        case DM_CMP_STATE_INACTIVE :
+            info->state = strdup("INACTIVE");
+            break;
+        case DM_CMP_STATE_WAITING_FOR_REQUIRED :
+            info->state = strdup("WAITING_FOR_REQUIRED");
+            break;
+        case DM_CMP_STATE_INSTANTIATED_AND_WAITING_FOR_REQUIRED :
+            info->state = strdup("INSTANTIATED_AND_WAITING_FOR_REQUIRED");
+            break;
+        case DM_CMP_STATE_TRACKING_OPTIONAL :
+            info->state = strdup("TRACKING_OPTIONAL");
+            info->active = true;
+            break;
+        default :
+            info->state = strdup("UNKNOWN");
+            break;
+    }
 
     celixThreadMutex_lock(&component->mutex);
     size = arrayList_size(component->dependencies);
     for (i = 0; i < size; i += 1) {
         dm_service_dependency_pt dep = arrayList_get(component->dependencies, i);
-        dm_service_dependency_info_pt depInfo= NULL;
+        dm_service_dependency_info_pt depInfo = NULL;
         status = serviceDependency_getServiceDependencyInfo(dep, &depInfo);
         if (status == CELIX_SUCCESS) {
             arrayList_add(info->dependency_list, depInfo);
@@ -1403,8 +1422,10 @@
         if (info->interfaces != NULL) {
             size = arrayList_size(info->interfaces);
             for (i = 0; i < size; i += 1) {
-                char *intf = arrayList_get(info->interfaces, i);
-                free(intf);
+                dm_interface_info_pt intfInfo = arrayList_get(info->interfaces, i);
+                free(intfInfo->name);
+                properties_destroy(intfInfo->properties);
+                free(intfInfo);
             }
             arrayList_destroy(info->interfaces);
         }
diff --git a/dependency_manager/private/src/dm_dependency_manager_impl.c b/dependency_manager/private/src/dm_dependency_manager_impl.c
index 3e67f8c..4864be1 100644
--- a/dependency_manager/private/src/dm_dependency_manager_impl.c
+++ b/dependency_manager/private/src/dm_dependency_manager_impl.c
@@ -74,13 +74,13 @@
 
 	for(;i<size;i++){
 		dm_component_pt cmp = arrayList_get(manager->components, i);
-		printf("Stopping comp %s\n", component_getName(cmp));
+//		printf("Stopping comp %s\n", component_getName(cmp));
 		component_stop(cmp);
 	}
 
 	while (!arrayList_isEmpty(manager->components)) {
 		dm_component_pt cmp = arrayList_remove(manager->components, 0);
-        printf("Removing comp %s\n", component_getName(cmp));
+//        printf("Removing comp %s\n", component_getName(cmp));
         component_destroy(cmp);
 	}
 
@@ -119,14 +119,11 @@
 }
 
 void dependencyManager_destroyInfo(dm_dependency_manager_pt manager, dm_dependency_manager_info_pt info) {
-
-	unsigned int i = 0;
-	for(;i<arrayList_size(info->components);i++){
-		dm_component_info_pt cmpinfo = (dm_component_info_pt)arrayList_get(info->components,0);
-		component_destroyComponentInfo(cmpinfo);
-        }
-        arrayList_destroy(info->components);
-
+    unsigned int i = 0;
+    for (; i < arrayList_size(info->components); i += 1) {
+        dm_component_info_pt cmpinfo = (dm_component_info_pt)arrayList_get(info->components, i);
+        component_destroyComponentInfo(cmpinfo);
+    }
+    arrayList_destroy(info->components);
     free(info);
-
 }
diff --git a/dependency_manager/private/src/dm_event.c b/dependency_manager/private/src/dm_event.c
index 491c69f..9341832 100644
--- a/dependency_manager/private/src/dm_event.c
+++ b/dependency_manager/private/src/dm_event.c
@@ -31,7 +31,7 @@
 
 #include "dm_event.h"
 
-celix_status_t event_create(dm_event_type_e event_type, bundle_pt bundle, bundle_context_pt context, service_reference_pt reference, void *service, dm_event_pt *event) {
+celix_status_t event_create(dm_event_type_e event_type, bundle_pt bundle, bundle_context_pt context, service_reference_pt reference, const void *service, dm_event_pt *event) {
 	celix_status_t status = CELIX_SUCCESS;
 
 	*event = calloc(1, sizeof(**event));
@@ -39,13 +39,13 @@
 		status = CELIX_ENOMEM;
 	}
 
-	char *serviceIdStr = NULL;
-	serviceReference_getProperty(reference, (char *)OSGI_FRAMEWORK_SERVICE_ID, &serviceIdStr);
-	long servId = atol(serviceIdStr);
+	const char* serviceIdStr = NULL;
+	serviceReference_getProperty(reference, OSGI_FRAMEWORK_SERVICE_ID, &serviceIdStr);
+	unsigned long servId = strtoul(serviceIdStr,NULL,10);
 
 	//FIXME service ranking can dynamicly change, but service reference can be removed at any time.
-	char *rankingStr = NULL;
-	serviceReference_getProperty(reference, (char *)OSGI_FRAMEWORK_SERVICE_RANKING, &rankingStr);
+	const char* rankingStr = NULL;
+	serviceReference_getProperty(reference, OSGI_FRAMEWORK_SERVICE_RANKING, &rankingStr);
 	long ranking = rankingStr == NULL ? 0 : atol(rankingStr);
 
 	if (status == CELIX_SUCCESS) {
@@ -76,14 +76,14 @@
 	return status;
 }
 
-celix_status_t event_equals(void *a, void *b, bool *equals) {
+celix_status_t event_equals(const void *a, const void *b, bool *equals) {
 	celix_status_t status = CELIX_SUCCESS;
 
 	if (!a || !b) {
 		*equals = false;
 	} else {
-		dm_event_pt a_ptr = a;
-		dm_event_pt b_ptr = b;
+		dm_event_pt a_ptr = (dm_event_pt)a;
+		dm_event_pt b_ptr = (dm_event_pt)b;
 
 		*equals = a_ptr->serviceId == b_ptr->serviceId;
 	}
@@ -99,7 +99,7 @@
 	return status;
 }
 
-celix_status_t event_getService(dm_event_pt event, void **service) {
+celix_status_t event_getService(dm_event_pt event, const void **service) {
 	*service = event->service;
 	return CELIX_SUCCESS;
 }
diff --git a/dependency_manager/private/src/dm_service_dependency.c b/dependency_manager/private/src/dm_service_dependency.c
index f81bd93..65a0593 100644
--- a/dependency_manager/private/src/dm_service_dependency.c
+++ b/dependency_manager/private/src/dm_service_dependency.c
@@ -36,744 +36,776 @@
 #include "dm_component_impl.h"
 
 #define DEFAULT_RANKING     0
-#define DM_SERVICE_DEPENDENCY_DEFAULT_STRATEGY DM_SERVICE_DEPENDENCY_STRATEGY_LOCKING
+#define DM_SERVICE_DEPENDENCY_DEFAULT_STRATEGY DM_SERVICE_DEPENDENCY_STRATEGY_SUSPEND
 
 static celix_status_t serviceDependency_addedService(void *_ptr, service_reference_pt reference, void *service);
 static celix_status_t serviceDependency_modifiedService(void *_ptr, service_reference_pt reference, void *service);
 static celix_status_t serviceDependency_removedService(void *_ptr, service_reference_pt reference, void *service);
+static void* serviceDependency_getCallbackHandle(dm_service_dependency_pt dep);
 
 celix_status_t serviceDependency_create(dm_service_dependency_pt *dependency_ptr) {
-    celix_status_t status = CELIX_SUCCESS;
+	celix_status_t status = CELIX_SUCCESS;
 
-    *dependency_ptr = calloc(1, sizeof(**dependency_ptr));
-    if (!*dependency_ptr) {
-        status = CELIX_ENOMEM;
-    } else {
-        (*dependency_ptr)->component = NULL;
-        (*dependency_ptr)->available = false;
-        (*dependency_ptr)->instanceBound = false;
-        (*dependency_ptr)->required = false;
-        (*dependency_ptr)->strategy = DM_SERVICE_DEPENDENCY_DEFAULT_STRATEGY;
+	*dependency_ptr = calloc(1, sizeof(**dependency_ptr));
+	if (!*dependency_ptr) {
+		status = CELIX_ENOMEM;
+	} else {
+		(*dependency_ptr)->component = NULL;
+		(*dependency_ptr)->available = false;
+		(*dependency_ptr)->instanceBound = false;
+		(*dependency_ptr)->required = false;
+		(*dependency_ptr)->strategy = DM_SERVICE_DEPENDENCY_DEFAULT_STRATEGY;
 
-        (*dependency_ptr)->set = NULL;
-        (*dependency_ptr)->add = NULL;
-        (*dependency_ptr)->change = NULL;
-        (*dependency_ptr)->remove = NULL;
-        (*dependency_ptr)->swap = NULL;
+		(*dependency_ptr)->callbackHandle = NULL;
+		(*dependency_ptr)->set = NULL;
+		(*dependency_ptr)->add = NULL;
+		(*dependency_ptr)->change = NULL;
+		(*dependency_ptr)->remove = NULL;
+		(*dependency_ptr)->swap = NULL;
 
-        (*dependency_ptr)->add_with_ref = NULL;
-        (*dependency_ptr)->change_with_ref = NULL;
-        (*dependency_ptr)->remove_with_ref = NULL;
-        (*dependency_ptr)->swap_with_ref = NULL;
+		(*dependency_ptr)->add_with_ref = NULL;
+		(*dependency_ptr)->change_with_ref = NULL;
+		(*dependency_ptr)->remove_with_ref = NULL;
+		(*dependency_ptr)->swap_with_ref = NULL;
 
-        (*dependency_ptr)->autoConfigure = NULL;
+		(*dependency_ptr)->autoConfigure = NULL;
 
-        (*dependency_ptr)->isStarted = false;
+		(*dependency_ptr)->isStarted = false;
 
-        (*dependency_ptr)->tracked_service = NULL;
-        (*dependency_ptr)->tracked_filter_unmodified = NULL;
-        (*dependency_ptr)->tracked_filter = NULL;
+        (*dependency_ptr)->addCLanguageFilter = false;
+		(*dependency_ptr)->tracked_service = NULL;
+		(*dependency_ptr)->tracked_filter_unmodified = NULL;
+		(*dependency_ptr)->tracked_filter = NULL;
 
-        (*dependency_ptr)->tracker = NULL;
-        (*dependency_ptr)->tracker_customizer = NULL;
-    }
+		(*dependency_ptr)->tracker = NULL;
+		(*dependency_ptr)->tracker_customizer = NULL;
+	}
 
-    return status;
+	return status;
 }
 
 celix_status_t serviceDependency_destroy(dm_service_dependency_pt *dependency_ptr) {
-    celix_status_t status = CELIX_SUCCESS;
+	celix_status_t status = CELIX_SUCCESS;
 
-    if (!*dependency_ptr) {
-        status = CELIX_ENOMEM;
-    }
+	if (!*dependency_ptr) {
+		status = CELIX_ENOMEM;
+	}
 
-    if (status == CELIX_SUCCESS) {
-        free((*dependency_ptr)->tracked_service);
-        free((*dependency_ptr)->tracked_filter);
-        free((*dependency_ptr)->tracked_filter_unmodified);
-        free(*dependency_ptr);
-        *dependency_ptr = NULL;
-    }
+	if (status == CELIX_SUCCESS) {
+		free((*dependency_ptr)->tracked_service);
+		free((*dependency_ptr)->tracked_filter);
+		free((*dependency_ptr)->tracked_filter_unmodified);
+		free(*dependency_ptr);
+		*dependency_ptr = NULL;
+	}
 
-    return status;
+	return status;
 }
 
 celix_status_t serviceDependency_lock(dm_service_dependency_pt dependency) {
-    celixThreadMutex_lock(&dependency->lock);
-    return CELIX_SUCCESS;
+	celixThreadMutex_lock(&dependency->lock);
+	return CELIX_SUCCESS;
 }
 
 celix_status_t serviceDependency_unlock(dm_service_dependency_pt dependency) {
-    celixThreadMutex_unlock(&dependency->lock);
-    return CELIX_SUCCESS;
+	celixThreadMutex_unlock(&dependency->lock);
+	return CELIX_SUCCESS;
 }
 
 celix_status_t serviceDependency_setRequired(dm_service_dependency_pt dependency, bool required) {
-    celix_status_t status = CELIX_SUCCESS;
+	celix_status_t status = CELIX_SUCCESS;
 
-    if (!dependency) {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
+	if (!dependency) {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
 
-    if (status == CELIX_SUCCESS) {
-        dependency->required = required;
-    }
+	if (status == CELIX_SUCCESS) {
+		dependency->required = required;
+	}
 
-    return status;
+	return status;
 }
 
-celix_status_t serviceDependency_setStrategy(dm_service_dependency_pt dependency, dm_service_dependency_strategy_t strategy) {
-    celix_status_t status = CELIX_SUCCESS;
-
-    if (!dependency) {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    } else {
-        dependency->strategy = strategy;
-    }
-
-    return status;
-}
-
-celix_status_t serviceDependency_getStrategy(dm_service_dependency_pt dependency, dm_service_dependency_strategy_t* strategy) {
-    celix_status_t status = CELIX_SUCCESS;
-
-    if (!dependency) {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    } else {
-        *strategy = dependency->strategy;
-    }
-
-    return status;
-
-}
-
-celix_status_t serviceDependency_setService(dm_service_dependency_pt dependency, char *serviceName, char *serviceVersionRange, char *filter) {
-    celix_status_t status = CELIX_SUCCESS;
-    if (!dependency) {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
-
-    if (status == CELIX_SUCCESS) {
-        array_list_pt filterElements = NULL;
-        arrayList_create(&filterElements);
-
-        if (serviceName != NULL) {
-            dependency->tracked_service = strdup(serviceName);
-        }
-
-        if (serviceVersionRange != NULL) {
-            version_range_pt versionRange = NULL;
-
-            if (versionRange_parse(serviceVersionRange, &versionRange) == CELIX_SUCCESS) {
-                version_pt lowVersion = NULL;
-                version_pt highVersion = NULL;
-
-                if ((versionRange_getHighVersion(versionRange, &highVersion) == CELIX_SUCCESS) && (highVersion != NULL)) {
-                    bool isHighInclusive;
-                    char* highOperator;
-                    char* highVersionStr = NULL;
-
-                    versionRange_isHighInclusive(versionRange, &isHighInclusive);
-                    version_toString(highVersion, &highVersionStr);
-
-                    highOperator = isHighInclusive ? "<=" : "<";
-
-                    size_t len = strlen(CELIX_FRAMEWORK_SERVICE_VERSION) + strlen(highVersionStr) + strlen(highOperator) + 3;
-                    char serviceVersionFilter[len];
-                    snprintf(serviceVersionFilter, len, "(%s%s%s)", CELIX_FRAMEWORK_SERVICE_VERSION, highOperator, highVersionStr);
-                    arrayList_add(filterElements, strdup(serviceVersionFilter));
-
-                    if(highVersionStr!=NULL){
-                    	free(highVersionStr);
-                    }
-                }
-
-                if ((versionRange_getLowVersion(versionRange, &lowVersion) == CELIX_SUCCESS) && (lowVersion != NULL)) {
-                    bool isLowInclusive;
-                    char* lowOperator;
-                    char* lowVersionStr = NULL;
-
-                    versionRange_isLowInclusive(versionRange, &isLowInclusive);
-                    version_toString(lowVersion, &lowVersionStr);
-
-                    lowOperator = isLowInclusive ? ">=" : ">";
-
-                    size_t len = strlen(CELIX_FRAMEWORK_SERVICE_VERSION) + strlen(lowVersionStr) + strlen(lowOperator) + 3;
-                    char serviceVersionFilter[len];
-                    snprintf(serviceVersionFilter, len, "(%s%s%s)", CELIX_FRAMEWORK_SERVICE_VERSION, lowOperator, lowVersionStr);
-                    arrayList_add(filterElements, strdup(serviceVersionFilter));
-
-                    if(lowVersionStr!=NULL){
-                    	free(lowVersionStr);
-                    }
-                }
-            }
-
-            if(versionRange!=NULL){
-            	versionRange_destroy(versionRange);
-            }
-        }
-
-        if (filter != NULL) {
-            dependency->tracked_filter_unmodified = strdup(filter);
-            arrayList_add(filterElements, strdup(filter));
-        }
-
-        if (arrayList_size(filterElements) > 0) {
-            array_list_iterator_pt filterElementsIter = arrayListIterator_create(filterElements);
-
-            size_t len = strlen(serviceName) + strlen(OSGI_FRAMEWORK_OBJECTCLASS) + 4;
-            dependency->tracked_filter = calloc(len, sizeof(*dependency->tracked_filter));
-            snprintf(dependency->tracked_filter, len, "(%s=%s)", OSGI_FRAMEWORK_OBJECTCLASS, serviceName);
-
-            while (arrayListIterator_hasNext(filterElementsIter) == true) {
-                char* filterElement = (char*) arrayListIterator_next(filterElementsIter);
-                size_t len = strnlen(dependency->tracked_filter, 1024*1024) + strnlen(filterElement, 1024*1024) + 4;
-                char* newFilter = calloc(len, sizeof(*newFilter));
-
-                if (dependency->tracked_filter[0] == '(' && dependency->tracked_filter[1] == '&') {
-                    //already have an & (AND) can combine with additional filter -> easier to read
-                    size_t orgLen = strnlen(dependency->tracked_filter, 1024*1024);
-                    snprintf(newFilter, len, "%.*s%s)", (int)orgLen -1, dependency->tracked_filter, filterElement);
-                } else {
-                    snprintf(newFilter, len, "(&%s%s)", dependency->tracked_filter, filterElement);
-                }
-
-                free(dependency->tracked_filter);
-                free(filterElement);
-
-                dependency->tracked_filter = newFilter;
-            }
-
-            arrayListIterator_destroy(filterElementsIter);
-        }
-        else {
-            dependency->tracked_filter = NULL;
-        }
-
-        arrayList_destroy(filterElements);
-    }
-
-    return status;
-}
-
-celix_status_t serviceDependency_getFilter(dm_service_dependency_pt dependency, char **filter) {
-    *filter = dependency->tracked_filter;
+celix_status_t serviceDependency_setAddCLanguageFilter(dm_service_dependency_pt dependency, bool addCLangFilter) {
+    dependency->addCLanguageFilter = addCLangFilter;
     return CELIX_SUCCESS;
 }
 
+celix_status_t serviceDependency_setStrategy(dm_service_dependency_pt dependency, dm_service_dependency_strategy_t strategy) {
+	celix_status_t status = CELIX_SUCCESS;
+
+	if (!dependency) {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	} else {
+		dependency->strategy = strategy;
+	}
+
+	return status;
+}
+
+celix_status_t serviceDependency_getStrategy(dm_service_dependency_pt dependency, dm_service_dependency_strategy_t* strategy) {
+	celix_status_t status = CELIX_SUCCESS;
+
+	if (!dependency) {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	} else {
+		*strategy = dependency->strategy;
+	}
+
+	return status;
+
+}
+
+celix_status_t serviceDependency_setService(dm_service_dependency_pt dependency, const char* serviceName, const char* serviceVersionRange, const char* filter) {
+	celix_status_t status = CELIX_SUCCESS;
+	if (!dependency || !serviceName) {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	if (status == CELIX_SUCCESS) {
+		array_list_pt filterElements = NULL;
+		arrayList_create(&filterElements);
+
+		free(dependency->tracked_service);
+		dependency->tracked_service = strdup(serviceName);
+
+		if (serviceVersionRange != NULL) {
+			version_range_pt versionRange = NULL;
+
+			if (versionRange_parse(serviceVersionRange, &versionRange) == CELIX_SUCCESS) {
+				version_pt lowVersion = NULL;
+				version_pt highVersion = NULL;
+
+				if ((versionRange_getHighVersion(versionRange, &highVersion) == CELIX_SUCCESS) && (highVersion != NULL)) {
+					bool isHighInclusive;
+					char* highOperator;
+					char* highVersionStr = NULL;
+
+					versionRange_isHighInclusive(versionRange, &isHighInclusive);
+					version_toString(highVersion, &highVersionStr);
+
+					highOperator = isHighInclusive ? "<=" : "<";
+
+					if(highVersionStr != NULL){
+						size_t len = strlen(CELIX_FRAMEWORK_SERVICE_VERSION) + strlen(highVersionStr) + strlen(highOperator) + 3;
+						char serviceVersionFilter[len];
+						snprintf(serviceVersionFilter, len, "(%s%s%s)", CELIX_FRAMEWORK_SERVICE_VERSION, highOperator, highVersionStr);
+						arrayList_add(filterElements, strdup(serviceVersionFilter));
+						free(highVersionStr);
+					}
+				}
+
+				if ((versionRange_getLowVersion(versionRange, &lowVersion) == CELIX_SUCCESS) && (lowVersion != NULL)) {
+					bool isLowInclusive;
+					char* lowOperator;
+					char* lowVersionStr = NULL;
+
+					versionRange_isLowInclusive(versionRange, &isLowInclusive);
+					version_toString(lowVersion, &lowVersionStr);
+
+					lowOperator = isLowInclusive ? ">=" : ">";
+
+					if(lowVersionStr != NULL){
+						size_t len = strlen(CELIX_FRAMEWORK_SERVICE_VERSION) + strlen(lowVersionStr) + strlen(lowOperator) + 3;
+						char serviceVersionFilter[len];
+						snprintf(serviceVersionFilter, len, "(%s%s%s)", CELIX_FRAMEWORK_SERVICE_VERSION, lowOperator, lowVersionStr);
+						arrayList_add(filterElements, strdup(serviceVersionFilter));
+						free(lowVersionStr);
+					}
+				}
+			}
+
+			if(versionRange!=NULL){
+				versionRange_destroy(versionRange);
+			}
+		}
+
+		if (filter != NULL) {
+			free(dependency->tracked_filter_unmodified);
+			dependency->tracked_filter_unmodified = strdup(filter);
+			arrayList_add(filterElements, strdup(filter));
+		}
+
+
+
+        bool needLangFilter = true;
+		if (filter != NULL) {
+            char needle[128];
+            snprintf(needle, sizeof(needle), "(%s=", CELIX_FRAMEWORK_SERVICE_LANGUAGE);
+            if (strstr(filter, needle) != NULL) {
+                needLangFilter = false;
+            }
+        }
+
+        if (needLangFilter && dependency->addCLanguageFilter) {
+			char langFilter[128];
+			snprintf(langFilter, sizeof(langFilter), "(%s=%s)", CELIX_FRAMEWORK_SERVICE_LANGUAGE, CELIX_FRAMEWORK_SERVICE_C_LANGUAGE);
+            arrayList_add(filterElements, strdup(langFilter));
+		}
+
+		if (arrayList_size(filterElements) > 0) {
+			array_list_iterator_pt filterElementsIter = arrayListIterator_create(filterElements);
+
+			size_t len = strlen(serviceName) + strlen(OSGI_FRAMEWORK_OBJECTCLASS) + 4;
+			free(dependency->tracked_filter);
+			dependency->tracked_filter = calloc(len, sizeof(*dependency->tracked_filter));
+			snprintf(dependency->tracked_filter, len, "(%s=%s)", OSGI_FRAMEWORK_OBJECTCLASS, serviceName);
+
+			while (arrayListIterator_hasNext(filterElementsIter) == true) {
+				char* filterElement = (char*) arrayListIterator_next(filterElementsIter);
+				size_t len = strnlen(dependency->tracked_filter, 1024*1024) + strnlen(filterElement, 1024*1024) + 4;
+				char* newFilter = calloc(len, sizeof(*newFilter));
+
+				if (dependency->tracked_filter[0] == '(' && dependency->tracked_filter[1] == '&') {
+					//already have an & (AND) can combine with additional filter -> easier to read
+					size_t orgLen = strnlen(dependency->tracked_filter, 1024*1024);
+					snprintf(newFilter, len, "%.*s%s)", (int)orgLen -1, dependency->tracked_filter, filterElement);
+				} else {
+					snprintf(newFilter, len, "(&%s%s)", dependency->tracked_filter, filterElement);
+				}
+
+				free(dependency->tracked_filter);
+				free(filterElement);
+
+				dependency->tracked_filter = newFilter;
+			}
+
+			arrayListIterator_destroy(filterElementsIter);
+		}
+		else {
+			free(dependency->tracked_filter);
+			dependency->tracked_filter = NULL;
+		}
+
+		arrayList_destroy(filterElements);
+	}
+
+	return status;
+}
+
+celix_status_t serviceDependency_getFilter(dm_service_dependency_pt dependency, const char** filter) {
+	*filter = (const char*)dependency->tracked_filter;
+	return CELIX_SUCCESS;
+}
+
 celix_status_t serviceDependency_setCallbacks(dm_service_dependency_pt dependency, service_set_fpt set, service_add_fpt add, service_change_fpt change, service_remove_fpt remove, service_swap_fpt swap) {
-    celix_status_t status = CELIX_SUCCESS;
+	celix_status_t status = CELIX_SUCCESS;
 
-    if (!dependency) {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
+    //printf("Setting callbacks set %p, add %p, change %p, remove %p and swap %p\n", set, add, change, remove, swap);
 
-    if (status == CELIX_SUCCESS) {
-        dependency->set = set;
-        dependency->add = add;
-        dependency->change = change;
-        dependency->remove = remove;
-        dependency->swap = swap;
-    }
+	if (!dependency) {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
 
-    return status;
+	if (status == CELIX_SUCCESS) {
+		dependency->set = set;
+		dependency->add = add;
+		dependency->change = change;
+		dependency->remove = remove;
+		dependency->swap = swap;
+	}
+
+	return status;
 }
 
 celix_status_t serviceDependency_setCallbacksWithServiceReference(dm_service_dependency_pt dependency, service_set_with_ref_fpt set, service_add_with_ref_fpt add, service_change_with_ref_fpt change, service_remove_with_ref_fpt remove,
-        service_swap_with_ref_fpt swap) {
-    celix_status_t status = CELIX_SUCCESS;
+		service_swap_with_ref_fpt swap) {
+	celix_status_t status = CELIX_SUCCESS;
 
-    if (!dependency) {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
+	if (!dependency) {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
 
-    if (status == CELIX_SUCCESS) {
-        dependency->set_with_ref = set;
-        dependency->add_with_ref = add;
-        dependency->change_with_ref = change;
-        dependency->remove_with_ref = remove;
-        dependency->swap_with_ref = swap;
-    }
+	if (status == CELIX_SUCCESS) {
+		dependency->set_with_ref = set;
+		dependency->add_with_ref = add;
+		dependency->change_with_ref = change;
+		dependency->remove_with_ref = remove;
+		dependency->swap_with_ref = swap;
+	}
 
-    return status;
+	return status;
 }
 
-celix_status_t serviceDependency_setAutoConfigure(dm_service_dependency_pt dependency, celix_thread_mutex_t *service_lock, void **field) {
-    celix_status_t status = CELIX_SUCCESS;
+celix_status_t serviceDependency_setAutoConfigure(dm_service_dependency_pt dependency, celix_thread_mutex_t *service_lock, const void **field) {
+	celix_status_t status = CELIX_SUCCESS;
 
-    celix_thread_mutex_t lock;
+	celix_thread_mutex_t lock;
 
-    if (!dependency) {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
+	if (!dependency) {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
 
-    if (status == CELIX_SUCCESS) {
-        dependency->autoConfigure = field;
-        celixThreadMutex_create(&lock, NULL);
-        *service_lock = lock;
-        dependency->lock = lock;
-    }
+	if (status == CELIX_SUCCESS) {
+		dependency->autoConfigure = field;
+		celixThreadMutex_create(&lock, NULL);
+		*service_lock = lock;
+		dependency->lock = lock;
+	}
 
-    return status;
+	return status;
 }
 
 celix_status_t serviceDependency_setComponent(dm_service_dependency_pt dependency, dm_component_pt component) {
-    celix_status_t status = CELIX_SUCCESS;
+	celix_status_t status = CELIX_SUCCESS;
 
-    if (!dependency) {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
+	if (!dependency) {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
 
-    if (status == CELIX_SUCCESS) {
-        dependency->component = component;
-    }
+	if (status == CELIX_SUCCESS) {
+		dependency->component = component;
+	}
 
-    return status;
+	return status;
 }
 
 celix_status_t serviceDependency_start(dm_service_dependency_pt dependency) {
-    celix_status_t status = CELIX_SUCCESS;
-    bundle_context_pt context = NULL;
+	celix_status_t status = CELIX_SUCCESS;
+	bundle_context_pt context = NULL;
 
-    if (!dependency || !dependency->component || (!dependency->tracked_service && !dependency->tracked_filter)) {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
-    if (status == CELIX_SUCCESS) {
-        status = component_getBundleContext(dependency->component, &context);
-        if (!context) {
-            status = CELIX_BUNDLE_EXCEPTION;
-        }
-    }
-    if (status == CELIX_SUCCESS) {
-        dependency->tracker_customizer = NULL;
-        status = serviceTrackerCustomizer_create(dependency, NULL, serviceDependency_addedService, serviceDependency_modifiedService, serviceDependency_removedService, &dependency->tracker_customizer);
-    }
-    if (status == CELIX_SUCCESS) {
-        if (dependency->tracked_filter) {
-            status = serviceTracker_createWithFilter(context, dependency->tracked_filter, dependency->tracker_customizer, &dependency->tracker);
-        } else if (dependency->tracked_service) {
-            status = serviceTracker_create(context, dependency->tracked_service, dependency->tracker_customizer, &dependency->tracker);
-        }
-    }
+	if (!dependency || !dependency->component || (!dependency->tracked_service && !dependency->tracked_filter)) {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
+	if (status == CELIX_SUCCESS) {
+		status = component_getBundleContext(dependency->component, &context);
+		if (!context) {
+			status = CELIX_BUNDLE_EXCEPTION;
+		}
+	}
+	if (status == CELIX_SUCCESS) {
+		dependency->tracker_customizer = NULL;
+		status = serviceTrackerCustomizer_create(dependency, NULL, serviceDependency_addedService, serviceDependency_modifiedService, serviceDependency_removedService, &dependency->tracker_customizer);
+	}
+	if (status == CELIX_SUCCESS) {
+		if (dependency->tracked_filter) {
+			status = serviceTracker_createWithFilter(context, dependency->tracked_filter, dependency->tracker_customizer, &dependency->tracker);
+		} else if (dependency->tracked_service) {
+			status = serviceTracker_create(context, dependency->tracked_service, dependency->tracker_customizer, &dependency->tracker);
+		}
+	}
 
-    if (status == CELIX_SUCCESS) {
-        status = serviceTracker_open(dependency->tracker);
-    }
+	if (status == CELIX_SUCCESS) {
+		status = serviceTracker_open(dependency->tracker);
+	}
 
-    if (status == CELIX_SUCCESS) {
-        dependency->isStarted = true;
-    }
+	if (status == CELIX_SUCCESS) {
+		dependency->isStarted = true;
+	}
 
-    return status;
+	return status;
 }
 
 celix_status_t serviceDependency_stop(dm_service_dependency_pt dependency) {
-    celix_status_t status = CELIX_SUCCESS;
-    celix_status_t tmp_status;
+	celix_status_t status = CELIX_SUCCESS;
 
-    if (!dependency) {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
+	if (!dependency) {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
 
-    if (status == CELIX_SUCCESS) {
-        dependency->isStarted = false;
-    }
+	if (status == CELIX_SUCCESS) {
+		dependency->isStarted = false;
+	}
 
-    if (status == CELIX_SUCCESS) {
-        if (dependency->tracker) {
-            tmp_status = serviceTracker_close(dependency->tracker);
-            if (tmp_status != CELIX_SUCCESS) {
-                status = tmp_status;
-            }
-            tmp_status = serviceTracker_destroy(dependency->tracker);
-            if (tmp_status != CELIX_SUCCESS && status == CELIX_SUCCESS) {
-                status = tmp_status;
-            }
-        }
-    }
+	if (status == CELIX_SUCCESS && dependency->tracker) {
+		status = serviceTracker_close(dependency->tracker);
+		if (status == CELIX_SUCCESS) {
+			serviceTracker_destroy(dependency->tracker);
+			dependency->tracker = NULL;
+		}
+	}
 
-    return status;
+	return status;
 }
 
 celix_status_t serviceDependency_setInstanceBound(dm_service_dependency_pt dependency, bool instanceBound) {
-    celix_status_t status = CELIX_SUCCESS;
+	celix_status_t status = CELIX_SUCCESS;
 
-    if (!dependency) {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
+	if (!dependency) {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
 
-    if (status == CELIX_SUCCESS) {
-        dependency->instanceBound = instanceBound;
-    }
+	if (status == CELIX_SUCCESS) {
+		dependency->instanceBound = instanceBound;
+	}
 
-    return status;
+	return status;
 }
 
 celix_status_t serviceDependency_setAvailable(dm_service_dependency_pt dependency, bool available) {
-    celix_status_t status = CELIX_SUCCESS;
+	celix_status_t status = CELIX_SUCCESS;
 
-    if (!dependency) {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
+	if (!dependency) {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
 
-    if (status == CELIX_SUCCESS) {
-        dependency->available = available;
-    }
+	if (status == CELIX_SUCCESS) {
+		dependency->available = available;
+	}
 
-    return status;
+	return status;
 }
 
 celix_status_t serviceDependency_invokeSet(dm_service_dependency_pt dependency, dm_event_pt event) {
-    celix_status_t status = CELIX_SUCCESS;
-    assert(dependency->isStarted == true);
-    array_list_pt serviceReferences = NULL;
-    int i;
-    int curRanking = INT_MIN;
-    service_reference_pt curServRef = NULL;
-    void *service = NULL;
+	celix_status_t status = CELIX_SUCCESS;
+	assert(dependency->isStarted == true);
+	array_list_pt serviceReferences = NULL;
+	int i;
+	int curRanking = INT_MIN;
+	service_reference_pt curServRef = NULL;
+	void *service = NULL;
 
-    serviceReferences = serviceTracker_getServiceReferences(dependency->tracker);
+	serviceReferences = serviceTracker_getServiceReferences(dependency->tracker);
 
-    /* Find the service with the higest ranking */
-    for (i = 0; i < arrayList_size(serviceReferences); i++) {
-        service_reference_pt serviceReference = arrayList_get(serviceReferences, i);
-        char *ranking_value;
-        int ranking = 0;
+	/* Find the service with the higest ranking */
+	for (i = 0; i < arrayList_size(serviceReferences); i++) {
+		service_reference_pt serviceReference = arrayList_get(serviceReferences, i);
+		const char* ranking_value;
+		int ranking = 0;
 
-        status = serviceReference_getProperty(serviceReference, ((char *) OSGI_FRAMEWORK_SERVICE_RANKING), &ranking_value);
+		status = serviceReference_getProperty(serviceReference, ((char *) OSGI_FRAMEWORK_SERVICE_RANKING), &ranking_value);
 
-        if (status == CELIX_SUCCESS) {
-            if (ranking_value == NULL) {
-                ranking = DEFAULT_RANKING;
-            } else {
-                char *end;
-                ranking = strtol(ranking_value, &end, 10);
-                if (end == ranking_value) {
-                    ranking = DEFAULT_RANKING;
-                }
-            }
+		if (status == CELIX_SUCCESS) {
+			if (ranking_value == NULL) {
+				ranking = DEFAULT_RANKING;
+			} else {
+				char *end;
+				ranking = strtol(ranking_value, &end, 10);
+				if (end == ranking_value) {
+					ranking = DEFAULT_RANKING;
+				}
+			}
 
-            if (ranking > curRanking) {
-                curRanking = ranking;
-                curServRef = serviceReference;
-            }
-        } else {
-            return status;
-        }
+			if (ranking > curRanking) {
+				curRanking = ranking;
+				curServRef = serviceReference;
+			}
+		} else {
+			break;
+		}
 
-    }
+	}
 
-    arrayList_destroy(serviceReferences);
+	arrayList_destroy(serviceReferences);
 
-    if (curServRef) {
-        status = bundleContext_getService(event->context, curServRef, &service);
-    } else {
-        service = NULL;
-    }
+	if (status == CELIX_SUCCESS) {
+		if (curServRef) {
+			status = bundleContext_getService(event->context, curServRef, &service);
+		} else {
+			service = NULL;
+		}
 
-    if (dependency->set) {
-        dependency->set(component_getImplementation(dependency->component), service);
-    }
-    if (dependency->set_with_ref) {
-        dependency->set_with_ref(component_getImplementation(dependency->component), curServRef, service);
-    }
+		if (dependency->set) {
+			dependency->set(serviceDependency_getCallbackHandle(dependency), service);
+		}
+		if (dependency->set_with_ref) {
+			dependency->set_with_ref(serviceDependency_getCallbackHandle(dependency), curServRef, service);
+		}
 
-    if (curServRef) {
-        bundleContext_ungetService(event->context, curServRef, NULL);
-    }
+		if (curServRef) {
+			bundleContext_ungetService(event->context, curServRef, NULL);
+		}
+	}
 
-    return status;
+	return status;
 }
 
 celix_status_t serviceDependency_invokeAdd(dm_service_dependency_pt dependency, dm_event_pt event) {
-    celix_status_t status = CELIX_SUCCESS;
+	celix_status_t status = CELIX_SUCCESS;
 
-    if (!dependency) {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
+	if (!dependency) {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
 
-    if (status == CELIX_SUCCESS) {
-        if (dependency->add) {
-            dependency->add(component_getImplementation(dependency->component), event->service);
-        }
-        if (dependency->add_with_ref) {
-            dependency->add_with_ref(component_getImplementation(dependency->component), event->reference, event->service);
-        }
-    }
+	if (status == CELIX_SUCCESS) {
+		if (dependency->add) {
+			dependency->add(serviceDependency_getCallbackHandle(dependency), event->service);
+		}
+		if (dependency->add_with_ref) {
+			dependency->add_with_ref(serviceDependency_getCallbackHandle(dependency), event->reference, event->service);
+		}
+	}
 
-    return status;
+	return status;
 }
 
 celix_status_t serviceDependency_invokeChange(dm_service_dependency_pt dependency, dm_event_pt event) {
-    celix_status_t status = CELIX_SUCCESS;
+	celix_status_t status = CELIX_SUCCESS;
 
-    if (!dependency) {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
+	if (!dependency) {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
 
-    if (status == CELIX_SUCCESS) {
-        if (dependency->change) {
-            dependency->change(component_getImplementation(dependency->component), event->service);
-        }
-        if (dependency->change_with_ref) {
-            dependency->change_with_ref(component_getImplementation(dependency->component), event->reference, event->service);
-        }
-    }
+	if (status == CELIX_SUCCESS) {
+		if (dependency->change) {
+			dependency->change(serviceDependency_getCallbackHandle(dependency), event->service);
+		}
+		if (dependency->change_with_ref) {
+			dependency->change_with_ref(serviceDependency_getCallbackHandle(dependency), event->reference, event->service);
+		}
+	}
 
-    return status;
+	return status;
 }
 
 celix_status_t serviceDependency_invokeRemove(dm_service_dependency_pt dependency, dm_event_pt event) {
-    celix_status_t status = CELIX_SUCCESS;
+	celix_status_t status = CELIX_SUCCESS;
 
-    if (!dependency) {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
+	if (!dependency) {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
 
-    if (status == CELIX_SUCCESS) {
-        if (dependency->remove) {
-            dependency->remove(component_getImplementation(dependency->component), event->service);
-        }
-        if (dependency->remove_with_ref) {
-            dependency->remove_with_ref(component_getImplementation(dependency->component), event->reference, event->service);
-        }
-    }
+	if (status == CELIX_SUCCESS) {
+		if (dependency->remove) {
+			dependency->remove(serviceDependency_getCallbackHandle(dependency), event->service);
+		}
+		if (dependency->remove_with_ref) {
+			dependency->remove_with_ref(serviceDependency_getCallbackHandle(dependency), event->reference, event->service);
+		}
+	}
 
-    return status;
+	return status;
 }
 
 celix_status_t serviceDependency_invokeSwap(dm_service_dependency_pt dependency, dm_event_pt event, dm_event_pt newEvent) {
-    celix_status_t status = CELIX_SUCCESS;
+	celix_status_t status = CELIX_SUCCESS;
 
-    if (!dependency) {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
+	if (!dependency) {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
 
-    if (status == CELIX_SUCCESS) {
-        if (dependency->swap) {
-            dependency->swap(component_getImplementation(dependency->component), event->service, newEvent->service);
-        }
-        if (dependency->swap_with_ref) {
-            dependency->swap_with_ref(component_getImplementation(dependency->component), event->reference, event->service, newEvent->reference, newEvent->service);
-        }
-    }
+	if (status == CELIX_SUCCESS) {
+		if (dependency->swap) {
+			dependency->swap(serviceDependency_getCallbackHandle(dependency), event->service, newEvent->service);
+		}
+		if (dependency->swap_with_ref) {
+			dependency->swap_with_ref(serviceDependency_getCallbackHandle(dependency), event->reference, event->service, newEvent->reference, newEvent->service);
+		}
+	}
 
-    return status;
+	return status;
 }
 
 celix_status_t serviceDependency_isAvailable(dm_service_dependency_pt dependency, bool *available) {
-    celix_status_t status = CELIX_SUCCESS;
+	celix_status_t status = CELIX_SUCCESS;
 
-    if (!dependency) {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
+	if (!dependency) {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
 
-    if (status == CELIX_SUCCESS) {
-        *available = dependency->available;
-    }
+	if (status == CELIX_SUCCESS) {
+		*available = dependency->available;
+	}
 
-    return status;
+	return status;
 }
 
 celix_status_t serviceDependency_isRequired(dm_service_dependency_pt dependency, bool *required) {
-    celix_status_t status = CELIX_SUCCESS;
+	celix_status_t status = CELIX_SUCCESS;
 
-    if (!dependency) {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
+	if (!dependency) {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
 
-    if (status == CELIX_SUCCESS) {
-        *required = dependency->required;
-    }
+	if (status == CELIX_SUCCESS) {
+		*required = dependency->required;
+	}
 
-    return status;
+	return status;
 }
 
 celix_status_t serviceDependency_isInstanceBound(dm_service_dependency_pt dependency, bool *instanceBound) {
-    celix_status_t status = CELIX_SUCCESS;
+	celix_status_t status = CELIX_SUCCESS;
 
-    if (!dependency) {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
+	if (!dependency) {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
 
-    if (status == CELIX_SUCCESS) {
-        *instanceBound = dependency->instanceBound;
-    }
+	if (status == CELIX_SUCCESS) {
+		*instanceBound = dependency->instanceBound;
+	}
 
-    return status;
+	return status;
 }
 
 celix_status_t serviceDependency_isAutoConfig(dm_service_dependency_pt dependency, bool *autoConfig) {
-    celix_status_t status = CELIX_SUCCESS;
+	celix_status_t status = CELIX_SUCCESS;
 
-    if (!dependency) {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
+	if (!dependency) {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
 
-    if (status == CELIX_SUCCESS) {
-        *autoConfig = dependency->autoConfigure != NULL;
-    }
+	if (status == CELIX_SUCCESS) {
+		*autoConfig = dependency->autoConfigure != NULL;
+	}
 
-    return status;
+	return status;
 }
 
-celix_status_t serviceDependency_getAutoConfig(dm_service_dependency_pt dependency, void ***autoConfigure) {
-    celix_status_t status = CELIX_SUCCESS;
+celix_status_t serviceDependency_getAutoConfig(dm_service_dependency_pt dependency, const void*** autoConfigure) {
+	celix_status_t status = CELIX_SUCCESS;
 
-    if (!dependency) {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
+	if (!dependency) {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
 
-    if (status == CELIX_SUCCESS) {
-        *autoConfigure = dependency->autoConfigure;
-    }
+	if (status == CELIX_SUCCESS) {
+		*autoConfigure = dependency->autoConfigure;
+	}
 
-    return status;
+	return status;
 }
 
 celix_status_t serviceDependency_addedService(void *_ptr, service_reference_pt reference, void *service) {
-    celix_status_t status = CELIX_SUCCESS;
-    bundle_context_pt context = NULL;
-    bundle_pt bundle = NULL;
-    dm_event_pt event = NULL;
-    dm_service_dependency_pt dependency = _ptr;
+	celix_status_t status = CELIX_SUCCESS;
+	bundle_context_pt context = NULL;
+	bundle_pt bundle = NULL;
+	dm_event_pt event = NULL;
+	dm_service_dependency_pt dependency = _ptr;
 
-    if (!dependency || !reference || !service) {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
+	if (!dependency || !reference || !service) {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
 
-    if (status == CELIX_SUCCESS) {
-        status = component_getBundleContext(dependency->component, &context);
-        if (!context) {
-            status = CELIX_BUNDLE_EXCEPTION;
-        }
-    }
+	if (status == CELIX_SUCCESS) {
+		status = component_getBundleContext(dependency->component, &context);
+		if (!context) {
+			status = CELIX_BUNDLE_EXCEPTION;
+		}
+	}
 
-    if (status == CELIX_SUCCESS) {
-        status = bundleContext_getBundle(context, &bundle);
-        if (!bundle) {
-            status = CELIX_BUNDLE_EXCEPTION;
-        }
-    }
+	if (status == CELIX_SUCCESS) {
+		status = bundleContext_getBundle(context, &bundle);
+		if (!bundle) {
+			status = CELIX_BUNDLE_EXCEPTION;
+		}
+	}
 
-    if (status == CELIX_SUCCESS) {
-        status = event_create(DM_EVENT_ADDED, bundle, context, reference, service, &event);
-    }
+	if (status == CELIX_SUCCESS) {
+		status = event_create(DM_EVENT_ADDED, bundle, context, reference, service, &event);
+	}
 
-    if (status == CELIX_SUCCESS) {
-        component_handleEvent(dependency->component, dependency, event);
-    }
+	if (status == CELIX_SUCCESS) {
+		component_handleEvent(dependency->component, dependency, event);
+	}
 
-    return status;
+	return status;
 }
 
 celix_status_t serviceDependency_modifiedService(void *_ptr, service_reference_pt reference, void *service) {
-    celix_status_t status = CELIX_SUCCESS;
-    bundle_context_pt context = NULL;
-    bundle_pt bundle = NULL;
-    dm_event_pt event = NULL;
-    dm_service_dependency_pt dependency = _ptr;
+	celix_status_t status = CELIX_SUCCESS;
+	bundle_context_pt context = NULL;
+	bundle_pt bundle = NULL;
+	dm_event_pt event = NULL;
+	dm_service_dependency_pt dependency = _ptr;
 
-    if (!dependency || !reference || !service) {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
+	if (!dependency || !reference || !service) {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
 
-    if (status == CELIX_SUCCESS) {
-        status = component_getBundleContext(dependency->component, &context);
-        if (!context) {
-            status = CELIX_BUNDLE_EXCEPTION;
-        }
-    }
+	if (status == CELIX_SUCCESS) {
+		status = component_getBundleContext(dependency->component, &context);
+		if (!context) {
+			status = CELIX_BUNDLE_EXCEPTION;
+		}
+	}
 
-    if (status == CELIX_SUCCESS) {
-        status = bundleContext_getBundle(context, &bundle);
-        if (!bundle) {
-            status = CELIX_BUNDLE_EXCEPTION;
-        }
-    }
+	if (status == CELIX_SUCCESS) {
+		status = bundleContext_getBundle(context, &bundle);
+		if (!bundle) {
+			status = CELIX_BUNDLE_EXCEPTION;
+		}
+	}
 
-    if (status == CELIX_SUCCESS) {
-        status = event_create(DM_EVENT_CHANGED, bundle, context, reference, service, &event);
-    }
+	if (status == CELIX_SUCCESS) {
+		status = event_create(DM_EVENT_CHANGED, bundle, context, reference, service, &event);
+	}
 
-    if (status == CELIX_SUCCESS) {
-        component_handleEvent(dependency->component, dependency, event);
-    }
+	if (status == CELIX_SUCCESS) {
+		component_handleEvent(dependency->component, dependency, event);
+	}
 
-    return status;
+	return status;
 }
 
 celix_status_t serviceDependency_removedService(void *_ptr, service_reference_pt reference, void *service) {
-    celix_status_t status = CELIX_SUCCESS;
-    bundle_context_pt context = NULL;
-    bundle_pt bundle = NULL;
-    dm_event_pt event = NULL;
-    dm_service_dependency_pt dependency = _ptr;
+	celix_status_t status = CELIX_SUCCESS;
+	bundle_context_pt context = NULL;
+	bundle_pt bundle = NULL;
+	dm_event_pt event = NULL;
+	dm_service_dependency_pt dependency = _ptr;
 
-    if (!dependency || !reference || !service) {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
+	if (!dependency || !reference || !service) {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
 
-    if (status == CELIX_SUCCESS) {
-        status = component_getBundleContext(dependency->component, &context);
-        if (!context) {
-            status = CELIX_BUNDLE_EXCEPTION;
-        }
-    }
+	if (status == CELIX_SUCCESS) {
+		status = component_getBundleContext(dependency->component, &context);
+		if (!context) {
+			status = CELIX_BUNDLE_EXCEPTION;
+		}
+	}
 
-    if (status == CELIX_SUCCESS) {
-        status = bundleContext_getBundle(context, &bundle);
-        if (!bundle) {
-            status = CELIX_BUNDLE_EXCEPTION;
-        }
-    }
+	if (status == CELIX_SUCCESS) {
+		status = bundleContext_getBundle(context, &bundle);
+		if (!bundle) {
+			status = CELIX_BUNDLE_EXCEPTION;
+		}
+	}
 
-    if (status == CELIX_SUCCESS) {
-        status = event_create(DM_EVENT_REMOVED, bundle, context, reference, service, &event);
-    }
+	if (status == CELIX_SUCCESS) {
+		status = event_create(DM_EVENT_REMOVED, bundle, context, reference, service, &event);
+	}
 
-    if (status == CELIX_SUCCESS) {
-        component_handleEvent(dependency->component, dependency, event);
-    }
+	if (status == CELIX_SUCCESS) {
+		component_handleEvent(dependency->component, dependency, event);
+	}
 
-    return status;
+	return status;
 }
 
 celix_status_t serviceDependency_getServiceDependencyInfo(dm_service_dependency_pt dep, dm_service_dependency_info_pt *out) {
-    celix_status_t status = CELIX_SUCCESS;
-    dm_service_dependency_info_pt info = calloc(1, sizeof(*info));
-    if (info != NULL) {
-        celixThreadMutex_lock(&dep->lock);
-        info->available = dep->available;
-        info->filter = dep->tracked_filter != NULL ? strdup(dep->tracked_filter) : NULL;
-        if (info->filter == NULL) {
-            info->filter = dep->tracked_service != NULL ? strdup(dep->tracked_service) : NULL;
-        }
-        info->required = dep->required;
+	celix_status_t status = CELIX_SUCCESS;
+	dm_service_dependency_info_pt info = calloc(1, sizeof(*info));
+	if (info != NULL) {
+		celixThreadMutex_lock(&dep->lock);
+		info->available = dep->available;
+		info->filter = dep->tracked_filter != NULL ? strdup(dep->tracked_filter) : NULL;
+		if (info->filter == NULL) {
+			info->filter = dep->tracked_service != NULL ? strdup(dep->tracked_service) : NULL;
+		}
+		info->required = dep->required;
 
-        array_list_pt refs = serviceTracker_getServiceReferences(dep->tracker);
-        if (refs != NULL) {
-            info->count = arrayList_size(refs);
-        }
-        arrayList_destroy(refs);
+		array_list_pt refs = serviceTracker_getServiceReferences(dep->tracker);
+		if (refs != NULL) {
+			info->count = arrayList_size(refs);
+		}
+		arrayList_destroy(refs);
 
-        celixThreadMutex_unlock(&dep->lock);
-    } else {
-        status = CELIX_ENOMEM;
-    }
+		celixThreadMutex_unlock(&dep->lock);
+	} else {
+		status = CELIX_ENOMEM;
+	}
 
-    if (status == CELIX_SUCCESS) {
-        *out = info;
-    }
+	if (status == CELIX_SUCCESS) {
+		*out = info;
+	}
 
-    return status;
+	return status;
 }
 
 void dependency_destroyDependencyInfo(dm_service_dependency_info_pt info) {
-    if (info != NULL) {
-        free(info->filter);
-    }
-    free(info);
+	if (info != NULL) {
+		free(info->filter);
+	}
+	free(info);
+}
+
+celix_status_t serviceDependency_setCallbackHandle(dm_service_dependency_pt dependency, void* handle) {
+	dependency->callbackHandle = handle;
+    return CELIX_SUCCESS;
+}
+
+static void* serviceDependency_getCallbackHandle(dm_service_dependency_pt dependency) {
+    return dependency->callbackHandle == NULL ? component_getImplementation(dependency->component) : dependency->callbackHandle;
 }
diff --git a/dependency_manager/private/src/dm_shell_activator.c b/dependency_manager/private/src/dm_shell_activator.c
index fcb42cd..43b8e3e 100644
--- a/dependency_manager/private/src/dm_shell_activator.c
+++ b/dependency_manager/private/src/dm_shell_activator.c
@@ -24,6 +24,7 @@
  *  \copyright  Apache License, Version 2.0
  */
 
+#include <constants.h>
 #include "bundle_context.h"
 #include "service_registration.h"
 #include "command.h"
@@ -39,26 +40,19 @@
 
 celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
 
+	if(userData==NULL){
+		return CELIX_ILLEGAL_ARGUMENT;
+	}
+
     struct bundle_instance *bi = calloc(sizeof (struct bundle_instance), 1);
-    celix_status_t status = CELIX_SUCCESS;
 
-    if (!bi) {
-        status = CELIX_ENOMEM;
-    }
-    else if (userData == NULL) {
-        status = CELIX_ILLEGAL_ARGUMENT;
-        free(bi);
-    }
-    else {
-        if (status != CELIX_SUCCESS) {
-            printf("DM:LIST Create failed\n");
-            free(bi);
-        }
-
-        (*userData) = bi;
+    if (bi==NULL) {
+        return CELIX_ENOMEM;
     }
 
-    return status;
+    (*userData) = bi;
+
+    return CELIX_SUCCESS;
 }
 
 celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
@@ -71,6 +65,7 @@
         commandService->executeCommand = (void *)dmListCommand_execute;
 
         properties_pt props = properties_create();
+        properties_set(props, CELIX_FRAMEWORK_SERVICE_LANGUAGE, CELIX_FRAMEWORK_SERVICE_C_LANGUAGE);
         properties_set(props, OSGI_SHELL_COMMAND_NAME, "dm");
         properties_set(props, OSGI_SHELL_COMMAND_USAGE, "dm");
         properties_set(props, OSGI_SHELL_COMMAND_DESCRIPTION,
diff --git a/dependency_manager/private/src/dm_shell_list_command.c b/dependency_manager/private/src/dm_shell_list_command.c
index 6f95eb9..c6fe68c 100644
--- a/dependency_manager/private/src/dm_shell_list_command.c
+++ b/dependency_manager/private/src/dm_shell_list_command.c
@@ -43,6 +43,12 @@
     array_list_pt servRefs = NULL;
     int i;
     bundleContext_getServiceReferences(context, DM_INFO_SERVICE_NAME ,NULL, &servRefs);
+
+    if(servRefs==NULL){
+	fprintf(out, "Invalid dm_info ServiceReferences List\n");
+	return;
+    }
+
     char *term = getenv("TERM");
     bool colors = false;
     if (strcmp("xterm-256color", term) == 0) {
@@ -71,9 +77,14 @@
             int interfCnt;
             fprintf(out, "|- Interfaces (%d):\n", arrayList_size(compInfo->interfaces));
             for(interfCnt = 0 ;interfCnt < arrayList_size(compInfo->interfaces); interfCnt++) {
-                char * interface;
-                interface = arrayList_get(compInfo->interfaces, interfCnt);
-                fprintf(out, "   |- Interface: %s\n", interface);
+                dm_interface_info_pt intfInfo= arrayList_get(compInfo->interfaces, interfCnt);
+                fprintf(out, "   |- Interface: %s\n", intfInfo->name);
+
+                hash_map_iterator_t iter = hashMapIterator_construct((hash_map_pt) intfInfo->properties);
+                char* key = NULL;
+                while((key = hashMapIterator_nextKey(&iter)) != NULL) {
+                    fprintf(out, "      | %15s = %s\n", key, properties_get(intfInfo->properties, key));
+                }
             }
 
             int depCnt;
@@ -109,7 +120,7 @@
 		bundleContext_ungetService(context,servRef,NULL);
 		bundleContext_ungetServiceReference(context,servRef);
 
-        }
+    }
 
 	if(servRefs!=NULL){
 		arrayList_destroy(servRefs);
diff --git a/dependency_manager/public/include/dm_activator.h b/dependency_manager/public/include/dm_activator.h
index a439ee5..521800a 100644
--- a/dependency_manager/public/include/dm_activator.h
+++ b/dependency_manager/public/include/dm_activator.h
@@ -29,12 +29,35 @@
 #ifndef DM_ACTIVATOR_BASE_H_
 #define DM_ACTIVATOR_BASE_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "bundle_context.h"
 #include "celix_errno.h"
 #include "dm_dependency_manager.h"
 
+/**
+ * Should be implemented by a bundle specific DM activator.
+ * Should allocate and initialize a bundle specific activator struct.
+ */
 celix_status_t dm_create(bundle_context_pt context, void ** userData);
+
+/**
+ * Should be implemented by a bundle specific DM activator.
+ * Will be called after the dm_create function.
+ * Can be used to specify with use of the provided dependency manager the bundle specific components.
+ */
 celix_status_t dm_init(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager);
+
+/**
+ * Should be implemented by a bundle specific DM activator.
+ * Should deinitialize and deallocate the undle specific activator struct.
+ */
 celix_status_t dm_destroy(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* DM_ACTIVATOR_BASE_H_ */
diff --git a/dependency_manager/public/include/dm_component.h b/dependency_manager/public/include/dm_component.h
index 65c4609..54363dd 100644
--- a/dependency_manager/public/include/dm_component.h
+++ b/dependency_manager/public/include/dm_component.h
@@ -27,6 +27,10 @@
 #ifndef COMPONENT_H_
 #define COMPONENT_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include <bundle_context.h>
 #include <celix_errno.h>
 
@@ -49,26 +53,83 @@
 typedef int (*stop_fpt)(void *userData);
 typedef int (*deinit_fpt)(void *userData);
 
-celix_status_t component_create(bundle_context_pt context, const char *name, dm_component_pt *component);
+/**
+ * Creates a DM Component
+ * Caller has ownership.
+ */
+celix_status_t component_create(bundle_context_pt context, const char* name, dm_component_pt *component);
+
+/**
+ * Destroys a DM Component
+ */
 void component_destroy(dm_component_pt component);
 
-celix_status_t component_addInterface(dm_component_pt component, char *serviceName, char *serviceVersion, void *service, properties_pt properties);
-celix_status_t component_setImplementation(dm_component_pt component, void *implementation);
+
+/**
+ * Specify if a default 'service.lang=C' should be added to the properties of interfaces if no 'service.lang' has been
+ * provided. Default is true. Note that this should be set before using component_addInterface.
+ */
+celix_status_t setCLanguageProperty(dm_component_pt component, bool setCLangProp);
+
+
+/**
+ * Adds a C interface to provide as service to the Celix framework.
+ *
+ * @param serviceName the service name.
+ * @param version The version of the interface (e.g. "1.0.0"), Can be a NULL pointer.
+ * @param properties To (meta) properties to provide with the service. Can be a NULL pointer.
+ */
+celix_status_t component_addInterface(dm_component_pt component, const char* serviceName, const char* serviceVersion, const void* service, properties_pt properties);
+
+/**
+ * Sets the implementation of the component. e.g. the component handle/self/this pointer.
+ */
+celix_status_t component_setImplementation(dm_component_pt component, void* implementation);
 
 /**
  * Returns an arraylist of service names. The caller owns the arraylist and strings (char *)
  */
 celix_status_t component_getInterfaces(dm_component_pt component, array_list_pt *servicesNames);
 
+/**
+ * Adds a C service dependency to the component
+ */
 celix_status_t component_addServiceDependency(dm_component_pt component, dm_service_dependency_pt dep);
+
+/**
+ * Removes a C service dependency to the component
+ */
 celix_status_t component_removeServiceDependency(dm_component_pt component, dm_service_dependency_pt dependency);
 
+/**
+ * Returns the current state of the component.
+ */
 dm_component_state_t component_currentState(dm_component_pt cmp);
+
+/**
+ * Returns the implementation of the component. e.g. the component handle/self/this pointer.
+ */
 void * component_getImplementation(dm_component_pt cmp);
+
+/**
+ * Returns the DM component name. This is used when printing information about the component.
+ */
 const char * component_getName(dm_component_pt cmp);
 
+/**
+ * Returns bundle context for the bundle where this DM component is part of.
+ */
 celix_status_t component_getBundleContext(dm_component_pt component, bundle_context_pt *out);
 
+/**
+ * Set the component life cycle callbacks.
+ * The first argument will be the component implementation (@see component_getImplementation)
+ */
+celix_status_t component_setCallbacks(dm_component_pt component, init_fpt init, start_fpt start, stop_fpt stop, deinit_fpt deinit);
+
+/**
+ * Set the component life cycle callbacks using a MACRO for improving the type safety.
+ */
 #define component_setCallbacksSafe(dmCmp, type, init, start, stop, deinit) \
     do {  \
         int (*tmp_init)(type)   = (init); \
@@ -78,13 +139,19 @@
         component_setCallbacks((dmCmp), (init_fpt)tmp_init, (start_fpt)tmp_start, (stop_fpt)tmp_stop, (deinit_fpt)tmp_deinit); \
     } while(0)
 
-celix_status_t component_setCallbacks(dm_component_pt component, init_fpt init, start_fpt start, stop_fpt stop, deinit_fpt deinit);
-
 /**
- * returns a dm_component_info_pt. Caller has ownership.
+ * Create a DM Component info struct. Containing information about the component.
+ * Caller has ownership.
  */
 celix_status_t component_getComponentInfo(dm_component_pt component, dm_component_info_pt *info);
+
+/**
+ * Destroys a DM Component info struct.
+ */
 void component_destroyComponentInfo(dm_component_info_pt info);
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* COMPONENT_H_ */
diff --git a/dependency_manager/public/include/dm_dependency_manager.h b/dependency_manager/public/include/dm_dependency_manager.h
index 2eceeb9..9ee8ae5 100644
--- a/dependency_manager/public/include/dm_dependency_manager.h
+++ b/dependency_manager/public/include/dm_dependency_manager.h
@@ -27,6 +27,10 @@
 #ifndef DM_DEPENDENCY_MANAGER_H_
 #define DM_DEPENDENCY_MANAGER_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "bundle_context.h"
 #include "celix_errno.h"
 #include "array_list.h"
@@ -35,17 +39,40 @@
 
 typedef struct dm_dependency_manager *dm_dependency_manager_pt;
 
+/**
+ * Creates a dependency manager.
+ * Caller has ownership.
+ */
 celix_status_t dependencyManager_create(bundle_context_pt context, dm_dependency_manager_pt *manager);
+
+/**
+ * Destroys the provided dependency manager
+ */
 void dependencyManager_destroy(dm_dependency_manager_pt manager);
 
+/**
+ * Adds a DM component to the dependency manager
+ */
 celix_status_t dependencyManager_add(dm_dependency_manager_pt manager, dm_component_pt component);
 
+/**
+ * Removes all DM components from the dependency manager
+ */
 celix_status_t dependencyManager_removeAllComponents(dm_dependency_manager_pt manager);
 
 /**
- * returns a dm_ of dm_dependency_manager_info. Caller has ownership.
+ * Create and returns a DM Info struct. Which contains information about the state of the DM components
+ * Caller has ownership.
  */
 celix_status_t dependencyManager_getInfo(dm_dependency_manager_pt manager, dm_dependency_manager_info_pt *info);
+
+/**
+ * Destroys a DM info struct.
+ */
 void dependencyManager_destroyInfo(dm_dependency_manager_pt manager, dm_dependency_manager_info_pt info);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* DM_DEPENDENCY_MANAGER_H_ */
diff --git a/dependency_manager/public/include/dm_info.h b/dependency_manager/public/include/dm_info.h
index 99bb46a..7fbc434 100644
--- a/dependency_manager/public/include/dm_info.h
+++ b/dependency_manager/public/include/dm_info.h
@@ -26,33 +26,43 @@
 #ifndef CELIX_DM_INFO_SERVICE_H
 #define CELIX_DM_INFO_SERVICE_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
 #include <stdbool.h>
 #include "array_list.h"
 
 #define DM_INFO_SERVICE_NAME "dm_info"
 
 
-typedef struct dm_service_dependency_info {
+typedef struct dm_interface_info_struct {
+    char* name;
+    properties_pt properties;
+} * dm_interface_info_pt;
+
+typedef struct dm_service_dependency_info_struct {
     char *filter;
     bool available;
     bool required;
     size_t count;
 } * dm_service_dependency_info_pt;
 
-typedef struct dm_component_info {
+typedef struct dm_component_info_struct {
     char id[64];
     char name[128];
     bool active;
     char * state;
-    array_list_pt interfaces;   // type char*
-    array_list_pt dependency_list;  // type interface_info_pt
+    array_list_pt interfaces;   // type dm_interface_info_pt
+    array_list_pt dependency_list;  // type dm_service_dependency_info_pt
 } * dm_component_info_pt;
 
-typedef struct dm_dependency_manager_info {
+typedef struct dm_dependency_manager_info_struct {
     array_list_pt  components;      // type dm_component_info
 } * dm_dependency_manager_info_pt;
 
-struct dm_info_service {
+struct dm_info_service_struct {
     void *handle;
 
     /*Note: dm_caller has the ownership of the result.*/
@@ -60,7 +70,11 @@
     void (*destroyInfo)(void *handle, dm_dependency_manager_info_pt info);
 };
 
-typedef struct dm_info_service * dm_info_service_pt;
+typedef struct dm_info_service_struct dm_info_service_t;
+typedef dm_info_service_t* dm_info_service_pt;
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif //CELIX_DM_INFO_SERVICE_H
diff --git a/dependency_manager/public/include/dm_service_dependency.h b/dependency_manager/public/include/dm_service_dependency.h
index d3eeed4..957f7be 100644
--- a/dependency_manager/public/include/dm_service_dependency.h
+++ b/dependency_manager/public/include/dm_service_dependency.h
@@ -27,6 +27,11 @@
 #ifndef DM_SERVICE_DEPENDENCY_H_
 #define DM_SERVICE_DEPENDENCY_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "service_reference.h"
 #include "celix_errno.h"
 #include "dm_info.h"
 
@@ -38,30 +43,98 @@
 	DM_SERVICE_DEPENDENCY_STRATEGY_SUSPEND
 } dm_service_dependency_strategy_t;
 
-typedef int (*service_set_fpt)(void *handle, void *service);
-typedef int (*service_add_fpt)(void *handle, void *service);
-typedef int (*service_change_fpt)(void *handle, void *service);
-typedef int (*service_remove_fpt)(void *handle, void *service);
-typedef int (*service_swap_fpt)(void *handle, void *oldService, void *newService);
+typedef int (*service_set_fpt)(void *handle, const void* service);
+typedef int (*service_add_fpt)(void *handle, const void* service);
+typedef int (*service_change_fpt)(void *handle, const void* service);
+typedef int (*service_remove_fpt)(void *handle, const void* service);
+typedef int (*service_swap_fpt)(void *handle, const void* oldService, const void* newService);
 
-typedef celix_status_t (*service_set_with_ref_fpt)(void *handle, service_reference_pt reference, void *service);
-typedef celix_status_t (*service_add_with_ref_fpt)(void *handle, service_reference_pt reference, void *service);
-typedef celix_status_t (*service_change_with_ref_fpt)(void *handle, service_reference_pt reference, void *service);
-typedef celix_status_t (*service_remove_with_ref_fpt)(void *handle, service_reference_pt reference, void *service);
-typedef celix_status_t (*service_swap_with_ref_fpt)(void *handle, service_reference_pt oldReference, void *oldService, service_reference_pt newReference, void *newService);
+typedef celix_status_t (*service_set_with_ref_fpt)(void *handle, service_reference_pt reference, const void* service);
+typedef celix_status_t (*service_add_with_ref_fpt)(void *handle, service_reference_pt reference, const void* service);
+typedef celix_status_t (*service_change_with_ref_fpt)(void *handle, service_reference_pt reference, const void* service);
+typedef celix_status_t (*service_remove_with_ref_fpt)(void *handle, service_reference_pt reference, const void* service);
+typedef celix_status_t (*service_swap_with_ref_fpt)(void *handle, service_reference_pt oldReference, const void* oldService, service_reference_pt newReference, const void* newService);
 
+/**
+ * Create a service dependency.
+ * Caller has ownership.
+ */
 celix_status_t serviceDependency_create(dm_service_dependency_pt *dependency_ptr);
+
+/**
+ * Destroys a service dependency.
+ * Caller has ownership.
+ */
 celix_status_t serviceDependency_destroy(dm_service_dependency_pt *dependency_ptr);
 
+/**
+ * Specify if the service dependency is required. default is false
+ */
 celix_status_t serviceDependency_setRequired(dm_service_dependency_pt dependency, bool required);
-celix_status_t serviceDependency_setStrategy(dm_service_dependency_pt dependency,dm_service_dependency_strategy_t strategy);
-celix_status_t serviceDependency_getStrategy(dm_service_dependency_pt dependency,dm_service_dependency_strategy_t* strategy);
-celix_status_t serviceDependency_setService(dm_service_dependency_pt dependency, char *serviceName, char *serviceVersion, char *filter);
-celix_status_t serviceDependency_getFilter(dm_service_dependency_pt dependency, char **filter);
 
+/**
+ * Specify if the servide dependency should add a C language filter for this dependency if no "service.lang" part if found the in the provided filter.
+ * Default is true
+ */
+celix_status_t serviceDependency_setAddCLanguageFilter(dm_service_dependency_pt dependency, bool addCLangFilter);
+
+
+/**
+ * Specify if the service dependency update strategy.
+ *
+ * The DM_SERVICE_DEPENDENCY_STRATEGY_LOCKING strategy notifies the component in case the dependencies set
+ * changes (e.g. a dependency is added/removed): the component is responsible for protecting via locks
+ * the dependencies list and check (always under lock) if the service he's depending on is still available.
+ *
+ * The DM_SERVICE_DEPENDENCY_STRATEGY_SUSPEND (default when no strategy is explicitly set) reliefs the programmer
+ * from dealing with service dependencies' consistency issues: in case this strategy is adopted, the component
+ * is stopped and restarted (i.e. temporarily suspended) upon service dependencies' changes.
+ *
+ * Default strategy is DM_SERVICE_DEPENDENCY_STRATEGY_SUSPEND
+ */
+celix_status_t serviceDependency_setStrategy(dm_service_dependency_pt dependency,dm_service_dependency_strategy_t strategy);
+
+/**
+ * Return the service dependency update strategy.
+ */
+celix_status_t serviceDependency_getStrategy(dm_service_dependency_pt dependency,dm_service_dependency_strategy_t* strategy);
+
+/**
+ * Set the service name, version range and filter.
+ *
+ * @param serviceName The service name. Must have a value.
+ * @param serviceVersionRange The service version range, can be a NULL pointer.
+ * @param filter The (additional) filter to use (e.g. "(location=front)"). Can be a NULL pointer.
+ */
+celix_status_t serviceDependency_setService(dm_service_dependency_pt dependency, const char* serviceName, const char* serviceVersionRange, const char* filter);
+
+/**
+ * Returns the service depenendy filter.
+ */
+celix_status_t serviceDependency_getFilter(dm_service_dependency_pt dependency, const char** filter);
+
+/**
+ * Set the set, add, change, remove and swap function callbacks when services specified by the service dependency
+ * are (respectively) set, added, changed, removed or swapped.
+ * The first argument of the callbacks will be the component implement (@see component_getImplementation)
+ * The second the argument a pointer to an instance of a service struct of the specified service dependency.
+ */
 celix_status_t serviceDependency_setCallbacks(dm_service_dependency_pt dependency, service_set_fpt set, service_add_fpt add, service_change_fpt change, service_remove_fpt remove, service_swap_fpt swap);
+
+/**
+ * Set the set, add, change, remove and swap function callbacks when services specified by the service dependency
+ * are (respectively) set, added, changed, removed or swapped.
+ * The first argument of the callbacks will be the component implement (@see component_getImplementation)
+ * The second argument of th callbacks will be a pointer to an instance of a service struct of the specified service dependency.
+ * The third argument of th callbacks will be a pointer to a service reference of the a service instance of the specified service dependency.
+ */
 celix_status_t serviceDependency_setCallbacksWithServiceReference(dm_service_dependency_pt dependency, service_set_with_ref_fpt set, service_add_with_ref_fpt add, service_change_with_ref_fpt change, service_remove_with_ref_fpt remove, service_swap_with_ref_fpt swap);
-celix_status_t serviceDependency_setAutoConfigure(dm_service_dependency_pt dependency, celix_thread_mutex_t *service_lock, void **field);
+
+/**
+ * Specifies which field member (pointer to) to update when a service dependencies is set.
+ * If provided the provided service_lock will be used for locking when updating the service instance.
+ */
+celix_status_t serviceDependency_setAutoConfigure(dm_service_dependency_pt dependency, celix_thread_mutex_t *service_lock, const void** field);
 
 #define serviceDependency_setCallbacksSafe(dep, cmpType, servType, set, add, change, remove, swap) \
 	do { \
@@ -73,11 +146,26 @@
 		serviceDependency_setCallbacks((dep), (service_set_fpt)tmpSet, (service_add_fpt)tmpAdd, (service_change_fpt)tmpChange, (service_remove_fpt)tmpRemove, (service_swap_fpt)tmpSwap); \
 	} while(0)
 
+/**
+ * Set the callback handle to be used in the callbacks. Note that this normally should not be set, because the
+ * result of component_getImplementation() is used
+ * This can be used in rare cases when the callbacks are actually interceptors. e.g. in the case of C++ support.
+ */
+celix_status_t serviceDependency_setCallbackHandle(dm_service_dependency_pt dependency, void* handle);
 
 /**
- * Return a service dependency info. The caller is the owner
+ * Creates a service dependency info. The service dependency info struct contains information about the service dependency.
+ * The caller is the owner
  */
 celix_status_t serviceDependency_getServiceDependencyInfo(dm_service_dependency_pt, dm_service_dependency_info_pt *info);
+
+/**
+ * Destroy a provided service dependency info struct.
+ */
 void dependency_destroyDependencyInfo(dm_service_dependency_info_pt info);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* DM_SERVICE_DEPENDENCY_H_ */
diff --git a/dependency_manager/readme.md b/dependency_manager/readme.md
new file mode 100644
index 0000000..867fe95
--- /dev/null
+++ b/dependency_manager/readme.md
@@ -0,0 +1,123 @@
+# Apache Celix Dependency Manager
+
+## Introduction
+
+The Dependency Manager contains a static library which can be used to manage (dynamic) services on a higher abstraction level in a declarative style. 
+The Apache Celix Dependency Manager is inspired by the [Apache Felix Dependency Manager](http://felix.apache.org/documentation/subprojects/apache-felix-dependency-manager.html).
+
+## Components
+
+Components are the main building blocks for OSGi applications. They can publish services, and/or they can have dependencies. These dependencies will influence their life cycle as component will only be activated when all required dependencies are available.
+
+Within Apache Celix a component is expected to have a set of functions where the first argument is a handle to the component (e.g. self/this). How this is achieved is up the the user, for some examples how this can be done see the example in the Apache Celix Project. 
+
+The Dependency Manager, as part of a bundle, shares the generic bundle life cycle explained in the OSGi specification. 
+Each component you define gets its own life cycle. The component life cycle is depicted in the state diagram below.
+
+![Component Life Cycle](doc-images/statediagram.png)
+
+Changes in the state of the component will trigger the following life cycle callback functions:
+
+    `init`,
+    `start`,
+    `stop` and
+    `deinit`.
+
+The callback functions can be specified by using the component_setCallbacks.
+
+## DM Parts
+
+The Dependency Manager consist out of four main parts: `DM (Dependency Manager) Activator`, `Dependency Manager`, `DM Component` and `DM Service Dependency`.
+
+### DM Activator
+
+The `DM Activator` implements a "normal" Celix bundle activator and depends on four functions which needs to be implemented by the user of the Depedency Manager:
+ - `dm_create` : Should be used to allocated and initialize a dm activator structure. If needed this structure can be used to store object during the lifecycle of the bundle.
+ - `dm_init` : Should be used to interact with the `Dependency Manager`. Here a user can components, service dependencies and provided services. 
+ - `dm_destroy` : Should be used to deinitialize and deallocate objects created in the `dm_create` function.
+
+
+### Dependency Manager
+
+The `Dependency Manager` act as an entry point to add or remove DM Components. The `Dependency Manager` is provided to the `dm_init` functoin.
+
+### DM Component
+
+The `DM Component` manages the life cycle of a component. For example, when all required service dependencies are available the `DM Component` will call the `start` specified callback function of the component. 
+
+The `component_setImplementation` function can be used to specify which component handle to use. 
+The `component_addInterface` can be used to specify one additional service provided by the component. 
+The `component_addServiceDependency` can be used to specify one additional service dependency.
+
+### Dm Service Dependency 
+
+The `DM Service Dependency` can be used to specify service dependencies for a component. i
+
+When these dependencies are set to required the `DM Component` will ensure that components will only be started when all required dependencies are available and stop the component if any of the required dependencies are removed. 
+This feature should prevent a lot of boiler plating code compared to using a service tracker or services references directly. 
+
+A service dependency update strategy can also be specified. Default this strategy is set to `DM_SERVICE_DEPENDENCY_STRATEGY_SUSPEND` this strategy will stop and start (suspend) a component when any of the specified service dependencies change (are removed, added or modified). 
+When correctly used this strategy removes the need for locking services during updates/invocation. See the dependency manager example for more details.
+
+The `serviceDependency_setCallbacks` function can be used to specify the function callback used when services are added, set, removed or modified. 
+The `serviceDependency_setRequired` function can be used to specify if a service dependency is required.
+The `serviceDependency_setStrategy` function can be used to specify a service dependency update strategy (suspend or locking).
+
+### Snippets
+
+#### DM Bundle Activator
+
+The next snippet shows a dm bundle activator and how to add components to the dependency manager.
+```C
+
+//exmpl_activator.c
+#include <dm_activator.h>
+#include <stdlib.h>
+
+struct dm_exmpl_activator {
+    exmpl_t* exmpl;
+};
+
+celix_status_t dm_create(bundle_context_pt context, void **userData) {                                                                                                                                             
+    *userData = calloc(1, sizeof(struct dm_exmpl_activator));
+    return *userData != NULL ? CELIX_SUCCESS : CELIX_ENOMEM;
+}
+
+celix_status_t dm_init(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
+    celix_status_t status = CELIX_SUCCESS;
+    struct dm_exmpl_activator *act = (struct dm_exmpl_activator*)userData;
+
+    act->exmpl = exmpl_create();
+    if (act->exmpl != NULL) {
+        dm_component_pt cmp;
+        component_create(context, "Example Component", &cmp);
+        component_setImplementation(cmp, act->exmpl);
+
+        dependencyManager_add(manager, cmp);
+    } else {
+        status = CELIX_ENOMEM;
+    }
+
+    return status;
+}
+
+celix_status_t dm_destroy(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
+    celix_status_t status = CELIX_SUCCESS;
+    struct dm_exmpl_activator *act = (struct dm_exmpl_activator*)userData;
+
+    if (act->exmpl != NULL) {
+        exmpl_destroy(act->exmpl);
+    }
+    free(act);
+
+    return CELIX_SUCCESS;
+}  
+```
+### References
+
+For more information examples please see
+
+- [Best practices](../documents/best_practices/readme.md): A introduction how to work with services using the dependency manager
+- [The Dependency Manager API](public/include): The dependency manager header files
+- [Best practice example](../examples/best_practice_example): A best practice example (also refered to in the Best practices documentation
+- [Dm example](../examples/dm_example): A DM example.  
diff --git a/dependency_manager_cxx/CMakeLists.txt b/dependency_manager_cxx/CMakeLists.txt
new file mode 100644
index 0000000..6c9869e
--- /dev/null
+++ b/dependency_manager_cxx/CMakeLists.txt
@@ -0,0 +1,67 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+celix_subproject(DEPENDENCY_MANAGER_CXX "Option to build the C++ dependency manager static library" ON DEPS framework DEPENDENCY_MANAGER)
+if (DEPENDENCY_MANAGER_CXX)
+
+    #set -Wall, -Werror locally, currenctly cpputest contains warnings
+    set(CMAKE_CXX_FLAGS "-Wall -Werror -fno-rtti -fno-exceptions ${CMAKE_CXX_FLAGS}")
+
+    # Add -fPIC for x86_64 Unix platforms; this lib will be linked to a shared lib
+    if(UNIX AND NOT WIN32)
+        find_program(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin )
+        if(CMAKE_UNAME)
+            exec_program(uname ARGS -m OUTPUT_VARIABLE CMAKE_SYSTEM_PROCESSOR)
+            set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR} CACHE INTERNAL "processor type (i386 and x86_64)")
+            if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
+                add_definitions(-fPIC)
+            endif(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
+        endif(CMAKE_UNAME)
+    endif(UNIX AND NOT WIN32)
+
+    include_directories(include)
+    include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
+    include_directories("${PROJECT_SOURCE_DIR}/dependency_manager/public/include")
+    include_directories("${PROJECT_SOURCE_DIR}/dependency_manager/private/include")
+
+    set(DM_DIR "${PROJECT_SOURCE_DIR}/dependency_manager")
+
+    add_library(dependency_manager_cxx_static STATIC
+    	${DM_DIR}/private/src/dm_component_impl.c
+        ${DM_DIR}/private/src/dm_service_dependency.c
+        ${DM_DIR}/private/src/dm_event.c
+        ${DM_DIR}/private/src/dm_dependency_manager_impl.c
+
+        src/DependencyManager.cc
+        src/Component.cc
+        src/ServiceDependency.cc
+        src/dm_activator_base_cxx.cc
+    )
+    #set_target_properties(dependency_manager_cxx_static PROPERTIES SOVERSION 1)
+    target_link_libraries(dependency_manager_cxx_static celix_framework)
+
+    install(
+        DIRECTORY
+            include/celix
+        DESTINATION
+            include/celix/dependency_manager_cxx
+        COMPONENT
+            dependency_manager_cxx
+    )
+
+    install(TARGETS dependency_manager_cxx_static DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT dependency_manager_cxx)
+endif (DEPENDENCY_MANAGER_CXX)
diff --git a/dependency_manager_cxx/include/celix/dm/Component.h b/dependency_manager_cxx/include/celix/dm/Component.h
new file mode 100644
index 0000000..d323389
--- /dev/null
+++ b/dependency_manager_cxx/include/celix/dm/Component.h
@@ -0,0 +1,190 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef CELIX_DM_COMPONENT_H
+#define CELIX_DM_COMPONENT_H
+
+#include "celix/dm/types.h"
+#include "dm_component.h"
+
+#include <map>
+#include <string>
+#include <list>
+#include <tuple>
+
+namespace celix { namespace dm {
+
+    class BaseComponent {
+    private:
+        bundle_context_pt context {nullptr};
+        std::string name {};
+        dm_component_pt cCmp {nullptr};
+    public:
+        BaseComponent(const bundle_context_pt context, std::string name);
+        virtual ~BaseComponent();
+
+        /**
+         * Returns the C DM Component
+         */
+        const dm_component_pt cComponent() const;
+
+        /**
+         * Returns the C bundle context
+         */
+        const bundle_context_pt bundleContext() const;
+    };
+        
+
+    template<class T>
+    class Component : public BaseComponent {
+    private:
+        std::shared_ptr<T> instance {nullptr};
+        std::list<T> refInstance {};
+        std::list<std::shared_ptr<BaseServiceDependency>> dependencies {};
+
+        void (T::*initFp)() = {};
+        void (T::*startFp)() = {};
+        void (T::*stopFp)() = {};
+        void (T::*deinitFp)() = {};
+    public:
+        Component(const bundle_context_pt context, std::string name);
+        virtual ~Component();
+
+        /**
+         * Creates a Component using the provided bundle context.
+         * Will use new(nothrow) if exceptions are disabled.
+         * @return newly created DM Component or nullptr
+         */
+        static Component<T>* create(bundle_context_pt, std::string name = std::string{});
+
+        /**
+         * Wether the component is valid. Invalid component can occurs when no new components can be created and
+         * exceptions are not allowed.
+         * @return
+         */
+        bool isValid() const;
+
+        /**
+         * Get the component instance. If no instance is explicitly set with setInstance than a instance will be create
+         * using a default constructor.
+         *
+         * @return A reference to the component instance.
+         */
+        T& getInstance();
+
+        /**
+         * Set the component instance using a (shared) pointer.
+         *
+         * @return the DM Component reference for chaining (fluent API)
+         */
+        Component<T>& setInstance(std::shared_ptr<T> inst);
+
+        /**
+         * Set the component instance using rvalue reference
+         * The DM Component will contain the instance.
+         *
+         * @return the DM Component reference for chaining (fluent API)
+         */
+        Component<T>& setInstance(T&& inst);
+
+        /**
+         * Adds a C++ interface to provide as service to the Celix framework.
+         * The interface name will be inferred using the I template.
+         *
+         * @param version The version of the interface (e.g. "1.0.0"), can be an empty string
+         * @param properties To (meta) properties to provide with the service
+         * @return the DM Component reference for chaining (fluent API)
+         */
+        template<class I> Component<T>& addInterface(const std::string version, const Properties properties = Properties{});
+
+        /**
+         * Adds a C++ interface to provide as service to the Celix framework.
+         *
+         * @param serviceName The service name to use
+         * @param version The version of the interface (e.g. "1.0.0"), can be an empty string
+         * @param properties To (meta) properties to provide with the service
+         * @return the DM Component reference for chaining (fluent API)
+         */
+        Component<T>& addInterface(const std::string serviceName, const std::string version = std::string{}, const Properties properties = Properties{});
+
+        /**
+         * Adds a C interface to provide as service to the Celix framework.
+         *
+         * @param svc The service struct
+         * @param serviceName The service name to use
+         * @param version The version of the interface (e.g. "1.0.0"), can be an empty string
+         * @param properties To (meta) properties to provide with the service
+         */
+        Component<T>& addCInterface(const void* svc, const std::string serviceName, const std::string version = std::string{}, const Properties properties = Properties{});
+
+
+        /**
+         * Creates and adds a C++ service dependency to the component
+         *
+         * @return the Service Dependency reference for chaining (fluent API)
+         */
+        template<class I>
+        ServiceDependency<T,I>& createServiceDependency(const std::string name = std::string{});
+
+        /**
+         Creates and adds a C++ service dependency to the component
+         *
+         * @return the DM Component reference for chaining (fluent API)
+         */
+        template<class I>
+        Component<T>& remove(ServiceDependency<T,I>& dep);
+
+        /**
+         * Adds a C service dependency to the component
+         *
+         * @return the DM Component reference for chaining (fluent API)
+         */
+        template<typename I>
+        CServiceDependency<T,I>& createCServiceDependency(const std::string name);
+
+        /**
+         * Removes a C service dependency to the component
+         *
+         * @return the DM Component reference for chaining (fluent API)
+         */
+        template<typename I>
+        Component<T>& remove(CServiceDependency<T,I>& dep);
+
+        /**
+         * Set the callback for the component life cycle control
+         *
+         * @param init The init callback.
+         * @param start The start callback.
+         * @param stop The stop callback.
+         * @param deinit The deinit callback.
+         *
+         * @return the DM Component reference for chaining (fluent API)
+         */
+        Component<T>& setCallbacks(
+            void (T::*init)(),
+            void (T::*start)(),
+            void (T::*stop)(),
+            void (T::*deinit)()
+        );
+    };
+}}
+
+#include "celix/dm/Component_Impl.h"
+
+#endif //CELIX_DM_COMPONENT_H
diff --git a/dependency_manager_cxx/include/celix/dm/Component_Impl.h b/dependency_manager_cxx/include/celix/dm/Component_Impl.h
new file mode 100644
index 0000000..d2fcf94
--- /dev/null
+++ b/dependency_manager_cxx/include/celix/dm/Component_Impl.h
@@ -0,0 +1,231 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "celix/dm/Component.h"
+#include "celix/dm/DependencyManager.h"
+#include "celix/dm/ServiceDependency.h"
+
+#include <memory>
+#include <iostream>
+
+using namespace celix::dm;
+
+template<class T>
+Component<T>::Component(const bundle_context_pt context, std::string name) : BaseComponent(context, name) {}
+
+template<class T>
+Component<T>::~Component() {
+    this->dependencies.clear();
+}
+
+template<class T>
+template<class I>
+Component<T>& Component<T>::addInterface(const std::string version, const Properties props) {
+    std::string name = typeName<I>();
+    if (name.empty()) {
+        std::cerr << "Cannot add interface, because type name could not be inferred. function: '" << __PRETTY_FUNCTION__ << "'\n";
+    } else {
+        this->addInterface(name, version.c_str(), props);
+    }
+    return *this;
+}
+
+template<class T>
+Component<T>& Component<T>::addInterface(const std::string serviceName, const std::string version, const Properties properties) {
+    properties_pt cProperties = properties_create();
+    properties_set(cProperties, CELIX_FRAMEWORK_SERVICE_LANGUAGE, CELIX_FRAMEWORK_SERVICE_CXX_LANGUAGE);
+    for (auto iter = properties.begin(); iter != properties.end(); iter++) {
+        properties_set(cProperties, (char*)iter->first.c_str(), (char*)iter->second.c_str());
+    }
+
+    const char *cVersion = version.empty() ? nullptr : version.c_str();
+    component_addInterface(this->cComponent(), (char*)serviceName.c_str(), (char*)cVersion, &this->getInstance(), cProperties);
+
+    return *this;
+};
+
+template<class T>
+Component<T>& Component<T>::addCInterface(const void* svc, const std::string serviceName, const std::string version, const Properties properties) {
+    properties_pt cProperties = properties_create();
+    properties_set(cProperties, CELIX_FRAMEWORK_SERVICE_LANGUAGE, CELIX_FRAMEWORK_SERVICE_C_LANGUAGE);
+    for (auto iter = properties.begin(); iter != properties.end(); iter++) {
+        properties_set(cProperties, (char*)iter->first.c_str(), (char*)iter->second.c_str());
+    }
+
+    const char *cVersion = version.empty() ? nullptr : version.c_str();
+    component_addInterface(this->cComponent(), (char*)serviceName.c_str(), (char*)cVersion, svc, cProperties);
+
+    return *this;
+};
+
+template<class T>
+template<class I>
+ServiceDependency<T,I>& Component<T>::createServiceDependency(const std::string name) {
+#ifdef __EXCEPTIONS
+    auto dep = std::shared_ptr<ServiceDependency<T,I>> {new ServiceDependency<T,I>()};
+#else
+    static ServiceDependency<T,I> invalidDep{std::string{}, false};
+    auto dep = std::shared_ptr<ServiceDependency<T,I>> {new(std::nothrow) ServiceDependency<T,I>(name)};
+    if (dep == nullptr) {
+        return invalidDep;
+    }
+#endif
+    this->dependencies.push_back(dep);
+    component_addServiceDependency(cComponent(), dep->cServiceDependency());
+    dep->setComponentInstance(&getInstance());
+    return *dep;
+}
+
+template<class T>
+template<class I>
+Component<T>& Component<T>::remove(ServiceDependency<T,I>& dep) {
+    component_removeServiceDependency(cComponent(), dep.cServiceDependency());
+    this->dependencies.remove(dep);
+    return *this;
+}
+
+template<class T>
+template<typename I>
+CServiceDependency<T,I>& Component<T>::createCServiceDependency(const std::string name) {
+#ifdef __EXCEPTIONS
+    auto dep = std::shared_ptr<CServiceDependency<T,I>> {new CServiceDependency<T,I>()};
+#else
+    static CServiceDependency<T,I> invalidDep{std::string{}, false};
+    auto dep = std::shared_ptr<CServiceDependency<T,I>> {new(std::nothrow) CServiceDependency<T,I>(name)};
+    if (dep == nullptr) {
+        return invalidDep;
+    }
+#endif
+    this->dependencies.push_back(dep);
+    component_addServiceDependency(cComponent(), dep->cServiceDependency());
+    dep->setComponentInstance(&getInstance());
+    return *dep;
+}
+
+template<class T>
+template<typename I>
+Component<T>& Component<T>::remove(CServiceDependency<T,I>& dep) {
+    component_removeServiceDependency(cComponent(), dep.cServiceDependency());
+    this->dependencies.remove(dep);
+    return *this;
+}
+
+template<class T>
+Component<T>* Component<T>::create(bundle_context_pt context, std::string name) {
+    std::string n = name.empty() ? typeName<T>() : name;
+#ifdef __EXCEPTIONS
+    Component<T>* cmp = new Component<T>{context, n};
+#else
+    static Component<T> invalid{nullptr, std::string{}};
+    Component<T>* cmp = new(std::nothrow) Component<T>(context, n);
+    if (cmp == nullptr) {
+        cmp = &invalid;
+    }
+#endif
+    return cmp;
+}
+
+template<class T>
+bool Component<T>::isValid() const {
+    return this->bundleContext() != nullptr;
+}
+
+template<class T>
+T& Component<T>::getInstance() {
+    if (this->refInstance.size() == 1) {
+        return refInstance.front();
+    } else {
+        if (this->instance.get() == nullptr) {
+#ifdef __EXCEPTIONS
+            this->instance = std::shared_ptr<T> {new T()};
+#else
+            this->instance = std::shared_ptr<T> {new(std::nothrow) T()};
+
+#endif
+        }
+        return *this->instance;
+    }
+}
+
+template<class T>
+Component<T>& Component<T>::setInstance(std::shared_ptr<T> inst) {
+    this->instance = inst;
+    return *this;
+}
+
+template<class T>
+Component<T>& Component<T>::setInstance(T&& inst) {
+    this->refInstance.clear();
+    this->refInstance.push_back(std::move(inst));
+    return *this;
+}
+
+template<class T>
+Component<T>& Component<T>::setCallbacks(
+            void (T::*init)(),
+            void (T::*start)(),
+            void (T::*stop)(),
+            void (T::*deinit)() ) {
+
+    this->initFp = init;
+    this->startFp = start;
+    this->stopFp = stop;
+    this->deinitFp = deinit;
+
+    int (*cInit)(void *) = [](void *handle) {
+        Component<T>* cmp = (Component<T>*)(handle);
+        T* inst = &cmp->getInstance();
+        void (T::*fp)() = cmp->initFp;
+        if (fp != nullptr) {
+            (inst->*fp)();
+        }
+        return 0;
+    };
+    int (*cStart)(void *) = [](void *handle) {
+        Component<T>* cmp = (Component<T>*)(handle);
+        T* inst = &cmp->getInstance();
+        void (T::*fp)() = cmp->startFp;
+        if (fp != nullptr) {
+            (inst->*fp)();
+        }
+        return 0;
+    };
+    int (*cStop)(void *) = [](void *handle) {
+        Component<T>* cmp = (Component<T>*)(handle);
+        T* inst = &cmp->getInstance();
+        void (T::*fp)() = cmp->stopFp;
+        if (fp != nullptr) {
+            (inst->*fp)();
+        }
+        return 0;
+    };
+    int (*cDeinit)(void *) = [](void *handle) {
+        Component<T>* cmp = (Component<T>*)(handle);
+        T* inst = &cmp->getInstance();
+        void (T::*fp)() = cmp->deinitFp;
+        if (fp != nullptr) {
+            (inst->*fp)();
+        }
+        return 0;
+    };
+
+    component_setCallbacks(this->cComponent(), cInit, cStart, cStop, cDeinit);
+
+    return *this;
+}
diff --git a/dependency_manager_cxx/include/celix/dm/DependencyManager.h b/dependency_manager_cxx/include/celix/dm/DependencyManager.h
new file mode 100644
index 0000000..1991c9d
--- /dev/null
+++ b/dependency_manager_cxx/include/celix/dm/DependencyManager.h
@@ -0,0 +1,78 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef CELIX_DEPENDENCYMANAGER_H
+#define CELIX_DEPENDENCYMANAGER_H
+
+
+#include "celix/dm/types.h"
+#include "celix/dm/Component.h"
+#include "celix/dm/ServiceDependency.h"
+
+extern "C" {
+#include "bundle_context.h"
+#include "dm_dependency_manager.h"
+}
+
+#include <list>
+
+namespace celix { namespace dm {
+
+    class DependencyManager {
+    private:
+        bundle_context_pt context = {nullptr};
+        std::list<std::unique_ptr<BaseComponent>> components {};
+        dm_dependency_manager_pt cDepMan {nullptr};
+    public:
+        DependencyManager(bundle_context_pt context);
+        virtual ~DependencyManager();
+
+        const bundle_context_pt bundleContext() const;
+        const dm_dependency_manager_pt cDependencyManager() const;
+
+        /**
+         * Creates and adds a new DM Component for a component of type T and instance inst
+         * If inst if nullptr lazy initializion is used.
+         *
+         * @return Returns a reference to the DM Component
+         */
+        template<class T>
+        Component<T>& createComponent(std::shared_ptr<T> inst = std::shared_ptr<T>{nullptr}) {
+            Component<T>* cmp = Component<T>::create(this->context);;
+            if (cmp->isValid()) {
+                cmp->setInstance(inst);
+                this->components.push_back(std::unique_ptr<BaseComponent> {cmp});
+            }
+            return *cmp;
+        }
+
+        /**
+         * Starts the Dependency Manager
+         */
+        void start();
+
+        /**
+         * Stops the Dependency Manager
+         */
+        void stop();
+    };
+
+}}
+
+#endif //CELIX_DEPENDENCYMANAGER_H
diff --git a/dependency_manager_cxx/include/celix/dm/DmActivator.h b/dependency_manager_cxx/include/celix/dm/DmActivator.h
new file mode 100644
index 0000000..57f2f97
--- /dev/null
+++ b/dependency_manager_cxx/include/celix/dm/DmActivator.h
@@ -0,0 +1,72 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef CELIX_DM_ACTIVATOR_H
+#define CELIX_DM_ACTIVATOR_H
+
+#include "celix/dm/DependencyManager.h"
+
+namespace celix { namespace dm {
+
+    class DmActivator {
+    protected:
+        DependencyManager& depMng;
+        DmActivator(DependencyManager& mng) : depMng(mng) {}
+    public:
+        ~DmActivator() = default;
+
+        DependencyManager& manager() const { return this->depMng; }
+
+        /**
+         * The init of the DM Activator. Should be overridden by the bundle specific DM activator.
+         *
+         * @param manager A reference to the  Dependency Manager
+         */
+        virtual void init() {};
+
+        /**
+         * The init of the DM Activator. Can be overridden by the bundle specific DM activator.
+         *
+         * @param manager A reference to the  Dependency Manager
+         */
+        virtual void deinit() {};
+
+        /**
+         * Creates and adds a new DM Component for a component of type T.
+         * If inst is provided the DM Component will manage provided instance.
+         * If inst is not provided (nullptr) the DM Component will lazy contsruct a new instance if needed.
+         *
+         * @return Returns a reference to the DM Component
+         */
+        template< class T>
+        Component<T>& createComponent(std::shared_ptr<T> inst = std::shared_ptr<T>{nullptr}) { return depMng.createComponent<T>(inst); }
+
+        /**
+         * The static method to create a new DM activator.
+         * NOTE that this method in intentionally not implemented in the C++ Dependency Manager library.
+         * This should be done by the bundle specific DM activator.
+         *
+         * @param mng A reference to the Dependency Manager
+         * @returns A pointer to a DmActivator. The Dependency Manager is responsible for deleting the pointer when the bundle is stopped.
+         */
+        static DmActivator* create(DependencyManager& mng);
+    };
+}}
+
+#endif //CELIX_DM_ACTIVATOR_H
diff --git a/examples/producer_consumer/database/public/include/data.h b/dependency_manager_cxx/include/celix/dm/Properties.h
similarity index 67%
copy from examples/producer_consumer/database/public/include/data.h
copy to dependency_manager_cxx/include/celix/dm/Properties.h
index d5bd059..bb4fd78 100644
--- a/examples/producer_consumer/database/public/include/data.h
+++ b/dependency_manager_cxx/include/celix/dm/Properties.h
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0 
- * 
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -17,22 +17,14 @@
  * under the License.
  */
 
-/*
- * data.h
- *
- *  \date       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
+#ifndef CELIX_DM_PROPERTIES_H
+#define CELIX_DM_PROPERTIES_H
 
-#ifndef _DATA_H_
-#define _DATA_H_
+#include <map>
+#include <string>
 
-struct data {
-    int id;
-    char description[100];
-};
+namespace celix { namespace dm {
+    using Properties = std::map<std::string, std::string>;
+}}
 
-typedef struct data* data_pt;
-
-#endif
+#endif //CELIX_DM_PROPERTIES_H
diff --git a/dependency_manager_cxx/include/celix/dm/ServiceDependency.h b/dependency_manager_cxx/include/celix/dm/ServiceDependency.h
new file mode 100644
index 0000000..2d19200
--- /dev/null
+++ b/dependency_manager_cxx/include/celix/dm/ServiceDependency.h
@@ -0,0 +1,279 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef CELIX_DM_SERVICEDEPENDENCY_H
+#define CELIX_DM_SERVICEDEPENDENCY_H
+
+#include "dm_service_dependency.h"
+#include "celix/dm/types.h"
+
+#include <map>
+#include <string>
+#include <list>
+#include <tuple>
+#include <memory>
+#include <iostream>
+
+/**
+ * TODO add a dependency for a whiteboard pattern or marker service. e.g. a service where the type is irrelevant.
+ */
+
+namespace celix { namespace dm {
+
+    class DependencyManager; //forward declaration
+
+    enum class DependencyUpdateStrategy {
+        suspend,
+        locking
+    };
+
+    class BaseServiceDependency {
+    protected:
+        const bool valid;
+        dm_service_dependency_pt cServiceDep {nullptr};
+
+        void setDepStrategy(DependencyUpdateStrategy strategy);
+    public:
+        BaseServiceDependency(bool valid);
+
+        virtual ~BaseServiceDependency() = default;
+
+        /**
+         * Wether the service dependency is valid.
+         */
+        bool isValid() const { return valid; }
+
+        /**
+         * Returns the C DM service dependency
+         */
+        dm_service_dependency_pt cServiceDependency() const { return cServiceDep; }
+    };
+
+    template<class T>
+    class TypedServiceDependency :  public BaseServiceDependency {
+    protected:
+        T* componentInstance {nullptr};
+    public:
+        TypedServiceDependency(bool valid) : BaseServiceDependency(valid) {}
+        virtual ~TypedServiceDependency() = default;
+
+        /**
+         * Set the component instance with a pointer
+         */
+        void setComponentInstance(T* cmp) { componentInstance = cmp;}
+    };
+
+    template<class T, typename I>
+    class CServiceDependency : public TypedServiceDependency<T> {
+    private:
+        std::string name {};
+        std::string filter {};
+        std::string versionRange {};
+
+        void (T::*setFp)(const I* service) {nullptr};
+        void (T::*setFpWithProperties)(const I* service, Properties&& properties) {nullptr};
+
+        void (T::*addFp)(const I* service) {nullptr};
+        void (T::*addFpWithProperties)(const I* service, Properties&& properties) {nullptr};
+
+        void (T::*removeFp)(const I* service) {nullptr};
+        void (T::*removeFpWithProperties)(const I* service, Properties&& properties) {nullptr};
+
+        void setupCallbacks();
+        int invokeCallback(void(T::*fp)(const I*), const void* service);
+        int invokeCallbackWithProperties(void(T::*fp)(const I*, Properties&&), service_reference_pt  ref, const void* service);
+
+        void setupService();
+    public:
+        CServiceDependency(const std::string name, bool valid = true);
+        virtual ~CServiceDependency() = default;
+
+        /**
+         * Sets the service version range for the C service dependency.
+         *
+         * @param serviceVersionRange The service version range, can be an empty string
+         * @return the C service dependency reference for chaining (fluent API)
+         */
+        CServiceDependency<T,I>& setVersionRange(const std::string serviceVersionRange);
+
+        /**
+         * Sets the service filter for the C service dependency.
+         *
+         * @param filter The (additional) filter to use (e.g. "(location=front)")
+         * @return the C service dependency reference for chaining (fluent API)
+         */
+        CServiceDependency<T,I>& setFilter(const std::string filter);
+
+        /**
+         * Specify if the service dependency is required. Default is false
+         *
+         * @return the C service dependency reference for chaining (fluent API)
+         */
+        CServiceDependency<T,I>& setRequired(bool req);
+
+        /**
+         * Specify if the update strategy to use
+         *
+         * @return the C service dependency reference for chaining (fluent API)
+         */
+        CServiceDependency<T,I>& setStrategy(DependencyUpdateStrategy strategy);
+
+        /**
+         * Set the set callback for when the service dependency becomes available
+         *
+         * @return the C service dependency reference for chaining (fluent API)
+         */
+        CServiceDependency<T,I>& setCallbacks(void (T::*set)(const I* service));
+
+        /**
+         * Set the set callback for when the service dependency becomes available
+         *
+         * @return the C service dependency reference for chaining (fluent API)
+         */
+        CServiceDependency<T,I>& setCallbacks(void (T::*set)(const I* service, Properties&& properties));
+
+        /**
+         * Set the add and remove callback for when the services of service dependency are added or removed.
+         *
+         * @return the C service dependency reference for chaining (fluent API)
+         */
+        CServiceDependency<T,I>& setCallbacks( void (T::*add)(const I* service),  void (T::*remove)(const I* service));
+
+        /**
+         * Set the add and remove callback for when the services of service dependency are added or removed.
+         *
+         * @return the C service dependency reference for chaining (fluent API)
+         */
+        CServiceDependency<T,I>& setCallbacks(
+                void (T::*add)(const I* service, Properties&& properties),
+                void (T::*remove)(const I* service, Properties&& properties)
+        );
+
+        /**
+         * Specify if the service dependency should add a service.lang filter part if it is not already present
+         * For C service dependencies 'service.lang=C' will be added.
+         */
+        CServiceDependency<T,I>& setAddLanguageFilter(bool addLang);
+    };
+
+    template<class T, class I>
+    class ServiceDependency : public TypedServiceDependency<T> {
+    private:
+        bool addCxxLanguageFilter {true};
+        std::string name {};
+        std::string filter {};
+        std::string versionRange {};
+        std::string modifiedFilter {};
+
+        void (T::*setFp)(I* service) {nullptr};
+        void (T::*setFpWithProperties)(I* service, Properties&& properties) {nullptr};
+
+        void (T::*addFp)(I* service) {nullptr};
+        void (T::*addFpWithProperties)(I* service, Properties&& properties) {nullptr};
+
+        void (T::*removeFp)(I* service) {nullptr};
+        void (T::*removeFpWithProperties)(I* service, Properties&& properties) {nullptr};
+
+        void setupService();
+        void setupCallbacks();
+        int invokeCallback(void(T::*fp)(I*), const void* service);
+        int invokeCallbackWithProperties(void(T::*fp)(I*, Properties&&), service_reference_pt  ref, const void* service);
+    public:
+        ServiceDependency(const std::string name = std::string{}, bool valid = true);
+        virtual ~ServiceDependency() = default;
+
+        /**
+         * Set the service name of the service dependency.
+         *
+         * @return the C++ service dependency reference for chaining (fluent API)
+         */
+        ServiceDependency<T,I>& setName(const std::string name);
+
+        /**
+         * Set the service filter of the service dependency.
+         *
+         * @return the C++ service dependency reference for chaining (fluent API)
+         */
+        ServiceDependency<T,I>& setFilter(const std::string filter);
+
+        /**
+         * Set the service version range of the service dependency.
+         *
+         * @return the C++ service dependency reference for chaining (fluent API)
+         */
+        ServiceDependency<T,I>& setVersionRange(const std::string versionRange);
+
+        /**
+         * Set the set callback for when the service dependency becomes available
+         *
+         * @return the C++ service dependency reference for chaining (fluent API)
+         */
+        ServiceDependency<T,I>& setCallbacks(void (T::*set)(I* service));
+
+        /**
+         * Set the set callback for when the service dependency becomes available
+         *
+         * @return the C++ service dependency reference for chaining (fluent API)
+         */
+        ServiceDependency<T,I>& setCallbacks(void (T::*set)(I* service, Properties&& properties));
+
+        /**
+         * Set the add and remove callback for when the services of service dependency are added or removed.
+         *
+         * @return the C++ service dependency reference for chaining (fluent API)
+         */
+        ServiceDependency<T,I>& setCallbacks( void (T::*add)(I* service),  void (T::*remove)(I* service));
+
+        /**
+         * Set the add and remove callback for when the services of service dependency are added or removed.
+         *
+         * @return the C++ service dependency reference for chaining (fluent API)
+         */
+        ServiceDependency<T,I>& setCallbacks(
+                void (T::*add)(I* service, Properties&& properties),
+                void (T::*remove)(I* service, Properties&& properties)
+        );
+
+        /**
+         * Specify if the service dependency is required. Default is false
+         *
+         * @return the C service dependency reference for chaining (fluent API)
+         */
+        ServiceDependency<T,I>& setRequired(bool req);
+
+        /**
+         * Specify if the update strategy to use
+         *
+         * @return the C service dependency reference for chaining (fluent API)
+         */
+        ServiceDependency<T,I>& setStrategy(DependencyUpdateStrategy strategy);
+
+        /**
+         * Specify if the service dependency should add a service.lang filter part if it is not already present
+         * For C++ service dependencies 'service.lang=C++' will be added.
+         * Should be called before
+         */
+        ServiceDependency<T,I>& setAddLanguageFilter(bool addLang);
+    };
+}}
+
+#include "celix/dm/ServiceDependency_Impl.h"
+
+
+#endif //CELIX_DM_SERVICEDEPENDENCY_H
diff --git a/dependency_manager_cxx/include/celix/dm/ServiceDependency_Impl.h b/dependency_manager_cxx/include/celix/dm/ServiceDependency_Impl.h
new file mode 100644
index 0000000..2bc788d
--- /dev/null
+++ b/dependency_manager_cxx/include/celix/dm/ServiceDependency_Impl.h
@@ -0,0 +1,443 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <vector>
+#include <iostream>
+#include "constants.h"
+
+using namespace celix::dm;
+
+template<class T, typename I>
+CServiceDependency<T,I>::CServiceDependency(const std::string name, bool valid) : TypedServiceDependency<T>(valid) {
+    this->name = name;
+    this->setupService();
+}
+
+template<class T, typename I>
+CServiceDependency<T,I>& CServiceDependency<T,I>::setVersionRange(const std::string serviceVersionRange) {
+    this->versionRange = serviceVersionRange;
+    this->setupService();
+    return *this;
+}
+
+template<class T, typename I>
+CServiceDependency<T,I>& CServiceDependency<T,I>::setFilter(const std::string filter) {
+    this->filter = filter;
+    this->setupService();
+    return *this;
+}
+
+template<class T, typename I>
+void CServiceDependency<T,I>::setupService() {
+    if (!this->valid) {
+        return;
+    }
+    const char* cversion = this->versionRange.empty() ? nullptr : versionRange.c_str();
+    const char* cfilter = filter.empty() ? nullptr : filter.c_str();
+    serviceDependency_setService(this->cServiceDependency(), this->name.c_str(), cversion, cfilter);
+};
+
+template<class T, typename I>
+CServiceDependency<T,I>& CServiceDependency<T,I>::setAddLanguageFilter(bool addLang) {
+    if (!this->valid) {
+        *this;
+    }
+    serviceDependency_setAddCLanguageFilter(this->cServiceDependency(), addLang);
+    this->setupService();
+    return *this;
+};
+
+template<class T, typename I>
+CServiceDependency<T,I>& CServiceDependency<T,I>::setRequired(bool req) {
+    if (!this->valid) {
+        return *this;
+    }
+    serviceDependency_setRequired(this->cServiceDependency(), req);
+    return *this;
+}
+
+template<class T, typename I>
+CServiceDependency<T,I>& CServiceDependency<T,I>::setStrategy(DependencyUpdateStrategy strategy) {
+    if (!this->valid) {
+        return *this;
+    }
+    this->setDepStrategy(strategy);
+    return *this;
+}
+
+//set callbacks
+template<class T, typename I>
+CServiceDependency<T,I>& CServiceDependency<T,I>::setCallbacks(void (T::*set)(const I* service)) {
+    this->setFp = set;
+    this->setupCallbacks();
+    return *this;
+}
+
+template<class T, typename I>
+CServiceDependency<T,I>& CServiceDependency<T,I>::setCallbacks(void (T::*set)(const I* service, Properties&& properties)) {
+    this->setFpWithProperties = set;
+    this->setupCallbacks();
+    return *this;
+}
+
+//add remove callbacks
+template<class T, typename I>
+CServiceDependency<T,I>& CServiceDependency<T,I>::setCallbacks(
+        void (T::*add)(const I* service),
+        void (T::*remove)(const I* service)) {
+    this->addFp = add;
+    this->removeFp = remove;
+    this->setupCallbacks();
+    return *this;
+}
+
+template<class T, typename I>
+CServiceDependency<T,I>& CServiceDependency<T,I>::setCallbacks(
+        void (T::*add)(const I* service, Properties&& properties),
+        void (T::*remove)(const I* service, Properties&& properties)
+) {
+    this->addFpWithProperties = add;
+    this->removeFpWithProperties = remove;
+    this->setupCallbacks();
+    return *this;
+}
+
+
+template<class T, typename I>
+void CServiceDependency<T,I>::setupCallbacks() {
+    if (!this->valid) {
+        return;
+    }
+
+    int(*cset)(void*,const void*) {nullptr};
+    int(*cadd)(void*, const void*) {nullptr};
+    int(*cremove)(void*, const void*) {nullptr};
+
+
+    if (setFp != nullptr) {
+        cset = [](void* handle, const void* service) -> int {
+            auto dep = (CServiceDependency<T,I>*) handle;
+            return dep->invokeCallback(dep->setFp, service);
+        };
+    }
+    if (addFp != nullptr) {
+        cadd = [](void* handle, const void* service) -> int {
+            auto dep = (CServiceDependency<T,I>*) handle;
+            return dep->invokeCallback(dep->addFp, service);
+        };
+    }
+    if (removeFp != nullptr) {
+        cremove = [](void* handle, const void* service) -> int {
+            auto dep = (CServiceDependency<T,I>*) handle;
+            return dep->invokeCallback(dep->removeFp, service);
+        };
+    }
+
+    int(*csetWithRef)(void*, service_reference_pt, const void*) {nullptr};
+    int(*caddWithRef)(void*, service_reference_pt, const void*) {nullptr};
+    int(*cremoveWithRef)(void*, service_reference_pt, const void*) {nullptr};
+
+    if (setFpWithProperties != nullptr) {
+        csetWithRef = [](void* handle, service_reference_pt ref, const void* service) -> int {
+            auto dep = (CServiceDependency<T,I>*) handle;
+            return dep->invokeCallbackWithProperties(dep->setFpWithProperties, ref, service);
+        };
+    }
+    if (addFpWithProperties != nullptr) {
+        caddWithRef = [](void* handle, service_reference_pt ref, const void* service) -> int {
+            auto dep = (CServiceDependency<T,I>*) handle;
+            return dep->invokeCallbackWithProperties(dep->addFpWithProperties, ref, service);
+        };
+    }
+    if (removeFpWithProperties != nullptr) {
+        cremoveWithRef = [](void* handle, service_reference_pt ref, const void* service) -> int {
+            auto dep = (CServiceDependency<T,I>*) handle;
+            return dep->invokeCallbackWithProperties(dep->removeFpWithProperties, ref, service);
+        };
+    }
+
+    serviceDependency_setCallbackHandle(this->cServiceDependency(), this);
+    serviceDependency_setCallbacks(this->cServiceDependency(), cset, cadd, nullptr, cremove, nullptr);
+    serviceDependency_setCallbacksWithServiceReference(this->cServiceDependency(), csetWithRef, caddWithRef, nullptr, cremoveWithRef, nullptr);
+};
+
+template<class T, typename I>
+int CServiceDependency<T,I>::invokeCallback(void(T::*fp)(const I*), const void* service) {
+    T *cmp = this->componentInstance;
+    const I* srv = (const I*) service;
+    (cmp->*fp)(srv);
+    return 0;
+};
+
+template<class T, typename I>
+int CServiceDependency<T,I>::invokeCallbackWithProperties(void(T::*fp)(const I*, Properties&&), service_reference_pt  ref, const void* service) {
+    service_registration_pt reg {nullptr};
+    properties_pt props {nullptr};
+    T *cmp = this->componentInstance;
+    serviceReference_getServiceRegistration(ref, &reg);
+    serviceRegistration_getProperties(reg, &props);
+
+    Properties properties {};
+    const char* key {nullptr};
+    const char* value {nullptr};
+
+    hash_map_iterator_t iter = hashMapIterator_construct((hash_map_pt)props);
+    while(hashMapIterator_hasNext(&iter)) {
+        key = (const char*) hashMapIterator_nextKey(&iter);
+        value = properties_get(props, key);
+        //std::cout << "got property " << key << "=" << value << "\n";
+        properties[key] = value;
+    }
+
+    const I* srv = (const I*) service;
+
+    (cmp->*fp)(srv, static_cast<Properties&&>(properties)); //explicit move of lvalue properties.
+    return 0;
+}
+
+template<class T, class I>
+ServiceDependency<T,I>::ServiceDependency(std::string name, bool valid) : TypedServiceDependency<T>(valid) {
+    if (!name.empty()) {
+        this->setName(name);
+    } else {
+        this->setupService();
+    }
+};
+
+template<class T, class I>
+void ServiceDependency<T,I>::setupService() {
+    if (!this->valid) {
+        return;
+    }
+
+    std::string n = name;
+
+    if (n.empty()) {
+        n = typeName<I>();
+        if (n.empty()) {
+            std::cerr << "Error in service dependency. Type name cannot be inferred, using '<TYPE_NAME_ERROR>'. function: '" << __PRETTY_FUNCTION__ << "'\n";
+            n = "<TYPE_NAME_ERROR>";
+        }
+    }
+
+    const char* v =  versionRange.empty() ? nullptr : versionRange.c_str();
+
+
+    if (this->addCxxLanguageFilter) {
+
+        char langFilter[128];
+        snprintf(langFilter, sizeof(langFilter), "(%s=%s)", CELIX_FRAMEWORK_SERVICE_LANGUAGE,
+                 CELIX_FRAMEWORK_SERVICE_CXX_LANGUAGE);
+
+        //setting modified filter. which is in a filter including a lang=c++
+        modifiedFilter = std::string{langFilter};
+        if (!filter.empty()) {
+            char needle[128];
+            snprintf(needle, sizeof(needle), "(%s=", CELIX_FRAMEWORK_SERVICE_LANGUAGE);
+            size_t langFilterPos = filter.find(needle);
+            if (langFilterPos != std::string::npos) {
+                //do nothing filter already contains a language part.
+            } else if (strncmp(filter.c_str(), "(&", 2) == 0 && filter[filter.size() - 1] == ')') {
+                modifiedFilter = filter.substr(0, filter.size() - 1); //remove closing ')'
+                modifiedFilter = modifiedFilter.append(langFilter);
+                modifiedFilter = modifiedFilter.append(")"); //add closing ')'
+            } else if (filter[0] == '(' && filter[filter.size() - 1] == ')') {
+                modifiedFilter = "(&";
+                modifiedFilter = modifiedFilter.append(filter);
+                modifiedFilter = modifiedFilter.append(langFilter);
+                modifiedFilter = modifiedFilter.append(")");
+            } else {
+                std::cerr << "Unexpected filter layout: '" << filter << "'\n";
+            }
+        }
+    } else {
+        this->modifiedFilter = this->filter;
+    }
+
+    serviceDependency_setService(this->cServiceDependency(), n.c_str(), v, this->modifiedFilter.c_str());
+}
+
+template<class T, class I>
+ServiceDependency<T,I>& ServiceDependency<T,I>::setName(std::string name) {
+    this->name = name;
+    setupService();
+    return *this;
+};
+
+template<class T, class I>
+ServiceDependency<T,I>& ServiceDependency<T,I>::setFilter(std::string filter) {
+    this->filter = filter;
+    setupService();
+    return *this;
+};
+
+template<class T, class I>
+ServiceDependency<T,I>& ServiceDependency<T,I>::setVersionRange(std::string versionRange) {
+    this->versionRange = versionRange;
+    setupService();
+    return *this;
+};
+
+
+template<class T, class I>
+ServiceDependency<T,I>& ServiceDependency<T,I>::setAddLanguageFilter(bool addLang) {
+    this->addCxxLanguageFilter = addLang;
+    setupService();
+    return *this;
+};
+
+//set callbacks
+template<class T, class I>
+ServiceDependency<T,I>& ServiceDependency<T,I>::setCallbacks(void (T::*set)(I* service)) {
+    this->setFp = set;
+    this->setupCallbacks();
+    return *this;
+}
+
+template<class T, class I>
+ServiceDependency<T,I>& ServiceDependency<T,I>::setCallbacks(void (T::*set)(I* service, Properties&& properties)) {
+    this->setFpWithProperties = set;
+    this->setupCallbacks();
+    return *this;
+}
+
+//add remove callbacks
+template<class T, class I>
+ServiceDependency<T,I>& ServiceDependency<T,I>::setCallbacks(
+        void (T::*add)(I* service),
+        void (T::*remove)(I* service)) {
+    this->addFp = add;
+    this->removeFp = remove;
+    this->setupCallbacks();
+    return *this;
+}
+
+template<class T, class I>
+ServiceDependency<T,I>& ServiceDependency<T,I>::setCallbacks(
+        void (T::*add)(I* service, Properties&& properties),
+        void (T::*remove)(I* service, Properties&& properties)
+        ) {
+    this->addFpWithProperties = add;
+    this->removeFpWithProperties = remove;
+    this->setupCallbacks();
+    return *this;
+}
+
+template<class T, class I>
+ServiceDependency<T,I>& ServiceDependency<T,I>::setRequired(bool req) {
+    serviceDependency_setRequired(this->cServiceDependency(), req);
+    return *this;
+}
+
+template<class T, class I>
+ServiceDependency<T,I>& ServiceDependency<T,I>::setStrategy(DependencyUpdateStrategy strategy) {
+    this->setDepStrategy(strategy);
+    return *this;
+};
+
+template<class T, class I>
+int ServiceDependency<T,I>::invokeCallback(void(T::*fp)(I*), const void* service) {
+    T *cmp = this->componentInstance;
+    I *svc = (I *) service;
+    (cmp->*fp)(svc);
+    return 0;
+};
+
+template<class T, class I>
+int ServiceDependency<T,I>::invokeCallbackWithProperties(void(T::*fp)(I*, Properties&&), service_reference_pt  ref, const void* service) {
+    service_registration_pt reg {nullptr};
+    properties_pt props {nullptr};
+    T *cmp = this->componentInstance;
+    I *svc = (I *) service;
+    serviceReference_getServiceRegistration(ref, &reg);
+    serviceRegistration_getProperties(reg, &props);
+
+    Properties properties {};
+    const char* key {nullptr};
+    const char* value {nullptr};
+
+    hash_map_iterator_t iter = hashMapIterator_construct((hash_map_pt)props);
+    while(hashMapIterator_hasNext(&iter)) {
+        key = (const char*) hashMapIterator_nextKey(&iter);
+        value = properties_get(props, key);
+        //std::cout << "got property " << key << "=" << value << "\n";
+        properties[key] = value;
+    }
+
+    (cmp->*fp)(svc, static_cast<Properties&&>(properties)); //explicit move of lvalue properties.
+    return 0;
+}
+
+template<class T, class I>
+void ServiceDependency<T,I>::setupCallbacks() {
+    if (!this->valid) {
+        return;
+    }
+
+    int(*cset)(void*,const void*) {nullptr};
+    int(*cadd)(void*, const void*) {nullptr};
+    int(*cremove)(void*, const void*) {nullptr};
+
+
+    if (setFp != nullptr) {
+        cset = [](void* handle, const void*service) -> int {
+            auto dep = (ServiceDependency<T, I> *) handle;
+            return dep->invokeCallback(dep->setFp, service);
+        };
+    }
+    if (addFp != nullptr) {
+        cadd = [](void* handle, const void*service) -> int {
+            auto dep = (ServiceDependency<T, I> *) handle;
+            return dep->invokeCallback(dep->addFp, service);
+        };
+    }
+    if (removeFp != nullptr) {
+        cremove = [](void* handle, const void*service) -> int {
+            auto dep = (ServiceDependency<T, I> *) handle;
+            return dep->invokeCallback(dep->removeFp, service);
+        };
+    }
+
+    int(*csetWithRef)(void*, service_reference_pt, const void*) {nullptr};
+    int(*caddWithRef)(void*, service_reference_pt, const void*) {nullptr};
+    int(*cremoveWithRef)(void*, service_reference_pt, const void*) {nullptr};
+
+    if (setFpWithProperties != nullptr) {
+        csetWithRef = [](void* handle, service_reference_pt ref, const void* service) -> int {
+            auto dep = (ServiceDependency<T,I>*) handle;
+            return dep->invokeCallbackWithProperties(dep->setFpWithProperties, ref, service);
+        };
+    }
+    if (addFpWithProperties != nullptr) {
+        caddWithRef = [](void* handle, service_reference_pt ref, const void* service) -> int {
+            auto dep = (ServiceDependency<T,I>*) handle;
+            return dep->invokeCallbackWithProperties(dep->addFpWithProperties, ref, service);
+        };
+    }
+    if (removeFpWithProperties != nullptr) {
+        cremoveWithRef = [](void* handle, service_reference_pt ref, const void* service) -> int {
+            auto dep = (ServiceDependency<T,I>*) handle;
+            return dep->invokeCallbackWithProperties(dep->removeFpWithProperties, ref, service);
+        };
+    }
+
+    serviceDependency_setCallbackHandle(this->cServiceDependency(), this);
+    serviceDependency_setCallbacks(this->cServiceDependency(), cset, cadd, nullptr, cremove, nullptr);
+    serviceDependency_setCallbacksWithServiceReference(this->cServiceDependency(), csetWithRef, caddWithRef, nullptr, cremoveWithRef, nullptr);
+};
diff --git a/dependency_manager_cxx/include/celix/dm/types.h b/dependency_manager_cxx/include/celix/dm/types.h
new file mode 100644
index 0000000..e1f33d9
--- /dev/null
+++ b/dependency_manager_cxx/include/celix/dm/types.h
@@ -0,0 +1,91 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef CELIX_DM_TYPES_H
+#define CELIX_DM_TYPES_H
+
+#include <map>
+#include <string>
+#include <list>
+#include <tuple>
+#include <typeinfo>
+#include <memory>
+#include <cxxabi.h>
+#include <string.h>
+#include "celix/dm/Properties.h"
+#include <stdlib.h>
+#include <iostream>
+
+namespace celix { namespace dm {
+    //forward declarations
+    class DependencyManager;
+
+
+    class BaseServiceDependency;
+
+    template<class T, typename I>
+    class CServiceDependency;
+
+    template<class T, class I>
+    class ServiceDependency;
+
+    /**
+     * Returns the deferred type name for the template I
+     */
+    template<typename INTERFACE_TYPENAME>
+    const std::string typeName() {
+        std::string result;
+
+#ifdef __GXX_RTTI
+        result = typeid(INTERFACE_TYPENAME).name();
+        int status = 0;
+        char* demangled_name {abi::__cxa_demangle(result.c_str(), NULL, NULL, &status)};
+        if(status == 0) {
+            result = std::string{demangled_name};
+            free(demangled_name);
+        }
+#else
+        const char *templateStr = "INTERFACE_TYPENAME =";
+        const size_t templateStrLen = strlen(templateStr);
+
+        result = __PRETTY_FUNCTION__; //USING pretty function to retrieve the filled in template argument without using typeid()
+
+        size_t bpos = result.find(templateStr) + templateStrLen + 1; //find begin pos after INTERFACE_TYPENAME = entry
+        size_t epos = bpos;
+        while (isalnum(result[epos]) || result[epos] == '_' || result[epos] == ';') {
+            epos += 1;
+        }
+        size_t len = epos - bpos;
+        result = result.substr(bpos, len);
+#endif
+
+        //std::cout << "PRETTY IS '" << __PRETTY_FUNCTION__ << "'\n";
+        //std::cout << "RESULT IS '" << result << "'\n";
+
+        if (result.empty()) {
+            std::cerr << "Cannot infer type name in function call '" << __PRETTY_FUNCTION__ << "'\n'";
+        }
+
+
+        return result;
+    }
+
+}}
+
+#endif //CELIX_DM_TYPES_H
diff --git a/dependency_manager_cxx/readme.md b/dependency_manager_cxx/readme.md
new file mode 100644
index 0000000..14eb333
--- /dev/null
+++ b/dependency_manager_cxx/readme.md
@@ -0,0 +1,62 @@
+# Apache Celix C++ Dependency Manager
+
+## Introduction
+
+The C++ Dependency Manager contains a static library which can be used to manage (dynamic) services on a higher abstraction level in a declarative style. 
+The Apache Celix C++ Dependency Manager is inspired by the [Apache Felix Dependency Manager](http://felix.apache.org/documentation/subprojects/apache-felix-dependency-manager.html).
+
+The C++ Dependency Manager uses fluent interface to make specifying DM components and service dependencies very concise and relies on features introduced in C++11.
+
+## C++ and C Dependency Manager
+
+The C++ Dependency Manager is build on top of the C Dependency Manager.
+To get a good overview of the C++ Dependency Manager please read the [Dependency Manager documentation](../dependency_manager/README.md)
+
+## DM Parts
+
+The C++ Dependency Manager consist out of four main parts: `celix::dm::DmActivator`, `celix::dm::DependencyManager`, `celix::dm::Component` and `celix::dm::ServiceDependency`.
+
+### DmActivator
+
+The `DmActivator` class should be inherited by a bundle specific Activator. 
+
+- The static `DmActivator::create` method needs to be implemented and should return a bundle specific subclass instance of the DmActivator.
+- The `DmActivator::init` method should be overridden and can be used to specify which components to use in the bundle.
+- The `DmActivator::deinit` method can be overridden if some cleanup is needed when a bundle is stopped.
+
+### Dependency Manager
+
+The `DependencyManager` act as an entry point to create (DM) Components.
+
+### Component
+
+The (DM) `Component` manages the life cycle of a component (of the template type T). For example, when all required service dependencies are available the `Component` will call the `start` specified callback function of the component.
+
+The `Component::setInstance` can be used to set the component instance to used. If no instance is set the (DM) `Component` will (lazy) create a component instance using the default constructor.
+The `Component::addInterface` can be used to specify one additional C service provided by the component.
+The `Component::addCInterface` can be used to specify one additional C++ service provided by the component.
+The template method `Component::createServiceDependency` can be used to specify one additional typed C++ service dependency.
+The template method `Component::createCServiceDependency` can be used to specify one additional typed C service dependency.
+
+### ServiceDependency and CServiceDependency
+
+The (DM) `ServiceDependency` can be used to specify C++ service dependencies for a component.
+The (DM) `CServiceDependency` can be used to specify C service dependencies for a component.
+
+When these dependencies are set to required the `Component` will ensure that components will only be started when all required dependencies are available and stop the component if any of the required dependencies are removed.
+This feature should prevent a lot of boiler plating code compared to using a service tracker or services references directly. 
+
+A service dependency update strategy can also be specified (suspend or locking. Default this strategy is set to `DependencyUpdateStrategy::suspend` this strategy will stop and start (suspend) a component when any of the specified service dependencies changes (are removed, added or modified).
+When correctly used this strategy removes the need for locking services during updates/invocation. See the dependency manager_cxx example for more details.
+
+The `(C)ServiceDependency::setCallbacks` function can be used to specify the function callback used when services are added, set, removed or modified. 
+The `(C)ServiceDependency::setRequired` function can be used to specify if a service dependency is required.
+The `(C)ServiceDependency::setStrategy` function can be used to specify a service dependency update strategy (suspend or locking).
+
+### References
+
+For more information examples please see
+
+- [The C++ Dependency Manager API](include/celix/dm): The c++ dependency manager header files
+- [Dm C++ example](../examples/dm_example_cxx): A DM C++ example.
+- [Best practices](../documents/best_practices/readme.md): A introduction how to work with services using the C dependency manager
diff --git a/dependency_manager_cxx/src/Component.cc b/dependency_manager_cxx/src/Component.cc
new file mode 100644
index 0000000..cab3da5
--- /dev/null
+++ b/dependency_manager_cxx/src/Component.cc
@@ -0,0 +1,43 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "celix/dm/Component.h"
+#include "celix/dm/DependencyManager.h"
+
+#include <typeinfo>
+
+using namespace celix::dm;
+
+BaseComponent::BaseComponent(const bundle_context_pt context, std::string name) : context(context), name(name) {
+    cCmp = nullptr;
+    component_create(context, name.c_str(), &this->cCmp);
+    component_setImplementation(this->cCmp, this);
+}
+
+BaseComponent::~BaseComponent() {
+
+}
+
+const dm_component_pt BaseComponent::cComponent() const {
+    return this->cCmp;
+}
+
+const bundle_context_pt BaseComponent::bundleContext() const {
+    return this->context;
+}
\ No newline at end of file
diff --git a/dependency_manager_cxx/src/DependencyManager.cc b/dependency_manager_cxx/src/DependencyManager.cc
new file mode 100644
index 0000000..39f1995
--- /dev/null
+++ b/dependency_manager_cxx/src/DependencyManager.cc
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "celix/dm/DependencyManager.h"
+#include <typeinfo>
+
+using namespace celix::dm;
+
+DependencyManager::DependencyManager(bundle_context_pt context) : context(context), components() {
+    this->cDepMan = nullptr;
+    dependencyManager_create(context, &this->cDepMan);
+}
+
+DependencyManager::~DependencyManager() {
+    dependencyManager_destroy(this->cDepMan);
+    this->cDepMan = nullptr;
+}
+
+const bundle_context_pt DependencyManager::bundleContext() const {
+    return context;
+}
+
+const dm_dependency_manager_pt DependencyManager::cDependencyManager() const {
+    return cDepMan;
+}
+
+void DependencyManager::start() {
+    for(std::unique_ptr<BaseComponent>& cmp : components)  {
+        dependencyManager_add(cDepMan, cmp->cComponent());
+    }
+}
+
+void DependencyManager::stop() {
+    dependencyManager_removeAllComponents(cDepMan);
+    components.clear();
+}
+
+
+
diff --git a/dependency_manager_cxx/src/ServiceDependency.cc b/dependency_manager_cxx/src/ServiceDependency.cc
new file mode 100644
index 0000000..452ecc8
--- /dev/null
+++ b/dependency_manager_cxx/src/ServiceDependency.cc
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "celix/dm/ServiceDependency.h"
+#include <iostream>
+
+using namespace celix::dm;
+
+BaseServiceDependency::BaseServiceDependency(bool v) : valid{v} {
+    if (this->valid) {
+        serviceDependency_create(&this->cServiceDep);
+        //NOTE using suspend as default strategy
+        serviceDependency_setStrategy(this->cServiceDep,  DM_SERVICE_DEPENDENCY_STRATEGY_SUSPEND);
+    }
+}
+
+void BaseServiceDependency::setDepStrategy(DependencyUpdateStrategy strategy) {
+    if (!valid) {
+        return;
+    }
+    if (strategy == DependencyUpdateStrategy::locking) {
+        serviceDependency_setStrategy(this->cServiceDependency(), DM_SERVICE_DEPENDENCY_STRATEGY_LOCKING);
+    } else if (strategy == DependencyUpdateStrategy::suspend) {
+        serviceDependency_setStrategy(this->cServiceDependency(), DM_SERVICE_DEPENDENCY_STRATEGY_SUSPEND);
+    } else {
+        std::cerr << "Unexpected dependency update strategy. Cannot convert for dm_depdendency\n";
+    }
+}
\ No newline at end of file
diff --git a/dependency_manager_cxx/src/dm_activator_base_cxx.cc b/dependency_manager_cxx/src/dm_activator_base_cxx.cc
new file mode 100644
index 0000000..f2ef89a
--- /dev/null
+++ b/dependency_manager_cxx/src/dm_activator_base_cxx.cc
@@ -0,0 +1,130 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+#include "celix/dm/DmActivator.h"
+#include "celix/dm/DependencyManager.h"
+
+extern "C" {
+#include <stdlib.h>
+#include "bundle_context.h"
+#include "celix_errno.h"
+#include "dm_dependency_manager.h"
+#include "bundle_activator.h"
+#include "dm_info.h"
+#include "dm_activator.h"
+
+
+struct dm_dependency_activator_base {
+    dm_dependency_activator_base(std::shared_ptr<celix::dm::DependencyManager> man, std::shared_ptr<celix::dm::DmActivator> act) : manager(man), activator(act) {}
+    bundle_context_pt context {nullptr};
+    service_registration_pt reg {nullptr};
+    dm_info_service_t info {nullptr,nullptr,nullptr};
+
+    std::shared_ptr<celix::dm::DependencyManager> manager {nullptr};
+    std::shared_ptr<celix::dm::DmActivator> activator {nullptr};
+};
+
+typedef struct dm_dependency_activator_base *dependency_activator_base_pt;
+
+celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
+    celix_status_t status = CELIX_SUCCESS;
+
+#ifdef __EXCEPTIONS
+    auto man = std::shared_ptr<celix::dm::DependencyManager>{new celix::dm::DependencyManager(context)};
+    auto dmAct = std::shared_ptr<celix::dm::DmActivator> {DmActivator::create(*man)};
+    dependency_activator_base_pt act = new dm_dependency_activator_base(man, dmAct);
+#else
+    auto man = std::shared_ptr<celix::dm::DependencyManager>{new(std::nothrow) celix::dm::DependencyManager(context)};
+    auto dmAct = std::shared_ptr<celix::dm::DmActivator> {DmActivator::create(*man)};
+    dependency_activator_base_pt act = new(std::nothrow) dm_dependency_activator_base(man, dmAct);
+#endif
+
+
+    if (act != nullptr) {
+        act->context = context;
+        act->reg = nullptr;
+        act->info.handle = nullptr;
+        act->info.destroyInfo = nullptr;
+        act->info.getInfo = nullptr;
+    } else {
+        status = CELIX_ENOMEM;
+    }
+
+    if (status == CELIX_SUCCESS) {
+        *userData = act;
+    } else {
+        delete act;
+    }
+
+    return status;
+}
+
+celix_status_t bundleActivator_start(void *userData, bundle_context_pt context) {
+    celix_status_t status = CELIX_SUCCESS;
+    dependency_activator_base_pt act = (dependency_activator_base_pt) userData;
+
+    if (act == nullptr || act->manager == nullptr) {
+        return CELIX_ILLEGAL_STATE;
+    }
+
+    act->activator->init();
+    act->manager->start();
+
+    if (status == CELIX_SUCCESS) {
+        //Create the service
+        act->info.handle = act->manager->cDependencyManager();
+        act->info.getInfo = (celix_status_t (*)(void *, dm_dependency_manager_info_pt *)) dependencyManager_getInfo;
+        act->info.destroyInfo = (void (*)(void *, dm_dependency_manager_info_pt)) dependencyManager_destroyInfo;
+
+        status = bundleContext_registerService(context, (char *) DM_INFO_SERVICE_NAME, &act->info, NULL, &(act->reg));
+    }
+
+    return status;
+}
+
+celix_status_t bundleActivator_stop(void *userData, bundle_context_pt context __attribute__((unused))) {
+    celix_status_t status = CELIX_SUCCESS;
+    dependency_activator_base_pt act = (dependency_activator_base_pt) userData;
+
+    if (act == nullptr || act->manager == nullptr) {
+        return CELIX_ILLEGAL_STATE;
+    }
+
+    // Remove the service
+    status = serviceRegistration_unregister(act->reg);
+    dependencyManager_removeAllComponents(act->manager->cDependencyManager());
+
+    return status;
+}
+
+celix_status_t bundleActivator_destroy(void *userData, bundle_context_pt context __attribute__((unused))) {
+    celix_status_t status = CELIX_SUCCESS;
+    dependency_activator_base_pt act = (dependency_activator_base_pt) userData;
+
+    if (act == NULL) {
+        return CELIX_ILLEGAL_STATE;
+    }
+
+    act->activator->deinit();
+    act->manager->stop();
+
+    delete act;
+    return status;
+}
+
+}
diff --git a/deployment_admin/private/include/deployment_package.h b/deployment_admin/private/include/deployment_package.h
index 9864c4e..06c1767 100644
--- a/deployment_admin/private/include/deployment_package.h
+++ b/deployment_admin/private/include/deployment_package.h
@@ -65,12 +65,12 @@
 
 celix_status_t deploymentPackage_create(bundle_context_pt context, manifest_pt manifest, deployment_package_pt *package);
 celix_status_t deploymentPackage_destroy(deployment_package_pt package);
-celix_status_t deploymentPackage_getName(deployment_package_pt package, char **name);
+celix_status_t deploymentPackage_getName(deployment_package_pt package, const char** name);
 celix_status_t deploymentPackage_getBundleInfos(deployment_package_pt package, array_list_pt *infos);
-celix_status_t deploymentPackage_getBundleInfoByName(deployment_package_pt package, char *name, bundle_info_pt *info);
+celix_status_t deploymentPackage_getBundleInfoByName(deployment_package_pt package, const char* name, bundle_info_pt *info);
 celix_status_t deploymentPackage_getResourceInfos(deployment_package_pt package, array_list_pt *infos);
-celix_status_t deploymentPackage_getResourceInfoByPath(deployment_package_pt package, char *path, resource_info_pt *info);
-celix_status_t deploymentPackage_getBundle(deployment_package_pt package, char *name, bundle_pt *bundle);
+celix_status_t deploymentPackage_getResourceInfoByPath(deployment_package_pt package, const char* path, resource_info_pt *info);
+celix_status_t deploymentPackage_getBundle(deployment_package_pt package, const char* name, bundle_pt *bundle);
 celix_status_t deploymentPackage_getVersion(deployment_package_pt package, version_pt *version);
 
 #endif /* DEPLOYMENT_PACKAGE_H_ */
diff --git a/deployment_admin/private/src/deployment_admin.c b/deployment_admin/private/src/deployment_admin.c
index 97cc7e1..6c8c505 100644
--- a/deployment_admin/private/src/deployment_admin.c
+++ b/deployment_admin/private/src/deployment_admin.c
@@ -57,7 +57,11 @@
 #include "miniunz.h"
 
 #define IDENTIFICATION_ID "deployment_admin_identification"
-#define DISCOVERY_URL "deployment_admin_url"
+#define DEFAULT_IDENTIFICATION_ID "celix"
+
+#define ADMIN_URL "deployment_admin_url"
+#define DEFAULT_ADMIN_URL "localhost:8080"
+
 #define DEPLOYMENT_CACHE_DIR "deployment_cache_dir"
 #define DEPLOYMENT_TAGS "deployment_tags"
 // "http://localhost:8080/deployment/"
@@ -97,7 +101,12 @@
 		(*admin)->pollUrl = NULL;
 		(*admin)->auditlogUrl = NULL;
 
-        bundleContext_getProperty(context, IDENTIFICATION_ID, &(*admin)->targetIdentification);
+        bundleContext_getProperty(context, IDENTIFICATION_ID, (const char**) &(*admin)->targetIdentification);
+        if ((*admin)->targetIdentification == NULL) {
+        	(*admin)->targetIdentification = DEFAULT_IDENTIFICATION_ID;
+        	fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "Identification ID not set, using default '%s'. Set id by using '%s'",
+        		DEFAULT_IDENTIFICATION_ID, IDENTIFICATION_ID);
+        }
 
         struct timeval tv;
 		gettimeofday(&tv,NULL);
@@ -106,25 +115,26 @@
 
 		if ((*admin)->targetIdentification == NULL ) {
 		    fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Target name must be set using \"deployment_admin_identification\"");
-			status = CELIX_ILLEGAL_ARGUMENT;
 		} else {
-			char *url = NULL;
-			bundleContext_getProperty(context, DISCOVERY_URL, &url);
+			const char *url = NULL;
+			bundleContext_getProperty(context, ADMIN_URL, &url);
 			if (url == NULL) {
-			    fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "URL must be set using \"deployment_admin_url\"\n");
-				status = CELIX_ILLEGAL_ARGUMENT;
-			} else {
-				int pollUrlLength = strlen(url) + strlen((*admin)->targetIdentification) + strlen(VERSIONS) + 13;
-				int auditlogUrlLength = strlen(url) + 10;
+				url = DEFAULT_ADMIN_URL;
+			    fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "Server URL is not set, using default '%s'. Set id by using '%s'",
+        			DEFAULT_ADMIN_URL, ADMIN_URL);
+			}
+		
+			int pollUrlLength = strlen(url) + strlen((*admin)->targetIdentification) + strlen(VERSIONS) + 13;
+			int auditlogUrlLength = strlen(url) + 10;
 
-				char pollUrl[pollUrlLength];
-				char auditlogUrl[auditlogUrlLength];
+			char pollUrl[pollUrlLength];
+			char auditlogUrl[auditlogUrlLength];
 
-				snprintf(pollUrl, pollUrlLength, "%s/deployment/%s%s", url, (*admin)->targetIdentification, VERSIONS);
-				snprintf(auditlogUrl, auditlogUrlLength, "%s/auditlog", url);
+			snprintf(pollUrl, pollUrlLength, "%s/deployment/%s%s", url, (*admin)->targetIdentification, VERSIONS);
+			snprintf(auditlogUrl, auditlogUrlLength, "%s/auditlog", url);
 
-				(*admin)->pollUrl = strdup(pollUrl);
-				(*admin)->auditlogUrl = strdup(auditlogUrl);
+			(*admin)->pollUrl = strdup(pollUrl);
+			(*admin)->auditlogUrl = strdup(auditlogUrl);
 
 //				log_store_pt store = NULL;
 //				log_pt log = NULL;
@@ -136,8 +146,7 @@
 //				log_log(log, 20000, NULL);
 
 
-				celixThread_create(&(*admin)->poller, NULL, deploymentAdmin_poll, *admin);
-			}
+			celixThread_create(&(*admin)->poller, NULL, deploymentAdmin_poll, *admin);
 		}
 	}
 
@@ -211,7 +220,7 @@
 static celix_status_t deploymentAdmin_auditEventTargetPropertiesSet(deployment_admin_pt admin) {
     celix_status_t status = CELIX_SUCCESS;
 
-    char *tags = NULL;
+    const char *tags = NULL;
 
     bundleContext_getProperty(admin->context, DEPLOYMENT_TAGS, &tags);
 
@@ -295,7 +304,9 @@
 					uuid_generate(uid);
 					uuid_unparse(uid, uuid);
                     snprintf(tmpDir, 256, "%s%s", entry, uuid);
-                    mkdir(tmpDir, S_IRWXU);
+                    if( mkdir(tmpDir, S_IRWXU) == -1){
+                        fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Failed creating directory %s",tmpDir);
+                    }
 
 					// TODO: update to use bundle cache DataFile instead of module entries.
 					unzip_extractDeploymentPackage(inputFilename, tmpDir);
@@ -306,13 +317,15 @@
 					manifest_createFromFile(manifest, &mf);
 					deployment_package_pt source = NULL;
 					deploymentPackage_create(admin->context, mf, &source);
-					char *name = NULL;
+					const char *name = NULL;
 					deploymentPackage_getName(source, &name);
 
 					int repoDirLength = strlen(entry) + 5;
 					char repoDir[repoDirLength];
 					snprintf(repoDir, repoDirLength, "%srepo", entry);
-					mkdir(repoDir, S_IRWXU);
+					if( mkdir(repoDir, S_IRWXU) == -1){
+						fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Failed creating directory %s",repoDir);
+					}
 
 					int repoCacheLength = strlen(entry) + strlen(name) + 6;
 					char repoCache[repoCacheLength];
@@ -338,9 +351,13 @@
 
 					deploymentAdmin_deleteTree(repoCache);
 					deploymentAdmin_deleteTree(tmpDir);
-					remove(inputFilename);
+					if( remove(inputFilename) == -1){
+						fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Remove of %s failed",inputFilename);
+					}
 					admin->current = strdup(last);
-					hashMap_put(admin->packages, name, source);
+					hashMap_put(admin->packages, (char*)name, source);
+
+                    free(entry);
 				}
 				if (inputFilename != NULL) {
 					free(inputFilename);
@@ -427,39 +444,48 @@
 	CURLcode res = 0;
 	curl = curl_easy_init();
 	if (curl) {
-		char *dir = NULL;
+		const char *dir = NULL;
 		bundleContext_getProperty(admin->context, DEPLOYMENT_CACHE_DIR, &dir);
 		if (dir != NULL) {
 			*inputFile = calloc(1024, sizeof (char));
 			snprintf(*inputFile, 1024, "%s/%s", dir, "updateXXXXXX");
 		}
 		else {
-				*inputFile = strdup("updateXXXXXX");
+			*inputFile = strdup("updateXXXXXX");
 		}
+		umask(0011);
         int fd = mkstemp(*inputFile);
         if (fd != -1) {
             FILE *fp = fopen(*inputFile, "wb+");
-            curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
-            curl_easy_setopt(curl, CURLOPT_URL, url);
-            curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, deploymentAdmin_writeData);
-            curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
-            curl_easy_setopt(curl, CURLOPT_FAILONERROR, true);
-            //curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0);
-            //curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, updateCommand_downloadProgress);
-            res = curl_easy_perform(curl);
-            if (res != CURLE_OK) {
-                status = CELIX_BUNDLE_EXCEPTION;
+            if(fp!=NULL){
+            	curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
+            	curl_easy_setopt(curl, CURLOPT_URL, url);
+            	curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, deploymentAdmin_writeData);
+            	curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
+            	curl_easy_setopt(curl, CURLOPT_FAILONERROR, true);
+            	//curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0);
+            	//curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, updateCommand_downloadProgress);
+            	res = curl_easy_perform(curl);
+
+            	/* always cleanup */
+            	curl_easy_cleanup(curl);
+            	fclose(fp);
             }
-            /* always cleanup */
-            curl_easy_cleanup(curl);
-            fclose(fp);
+            else{
+            	status = CELIX_FILE_IO_EXCEPTION;
+            }
+        }
+        else{
+        	status = CELIX_FILE_IO_EXCEPTION;
         }
 	}
+	else{
+		res = CURLE_FAILED_INIT;
+	}
+
 	if (res != CURLE_OK) {
 		*inputFile[0] = '\0';
 		status = CELIX_ILLEGAL_STATE;
-	} else {
-		status = CELIX_SUCCESS;
 	}
 
 	return status;
@@ -554,7 +580,7 @@
 		bundleContext_getBundle(admin->context, &bundle);
 		char *entry = NULL;
 		bundle_getEntry(bundle, "/", &entry);
-		char *name = NULL;
+		const char *name = NULL;
 		deploymentPackage_getName(source, &name);
 
 		int bundlePathLength = strlen(entry) + strlen(name) + strlen(info->path) + 7;
@@ -575,6 +601,8 @@
 			//printf("Install bundle from: %s\n", bundlePath);
 			bundleContext_installBundle2(admin->context, bsn, bundlePath, &updateBundle);
 		}
+
+        free(entry);
 	}
 	arrayList_destroy(infos);
 	return status;
@@ -653,8 +681,8 @@
 				if (status == CELIX_SUCCESS) {
 					bundle_pt bundle = NULL;
 					char *entry = NULL;
-					char *name = NULL;
-					char *packageName = NULL;
+					const char *name = NULL;
+					const char *packageName = NULL;
 					resource_processor_service_pt processor = processorP;
 
 					bundleContext_getBundle(admin->context, &bundle);
@@ -666,8 +694,10 @@
 					snprintf(resourcePath, length, "%srepo/%s/%s", entry, name, info->path);
 					deploymentPackage_getName(source, &packageName);
 
-					processor->begin(processor->processor, packageName);
+					processor->begin(processor->processor, (char*)packageName);
 					processor->process(processor->processor, info->path, resourcePath);
+
+                    free(entry);
 				}
 			}
 		}
@@ -709,11 +739,11 @@
                         void *processorP = NULL;
                         status = bundleContext_getService(admin->context, ref, &processorP);
                         if (status == CELIX_SUCCESS) {
-                            char *packageName = NULL;
+                            const char *packageName = NULL;
                             resource_processor_service_pt processor = processorP;
 
                             deploymentPackage_getName(source, &packageName);
-                            processor->begin(processor->processor, packageName);
+                            processor->begin(processor->processor, (char*)packageName);
                             processor->dropped(processor->processor, info->path);
                         }
                     }
diff --git a/deployment_admin/private/src/deployment_package.c b/deployment_admin/private/src/deployment_package.c
index 4195649..1520db8 100644
--- a/deployment_admin/private/src/deployment_package.c
+++ b/deployment_admin/private/src/deployment_package.c
@@ -40,7 +40,7 @@
 
 celix_status_t deploymentPackage_processEntries(deployment_package_pt package);
 static celix_status_t deploymentPackage_isBundleResource(properties_pt attributes, bool *isBundleResource);
-static celix_status_t deploymentPackage_parseBooleanHeader(char *value, bool *boolValue);
+static celix_status_t deploymentPackage_parseBooleanHeader(const char *value, bool *boolValue);
 
 celix_status_t deploymentPackage_create(bundle_context_pt context, manifest_pt manifest, deployment_package_pt *package) {
 	celix_status_t status = CELIX_SUCCESS;
@@ -107,7 +107,7 @@
 	return status;
 }
 
-celix_status_t deploymentPackage_getName(deployment_package_pt package, char **name) {
+celix_status_t deploymentPackage_getName(deployment_package_pt package, const char **name) {
 	*name = manifest_getValue(package->manifest, "DeploymentPackage-SymbolicName");
 	return CELIX_SUCCESS;
 }
@@ -117,12 +117,12 @@
 	return CELIX_SUCCESS;
 }
 
-celix_status_t deploymentPackage_getBundleInfoByName(deployment_package_pt package, char *name, bundle_info_pt *info) {
+celix_status_t deploymentPackage_getBundleInfoByName(deployment_package_pt package, const char *name, bundle_info_pt *info) {
 	*info = hashMap_get(package->nameToBundleInfo, name);
 	return CELIX_SUCCESS;
 }
 
-celix_status_t deploymentPackage_getBundle(deployment_package_pt package, char *name, bundle_pt *bundle) {
+celix_status_t deploymentPackage_getBundle(deployment_package_pt package, const char *name, bundle_pt *bundle) {
 	if (hashMap_containsKey(package->nameToBundleInfo, name)) {
 		array_list_pt bundles = NULL;
 		bundleContext_getBundles(package->context, &bundles);
@@ -131,7 +131,7 @@
 			bundle_pt ibundle = arrayList_get(bundles, i);
 			module_pt module = NULL;
 			bundle_getCurrentModule(ibundle, &module);
-			char *bsn = NULL;
+			const char *bsn = NULL;
 			module_getSymbolicName(module, &bsn);
 			if (strcmp(bsn, name) == 0) {
 				*bundle = ibundle;
@@ -150,13 +150,13 @@
 	return CELIX_SUCCESS;
 }
 
-celix_status_t deploymentPackage_getResourceInfoByPath(deployment_package_pt package, char *path, resource_info_pt *info) {
+celix_status_t deploymentPackage_getResourceInfoByPath(deployment_package_pt package, const char *path, resource_info_pt *info) {
 	*info = hashMap_get(package->pathToEntry, path);
 	return CELIX_SUCCESS;
 }
 
 celix_status_t deploymentPackage_getVersion(deployment_package_pt package, version_pt *version) {
-	char *versionStr = manifest_getValue(package->manifest, "DeploymentPackage-Version");
+	const char *versionStr = manifest_getValue(package->manifest, "DeploymentPackage-Version");
 	return version_createVersionFromString(versionStr, version);
 }
 
@@ -177,19 +177,19 @@
 			bundle_info_pt info = calloc(1, sizeof(*info));
 			info->path = name;
 			info->attributes = values;
-			info->symbolicName = properties_get(values, (char *) OSGI_FRAMEWORK_BUNDLE_SYMBOLICNAME);
-			char *version = properties_get(values, (char *) OSGI_FRAMEWORK_BUNDLE_VERSION);
+			info->symbolicName = (char*)properties_get(values, OSGI_FRAMEWORK_BUNDLE_SYMBOLICNAME);
+			const char *version = properties_get(values, OSGI_FRAMEWORK_BUNDLE_VERSION);
 			info->version = NULL;
-			status = version_createVersionFromString(version, &info->version);
-			char *customizer = properties_get(values, (char *) DEPLOYMENTPACKAGE_CUSTOMIZER);
-			deploymentPackage_parseBooleanHeader(customizer, &info->customizer);
+			status = version_createVersionFromString((char*)version, &info->version);
+			const char *customizer = properties_get(values, DEPLOYMENTPACKAGE_CUSTOMIZER);
+			deploymentPackage_parseBooleanHeader((char*)customizer, &info->customizer);
 
 			arrayList_add(package->bundleInfos, info);
 		} else {
 			resource_info_pt info = calloc(1, sizeof(*info));
 			info->path = name;
 			info->attributes = values;
-			info->resourceProcessor = properties_get(values, (char *) RESOURCE_PROCESSOR);
+			info->resourceProcessor = (char*)properties_get(values,RESOURCE_PROCESSOR);
 
 			arrayList_add(package->resourceInfos, info);
 		}
@@ -204,7 +204,7 @@
 	return CELIX_SUCCESS;
 }
 
-static celix_status_t deploymentPackage_parseBooleanHeader(char *value, bool *boolValue) {
+static celix_status_t deploymentPackage_parseBooleanHeader(const char *value, bool *boolValue) {
 	*boolValue = false;
 	if (value != NULL) {
 		if (strcmp(value, "true") == 0) {
diff --git a/deployment_admin/private/src/log_sync.c b/deployment_admin/private/src/log_sync.c
index 164e51c..242beea 100644
--- a/deployment_admin/private/src/log_sync.c
+++ b/deployment_admin/private/src/log_sync.c
@@ -118,7 +118,7 @@
 static void *logSync_synchronize(void *logSyncP) {
 	log_sync_pt logSync = logSyncP;
 
-		while (logSync->running) {
+	while (logSync->running) {
 
 		//query current log
 		// http://localhost:8080/auditlog/query?tid=targetid&logid=logid
@@ -139,6 +139,11 @@
 				logStore_getEvents(logSync->logStore, &events);
 			}
 		}
+
+		if(descriptor!=NULL){
+			free(descriptor);
+		}
+
 		sleep(10);
 	}
 
@@ -166,7 +171,7 @@
 	chunk.memory = calloc(1, sizeof(char));
 	chunk.size = 0;
 	if (curl) {
-	    curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
+		curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
 		curl_easy_setopt(curl, CURLOPT_URL, query);
 		curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, logSync_readQeury);
 		curl_easy_setopt(curl, CURLOPT_WRITEDATA, &chunk);
diff --git a/deployment_admin/private/src/unzip.c b/deployment_admin/private/src/unzip.c
index e80113d..d8a6716 100644
--- a/deployment_admin/private/src/unzip.c
+++ b/deployment_admin/private/src/unzip.c
@@ -603,6 +603,7 @@
     if (unz_copyright[0]!=' ')
         return NULL;
 
+    memset(&us,0,sizeof(unz64_s));
     us.z_filefunc.zseek32_file = NULL;
     us.z_filefunc.ztell32_file = NULL;
     if (pzlib_filefunc64_32_def==NULL)
@@ -750,6 +751,7 @@
     us.central_pos = central_pos;
     us.pfile_in_zip_read = NULL;
     us.encrypted = 0;
+    us.num_file = 0;
 
 
     s=(unz64_s*)ALLOC(sizeof(unz64_s));
@@ -784,6 +786,7 @@
         zlib_filefunc64_32_def_fill.zfile_func64 = *pzlib_filefunc_def;
         zlib_filefunc64_32_def_fill.ztell32_file = NULL;
         zlib_filefunc64_32_def_fill.zseek32_file = NULL;
+        zlib_filefunc64_32_def_fill.zopen32_file = NULL;
         return unzOpenInternal(path, &zlib_filefunc64_32_def_fill, 1);
     }
     else
diff --git a/device_access/device_access/private/include/driver_attributes.h b/device_access/device_access/private/include/driver_attributes.h
index 73bfac1..bdb12a2 100644
--- a/device_access/device_access/private/include/driver_attributes.h
+++ b/device_access/device_access/private/include/driver_attributes.h
@@ -31,6 +31,7 @@
 typedef struct driver_attributes *driver_attributes_pt;
 
 celix_status_t driverAttributes_create(service_reference_pt reference, driver_service_pt driver, driver_attributes_pt *attributes);
+celix_status_t driverAttributes_destroy(driver_attributes_pt attributes);
 
 celix_status_t driverAttributes_getReference(driver_attributes_pt driverAttributes, service_reference_pt *reference);
 celix_status_t driverAttributes_getDriverId(driver_attributes_pt driverAttributes, char **driverId);
diff --git a/device_access/device_access/private/src/device_manager.c b/device_access/device_access/private/src/device_manager.c
index 14a7a02..6e7cfd9 100644
--- a/device_access/device_access/private/src/device_manager.c
+++ b/device_access/device_access/private/src/device_manager.c
@@ -75,9 +75,11 @@
 		(*manager)->loghelper = logHelper;
 
 		status = arrayList_create(&(*manager)->locators);
+
+		logHelper_log((*manager)->loghelper, OSGI_LOGSERVICE_DEBUG, "DEVICE_MANAGER: Initialized");
 	}
 
-	logHelper_log((*manager)->loghelper, OSGI_LOGSERVICE_DEBUG, "DEVICE_MANAGER: Initialized");
+
 	return status;
 }
 
@@ -167,8 +169,8 @@
 
 				serviceReference_getPropertyKeys(ref, &keys, &size);
 				for (int i = 0; i < size; i++) {
-					char *key = keys[i];
-					char *value = NULL;
+					char* key = keys[i];
+					const char* value = NULL;
 					serviceReference_getProperty(ref, key, &value);
 					properties_set(properties, key, value);
 				}
@@ -193,15 +195,17 @@
 								}
 							}
 							arrayListIterator_destroy(idsIter);
-						} else {
-							// Ignore
+						}
+						if(id != NULL){
+							free(id);
 						}
 					}
 					hashMapIterator_destroy(iter);
 
 					status = deviceManager_matchAttachDriver(manager, loader, driverIds, included, excluded, service, ref);
-					arrayList_destroy(driverIds);
+
 				}
+				arrayList_destroy(driverIds);
 				properties_destroy(properties);
 				arrayList_destroy(excluded);
 			}
@@ -209,6 +213,8 @@
 		}
 
 	}
+
+	driverLoader_destroy(&loader);
 	return status;
 }
 
@@ -287,6 +293,9 @@
 				}
 			}
 		}
+
+		driverMatcher_destroy(&matcher);
+
 	}
 
 	if (references != NULL) {
@@ -298,7 +307,7 @@
 
 celix_status_t deviceManager_noDriverFound(device_manager_pt manager, void *service, service_reference_pt reference) {
 	celix_status_t status = CELIX_SUCCESS;
-    char *objectClass = NULL;
+    const char* objectClass = NULL;
     serviceReference_getProperty(reference, (char *) OSGI_FRAMEWORK_OBJECTCLASS, &objectClass);
     if (strcmp(objectClass, OSGI_DEVICEACCESS_DRIVER_SERVICE_NAME) == 0) {
         device_service_pt device = service;
@@ -333,6 +342,9 @@
 	if (status == CELIX_SUCCESS) {
 		hashMap_put(manager->drivers, ref, attributes);
 	}
+	else{
+		driverAttributes_destroy(attributes);
+	}
 	return status;
 }
 
@@ -358,7 +370,7 @@
 		for (i = 0; i < arrayList_size(idleDevices); i++) {
 			celix_status_t forStatus = CELIX_SUCCESS;
 			service_reference_pt ref = arrayList_get(idleDevices, i);
-			char *bsn = NULL;
+			const char *bsn = NULL;
 			bundle_pt bundle = NULL;
 			forStatus = serviceReference_getBundle(ref, &bundle);
 			if (forStatus == CELIX_SUCCESS) {
@@ -413,7 +425,7 @@
 		while (hashMapIterator_hasNext(iter)) {
 			celix_status_t substatus = CELIX_SUCCESS;
 			service_reference_pt ref = hashMapIterator_nextKey(iter);
-			char *bsn = NULL;
+			const char *bsn = NULL;
 			module_pt module = NULL;
 			bundle_pt bundle = NULL;
 			substatus = serviceReference_getBundle(ref, &bundle);
@@ -434,7 +446,7 @@
 								celix_status_t sstatus = deviceManager_isDriverBundle(manager, bundle, &isDriver);
 								if (sstatus == CELIX_SUCCESS) {
 									if (isDriver) {
-										char *bsn = NULL;
+										const char *bsn = NULL;
 										module_pt module = NULL;
 										bundle_getCurrentModule(bundle, &module);
 										module_getSymbolicName(module, &bsn);
@@ -476,7 +488,7 @@
 		while (hashMapIterator_hasNext(iter)) {
 			celix_status_t substatus = CELIX_SUCCESS;
 			service_reference_pt ref = hashMapIterator_nextKey(iter);
-			char *bsn = NULL;
+			const char *bsn = NULL;
 			module_pt module = NULL;
 			bundle_pt bundle = NULL;
 			array_list_pt bundles = NULL;
@@ -495,7 +507,7 @@
 					celix_status_t sstatus = deviceManager_isDriverBundle(manager, bundle, &isDriver);
 					if (sstatus == CELIX_SUCCESS) {
 						if (isDriver) {
-							char *bsn = NULL;
+							const char *bsn = NULL;
 							module_pt module = NULL;
 							bundle_getCurrentModule(bundle, &module);
 							module_getSymbolicName(module, &bsn);
@@ -529,8 +541,8 @@
 				int i;
 				for (i = 0; i < arrayList_size(refs); i++) {
 					service_reference_pt ref = arrayList_get(refs, i);
-                    char *object = NULL;
-                    serviceReference_getProperty(ref, (char *) OSGI_FRAMEWORK_OBJECTCLASS, &object);
+                    const char* object = NULL;
+                    serviceReference_getProperty(ref, OSGI_FRAMEWORK_OBJECTCLASS, &object);
                     if (strcmp(object, "driver") == 0) {
                         *isDriver = true;
                         break;
diff --git a/device_access/device_access/private/src/driver_attributes.c b/device_access/device_access/private/src/driver_attributes.c
index 3beb675..5ac7fda 100644
--- a/device_access/device_access/private/src/driver_attributes.c
+++ b/device_access/device_access/private/src/driver_attributes.c
@@ -59,7 +59,7 @@
 				(*attributes)->driver = driver;
 				(*attributes)->bundle = bundle;
 
-				char *location;
+				const char *location;
 				status = bundleArchive_getLocation(bundleArchive, &location);
 				if (status == CELIX_SUCCESS) {
 					(*attributes)->dynamic = strncmp(location, DRIVER_LOCATION_PREFIX, 4) == 0 ? true : false;
@@ -72,6 +72,13 @@
 	return status;
 }
 
+celix_status_t driverAttributes_destroy(driver_attributes_pt attributes){
+	if(attributes != NULL){
+		free(attributes);
+	}
+	return CELIX_SUCCESS;
+}
+
 celix_status_t driverAttributes_getReference(driver_attributes_pt driverAttributes, service_reference_pt *reference) {
 	*reference = driverAttributes->reference;
 
@@ -81,7 +88,7 @@
 celix_status_t driverAttributes_getDriverId(driver_attributes_pt driverAttributes, char **driverId) {
 	celix_status_t status = CELIX_SUCCESS;
 
-    char *id_prop = NULL;
+    const char* id_prop = NULL;
     status = serviceReference_getProperty(driverAttributes->reference, "DRIVER_ID", &id_prop);
     if (status == CELIX_SUCCESS) {
         if (!id_prop) {
@@ -118,11 +125,11 @@
 			int i;
 			for (i = 0; i < arrayList_size(references); i++) {
 				service_reference_pt ref = arrayList_get(references, i);
-				char *object = NULL;
-				status = serviceReference_getProperty(ref, (char *) OSGI_FRAMEWORK_OBJECTCLASS, &object);
+				const char *object = NULL;
+				status = serviceReference_getProperty(ref, OSGI_FRAMEWORK_OBJECTCLASS, &object);
 
 				if (status == CELIX_SUCCESS) {
-					char *category = NULL;
+					const char* category = NULL;
 					status = serviceReference_getProperty(ref, "DEVICE_CATEGORY", &category);
 
 					if (status == CELIX_SUCCESS) {
diff --git a/device_access/device_access/private/src/driver_loader.c b/device_access/device_access/private/src/driver_loader.c
index 6cb6a65..c4caa65 100644
--- a/device_access/device_access/private/src/driver_loader.c
+++ b/device_access/device_access/private/src/driver_loader.c
@@ -51,7 +51,11 @@
 }
 
 celix_status_t driverLoader_destroy(driver_loader_pt *loader) {
-	arrayList_destroy((*loader)->loadedDrivers);
+	if((*loader) != NULL){
+		arrayList_destroy((*loader)->loadedDrivers);
+		free((*loader));
+		(*loader)=NULL;
+	}
 	return CELIX_SUCCESS;
 }
 
@@ -137,8 +141,8 @@
 	if (status == CELIX_SUCCESS) {
 		bundle_pt bundle = NULL;
 		int length = strlen(DRIVER_LOCATION_PREFIX) + strlen(driverId);
-		char location[length];
-		snprintf(location, length, "%s%s", DRIVER_LOCATION_PREFIX, driverId);
+		char location[length+2];
+		snprintf(location, length+2, "%s%s", DRIVER_LOCATION_PREFIX, driverId);
 		status = bundleContext_installBundle2(loader->context, location, filename, &bundle);
 		if (status == CELIX_SUCCESS) {
 			status = bundle_start(bundle);
diff --git a/device_access/device_access/private/src/driver_matcher.c b/device_access/device_access/private/src/driver_matcher.c
index 5b9103d..c7597d3 100644
--- a/device_access/device_access/private/src/driver_matcher.c
+++ b/device_access/device_access/private/src/driver_matcher.c
@@ -48,13 +48,13 @@
 static celix_status_t driverMatcher_get(driver_matcher_pt matcher, int key, array_list_pt *attributesV);
 static celix_status_t driverMatcher_getBestMatchInternal(driver_matcher_pt matcher, match_pt *match);
 
-unsigned int driverMatcher_matchKeyHash(void * match_key) {
-	match_key_t key = match_key;
+unsigned int driverMatcher_matchKeyHash(const void* match_key) {
+	match_key_t key = (match_key_t) match_key;
 
 	return key->matchValue;
 }
 
-int driverMatcher_matchKeyEquals(void * key, void * toCompare) {
+int driverMatcher_matchKeyEquals(const void* key, const void* toCompare) {
 	return ((match_key_t) key)->matchValue == ((match_key_t) toCompare)->matchValue;
 }
 
@@ -81,21 +81,34 @@
 }
 
 celix_status_t driverMatcher_destroy(driver_matcher_pt *matcher) {
-	arrayList_destroy((*matcher)->matches);
-	hash_map_iterator_pt iter = hashMapIterator_create((*matcher)->attributes);
-	while (hashMapIterator_hasNext(iter)) {
-		array_list_pt list = hashMapIterator_nextValue(iter);
-		if (list != NULL) {
-			arrayList_destroy(list);
+
+	if((*matcher) != NULL){
+
+		int i = 0;
+
+		for(;i<arrayList_size((*matcher)->matches);i++){
+			free(arrayList_get((*matcher)->matches,i));
 		}
+		arrayList_destroy((*matcher)->matches);
+
+		hash_map_iterator_pt iter = hashMapIterator_create((*matcher)->attributes);
+		while (hashMapIterator_hasNext(iter)) {
+			hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
+			match_key_t match = (match_key_t)hashMapEntry_getKey(entry);
+			array_list_pt list = (array_list_pt)hashMapEntry_getValue(entry);
+			free(match);
+			if (list != NULL) {
+				arrayList_destroy(list);
+			}
+		}
+		hashMapIterator_destroy(iter);
+		hashMap_destroy((*matcher)->attributes, false, false);
+
+		logHelper_stop((*matcher)->loghelper);
+		logHelper_destroy(&(*matcher)->loghelper);
+
+		free(*matcher);
 	}
-	hashMapIterator_destroy(iter);
-	hashMap_destroy((*matcher)->attributes, false, false);
-
-	logHelper_stop((*matcher)->loghelper);
-	logHelper_destroy(&(*matcher)->loghelper);
-
-	free(*matcher);
 
 	return CELIX_SUCCESS;
 }
@@ -137,6 +150,8 @@
 		hashMap_put(matcher->attributes, matchKey, *attributes);
 	}
 
+	free(matchKeyS);
+
 	return status;
 }
 
@@ -200,7 +215,8 @@
 			celix_status_t substatus = driverAttributes_getReference(attributes, &reference);
 			if (substatus == CELIX_SUCCESS) {
 				if (best != NULL) {
-					char *rank1Str, *rank2Str;
+					const char* rank1Str;
+					const char* rank2Str;
 					int rank1, rank2;
 
 					rank1Str = "0";
@@ -208,8 +224,8 @@
 
 					logHelper_log(matcher->loghelper, OSGI_LOGSERVICE_DEBUG, "DRIVER_MATCHER: Compare ranking");
 
-					serviceReference_getProperty(reference, (char *) OSGI_FRAMEWORK_SERVICE_RANKING, &rank1Str);
-					serviceReference_getProperty(reference, (char *) OSGI_FRAMEWORK_SERVICE_RANKING, &rank2Str);
+					serviceReference_getProperty(reference, OSGI_FRAMEWORK_SERVICE_RANKING, &rank1Str);
+					serviceReference_getProperty(reference, OSGI_FRAMEWORK_SERVICE_RANKING, &rank2Str);
 
 					rank1 = atoi(rank1Str);
 					rank2 = atoi(rank2Str);
@@ -219,7 +235,8 @@
 							best = reference;
 						}
 					} else {
-						char *id1Str, *id2Str;
+						const char* id1Str;
+						const char* id2Str;
 						long id1, id2;
 
 						id1Str = NULL;
@@ -227,8 +244,8 @@
 
 						logHelper_log(matcher->loghelper, OSGI_LOGSERVICE_DEBUG, "DRIVER_MATCHER: Compare id's");
 
-						serviceReference_getProperty(reference, (char *) OSGI_FRAMEWORK_SERVICE_ID, &id1Str);
-						serviceReference_getProperty(reference, (char *) OSGI_FRAMEWORK_SERVICE_ID, &id2Str);
+						serviceReference_getProperty(reference, OSGI_FRAMEWORK_SERVICE_ID, &id1Str);
+						serviceReference_getProperty(reference, OSGI_FRAMEWORK_SERVICE_ID, &id2Str);
 
 						id1 = atol(id1Str);
 						id2 = atol(id2Str);
diff --git a/device_access/driver_locator/private/src/activator.c b/device_access/driver_locator/private/src/activator.c
index 9cc5500..abc60c5 100644
--- a/device_access/driver_locator/private/src/activator.c
+++ b/device_access/driver_locator/private/src/activator.c
@@ -41,38 +41,38 @@
 
 celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
 	celix_status_t status = CELIX_SUCCESS;
-	bundle_instance_pt bi = calloc(1, sizeof(struct bundle_instance));
-	if (userData != NULL) {
-		bi->service=NULL;
-		bi->locator=NULL;
-		bi->locatorRegistration=NULL;
-		(*userData)=bi;
-	} else {
+	(*userData) = calloc(1, sizeof(struct bundle_instance));
+	if ( (*userData) == NULL ){
 		status = CELIX_ENOMEM;
-    }
+	}
     return status;
 }
 
 celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
     celix_status_t status = CELIX_SUCCESS;
     bundle_instance_pt bi = (bundle_instance_pt)userData;
-    if (status == CELIX_SUCCESS) {
-        bi->service = calloc(1, sizeof(*(bi->service)));
-        bi->service->findDrivers = driverLocator_findDrivers;
-        bi->service->loadDriver = driverLocator_loadDriver;
 
-        bi->locator = calloc(1, sizeof(*(bi->locator)));
-        bi->service->locator = bi->locator;
-        bi->locator->drivers = NULL;
-        arrayList_create(&bi->locator->drivers);
-        bundleContext_getProperty(context, "DRIVER_LOCATOR_PATH", &bi->locator->path);
-        if (bi->locator->path == NULL ) {
-        	bi->locator->path = (char *)DEFAULT_LOCATOR_PATH;
-        }
-        bundleContext_registerService(context, OSGI_DEVICEACCESS_DRIVER_LOCATOR_SERVICE_NAME, bi->service, NULL, &bi->locatorRegistration);
-    } else {
-        status = CELIX_START_ERROR;
+    bi->service = calloc(1, sizeof(*(bi->service)));
+    bi->locator = calloc(1, sizeof(*(bi->locator)));
+    if(bi->service != NULL && bi->locator != NULL){
+	bi->service->findDrivers = driverLocator_findDrivers;
+	bi->service->loadDriver = driverLocator_loadDriver;
+
+	bi->service->locator = bi->locator;
+	bi->locator->drivers = NULL;
+	arrayList_create(&bi->locator->drivers);
+	bundleContext_getProperty(context, "DRIVER_LOCATOR_PATH", (const char**)&bi->locator->path);
+	if (bi->locator->path == NULL ) {
+		bi->locator->path = (char *)DEFAULT_LOCATOR_PATH;
+	}
+	status = bundleContext_registerService(context, OSGI_DEVICEACCESS_DRIVER_LOCATOR_SERVICE_NAME, bi->service, NULL, &bi->locatorRegistration);
     }
+    else{
+	if(bi->service!=NULL) free(bi->service);
+	if(bi->locator!=NULL) free(bi->locator);
+	status = CELIX_ENOMEM;
+    }
+
     return status;
 }
 
diff --git a/device_access/driver_locator/private/src/driver_locator.c b/device_access/driver_locator/private/src/driver_locator.c
index 8ccd6de..9c360bf 100644
--- a/device_access/driver_locator/private/src/driver_locator.c
+++ b/device_access/driver_locator/private/src/driver_locator.c
@@ -34,7 +34,7 @@
 celix_status_t driverLocator_findDrivers(driver_locator_pt locator, properties_pt props, array_list_pt *drivers) {
 	celix_status_t status = CELIX_SUCCESS;
 
-	char *category = properties_get(props, OSGI_DEVICEACCESS_DEVICE_CATEGORY);
+	const char* category = properties_get(props, OSGI_DEVICEACCESS_DEVICE_CATEGORY);
 
 	status = arrayList_create(drivers);
 	if (status == CELIX_SUCCESS) {
diff --git a/device_access/example/base_driver/private/include/base_driver_private.h b/device_access/example/base_driver/private/include/base_driver_private.h
index 4667e65..3ee5814 100644
--- a/device_access/example/base_driver/private/include/base_driver_private.h
+++ b/device_access/example/base_driver/private/include/base_driver_private.h
@@ -35,4 +35,7 @@
 
 celix_status_t baseDriver_getNextChar(base_driver_device_pt service, char *c);
 
+celix_status_t baseDriver_destroy(base_driver_device_pt device);
+celix_status_t baseDriver_destroyService(base_driver_device_service_pt service);
+
 #endif /* BASE_DRIVER_PRIVATE_H_ */
diff --git a/device_access/example/base_driver/private/src/activator.c b/device_access/example/base_driver/private/src/activator.c
index c59a68b..a6b9d62 100644
--- a/device_access/example/base_driver/private/src/activator.c
+++ b/device_access/example/base_driver/private/src/activator.c
@@ -60,9 +60,9 @@
 static celix_status_t bundleActivator_registerBaseDriverDevice(base_driver_bundle_instance_pt bi, char *serial) {
 	celix_status_t status = CELIX_SUCCESS;
 	base_driver_device_pt device = NULL;
+	base_driver_device_service_pt service = NULL;
 	status = baseDriver_create(&device);
 	if (status == CELIX_SUCCESS) {
-		base_driver_device_service_pt service = NULL;
 		status = baseDriver_createService(device, &service);
 		if (status == CELIX_SUCCESS) {
 			properties_pt props = properties_create();
@@ -72,11 +72,9 @@
 			status = bundleContext_registerService(bi->context, OSGI_DEVICEACCESS_DEVICE_SERVICE_NAME, service, props, &service_registration);
 			if (status == CELIX_SUCCESS) {
 				arrayList_add(bi->serviceRegistrations, service_registration);
-//				service_registration = NULL;
-//				status = bundleContext_registerService(bi->context, BASE_DRIVER_SERVICE_NAME, service, NULL, &service_registration);
-//				if (status == CELIX_SUCCESS) {
-//					arrayList_add(bi->serviceRegistrations, service_registration);
-//				}
+			}
+			else{
+				properties_destroy(props);
 			}
 		}
 	}
@@ -87,6 +85,12 @@
 		char error[256];
 		printf("BASE_DRIVER: Unsuccessfully registered device service with serial %s. Got error: %s\n",
 				serial, celix_strerror(status, error, 256));
+		if(service != NULL){
+			baseDriver_destroyService(service);
+		}
+		if(device != NULL){
+			baseDriver_destroy(device);
+		}
 	}
 	return status;
 }
diff --git a/device_access/example/base_driver/private/src/base_driver.c b/device_access/example/base_driver/private/src/base_driver.c
index 33a2dca..a48c7de 100644
--- a/device_access/example/base_driver/private/src/base_driver.c
+++ b/device_access/example/base_driver/private/src/base_driver.c
@@ -92,3 +92,20 @@
 	return CELIX_SUCCESS;
 }
 
+celix_status_t baseDriver_destroy(base_driver_device_pt device){
+	if(device != NULL){
+		if(device->device != NULL){
+			free(device->device);
+		}
+		free(device);
+	}
+	return CELIX_SUCCESS;
+}
+
+celix_status_t baseDriver_destroyService(base_driver_device_service_pt service){
+	if(service != NULL){
+		free(service);
+	}
+
+	return CELIX_SUCCESS;
+}
diff --git a/device_access/example/consuming_driver/private/src/consuming_driver.c b/device_access/example/consuming_driver/private/src/consuming_driver.c
index b44ac32..9106dbd 100644
--- a/device_access/example/consuming_driver/private/src/consuming_driver.c
+++ b/device_access/example/consuming_driver/private/src/consuming_driver.c
@@ -111,7 +111,7 @@
 	int match=0;
 	celix_status_t status = CELIX_SUCCESS;
 
-    char *category = NULL;
+    const char* category = NULL;
     status = serviceReference_getProperty(reference, OSGI_DEVICEACCESS_DEVICE_CATEGORY, &category);
     if (status == CELIX_SUCCESS) {
         if (strcmp(category, REFINING_DRIVER_DEVICE_CATEGORY) == 0) {
diff --git a/device_access/example/refining_driver/private/include/refining_driver_private.h b/device_access/example/refining_driver/private/include/refining_driver_private.h
index 32d5082..37f15a5 100644
--- a/device_access/example/refining_driver/private/include/refining_driver_private.h
+++ b/device_access/example/refining_driver/private/include/refining_driver_private.h
@@ -52,6 +52,7 @@
 
 celix_status_t refiningDriverDevice_noDriverFound(device_pt device);
 celix_status_t refiningDriverDevice_createService(refining_driver_device_pt, refining_driver_device_service_pt *service);
+celix_status_t refiningDriverDevice_destroyService(refining_driver_device_service_pt service);
 celix_status_t refiningDriverDevice_getNextWord(refining_driver_device_pt refiningDriverDevice, char **word);
 
 #endif /* REFINING_DRIVER_PRIVATE_H_ */
diff --git a/device_access/example/refining_driver/private/src/refining_driver.c b/device_access/example/refining_driver/private/src/refining_driver.c
index fe3e03e..404bc42 100644
--- a/device_access/example/refining_driver/private/src/refining_driver.c
+++ b/device_access/example/refining_driver/private/src/refining_driver.c
@@ -167,8 +167,9 @@
 	celix_status_t status = CELIX_SUCCESS;
 	refining_driver_device_service_pt service = NULL;
 	status = refiningDriverDevice_createService(device, &service);
+	properties_pt props = properties_create();
+
 	if (status == CELIX_SUCCESS) {
-		properties_pt props = properties_create();
 		properties_set(props, OSGI_DEVICEACCESS_DEVICE_CATEGORY, REFINING_DRIVER_DEVICE_CATEGORY);
 		properties_set(props, OSGI_DEVICEACCESS_DEVICE_SERIAL, serial);
 		status = bundleContext_registerService(driver->context, OSGI_DEVICEACCESS_DEVICE_SERVICE_NAME, service, props, &device->deviceRegistration);
@@ -177,6 +178,10 @@
 	if (status == CELIX_SUCCESS) {
 		printf("REFINING_DRIVER: registered refining device with serial %s\n", serial);
 	}
+	else{
+		properties_destroy(props);
+		refiningDriverDevice_destroyService(service);
+	}
 	return status;
 }
 
@@ -205,7 +210,7 @@
 	int match = 0;
 	celix_status_t status = CELIX_SUCCESS;
 
-    char *category = NULL;
+    const char* category = NULL;
     status = serviceReference_getProperty(reference, OSGI_DEVICEACCESS_DEVICE_CATEGORY, &category);
     if (status == CELIX_SUCCESS) {
         if (strcmp(category, BASE_DRIVER_DEVICE_CATEGORY) == 0) {
@@ -235,6 +240,16 @@
 	return status;
 }
 
+celix_status_t refiningDriverDevice_destroyService(refining_driver_device_service_pt service){
+	if(service != NULL){
+		if(service->deviceService.device != NULL){
+			free(service->deviceService.device);
+		}
+		free(service);
+	}
+	return CELIX_SUCCESS;
+}
+
 celix_status_t refiningDriverDevice_getNextWord(refining_driver_device_pt refiningDriverDevice, char **word) {
 	celix_status_t status = CELIX_SUCCESS;
 	base_driver_device_pt baseDevice = refiningDriverDevice->baseDriverDeviceService->baseDriverDevice;
diff --git a/dfi/CMakeLists.txt b/dfi/CMakeLists.txt
index 78ee2e5..c672f94 100644
--- a/dfi/CMakeLists.txt
+++ b/dfi/CMakeLists.txt
@@ -28,10 +28,10 @@
 
 set(MEMSTREAM_SOURCES )
 set(MEMSTREAM_INCLUDES )
-if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR ANDROID) 
-	set(MEMSTREAM_SOURCES private/src/memstream/open_memstream.c private/src/memstream/fmemopen.c)
-	set(MEMSTREAM_INCLUDES public/include/memstream/open_memstream.h public/include/memstream/fmemopen.h)
-    include_directories(public/include/memstream)
+if (APPLE OR ANDROID)
+	set(MEMSTREAM_SOURCES ${PROJECT_SOURCE_DIR}/utils/private/src/memstream/open_memstream.c  ${PROJECT_SOURCE_DIR}/utils/private/src/memstream/fmemopen.c)
+	set(MEMSTREAM_INCLUDES ${PROJECT_SOURCE_DIR}/utils/public/include/memstream/open_memstream.h ${PROJECT_SOURCE_DIR}/utils/public/include/memstream/fmemopen.h)
+    include_directories(${PROJECT_SOURCE_DIR}/utils/public/include/memstream)
 endif()
 
 add_library(celix_dfi SHARED
@@ -56,7 +56,7 @@
 set_target_properties(celix_dfi PROPERTIES "SOVERSION" 1)
 target_link_libraries(celix_dfi celix_utils ${FFI_LIBRARIES} ${JANSSON_LIBRARY})
 
-install(TARGETS celix_dfi DESTINATION lib COMPONENT framework)
+install(TARGETS celix_dfi DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT framework)
 FILE(GLOB files "public/include/*.h" ${MEMSTREAM_INCLUDES})
 INSTALL(FILES ${files} DESTINATION include/celix/dfi COMPONENT framework)
 
diff --git a/dfi/private/src/dyn_common.c b/dfi/private/src/dyn_common.c
index 00c3d3a..ea8f425 100644
--- a/dfi/private/src/dyn_common.c
+++ b/dfi/private/src/dyn_common.c
@@ -23,7 +23,7 @@
 #include <ctype.h>
 #include <stdbool.h>
 
-#if defined(BSD) || defined(__APPLE__) 
+#if defined(BSD) || defined(__APPLE__)  || defined(ANDROID)
 #include "open_memstream.h"
 #include "fmemopen.h"
 #endif
diff --git a/dfi/private/src/dyn_function.c b/dfi/private/src/dyn_function.c
index 3727f8a..615ad16 100644
--- a/dfi/private/src/dyn_function.c
+++ b/dfi/private/src/dyn_function.c
@@ -157,7 +157,7 @@
         dyn_function_argument_type *arg = NULL;
 
         status = dynType_parse(descriptor, NULL, dynFunc->refTypes, &type);
-        if (status == 0) {
+        if (status == OK) {
             arg = calloc(1, sizeof(*arg));
             if (arg != NULL) {
                 arg->index = index;
@@ -174,15 +174,8 @@
 
         if (status == OK) {
             TAILQ_INSERT_TAIL(&dynFunc->arguments, arg, entries);
-        } else {
-            if (arg != NULL) {
-                free(arg->name);
-                if (arg->type != NULL) {
-                    dynType_destroy(arg->type);
-                }
-                free(arg);
-            }
         }
+
         nextChar = fgetc(descriptor);
     }
 
@@ -217,7 +210,7 @@
         count +=1;
     }
 
-    dynFunc->ffiArguments = calloc(count, sizeof(ffi_type));
+    dynFunc->ffiArguments = calloc(count, sizeof(ffi_type*));
 
     TAILQ_FOREACH(entry, &dynFunc->arguments, entries) {
         dynFunc->ffiArguments[entry->index] = dynType_ffiType(entry->type);
diff --git a/dfi/private/src/dyn_interface.c b/dfi/private/src/dyn_interface.c
index fdd872d..cbd675b 100644
--- a/dfi/private/src/dyn_interface.c
+++ b/dfi/private/src/dyn_interface.c
@@ -57,12 +57,12 @@
         TAILQ_INIT(&intf->types);
         TAILQ_INIT(&intf->methods);
 
-        char peek = fgetc(descriptor);
+        char peek = (char)fgetc(descriptor);
         while (peek == ':') {
             ungetc(peek, descriptor);
             status = dynInterface_parseSection(intf, descriptor);
             if (status == OK) {
-                peek = fgetc(descriptor);
+                peek = (char)fgetc(descriptor);
             } else {
                 break;
             }
@@ -217,9 +217,6 @@
             if (value != NULL) {
                 free(value);
             }
-            if (entry != NULL) {
-                free(entry);
-            }
             break;
         }
         peek = fgetc(stream);
@@ -272,9 +269,6 @@
             if (type != NULL) {
                 dynType_destroy(type);
             }
-            if (entry != NULL) {
-                free(entry);
-            }
             break;
         }
         peek = fgetc(stream);
@@ -344,9 +338,6 @@
                 dynFunction_destroy(func);
                 //TODO free strIdentier, name
             }
-            if (entry != NULL) {
-                free(entry);
-            }
             break;
         }
         peek = fgetc(stream);
diff --git a/dfi/private/src/dyn_message.c b/dfi/private/src/dyn_message.c
index 5ec6c7a..652be83 100644
--- a/dfi/private/src/dyn_message.c
+++ b/dfi/private/src/dyn_message.c
@@ -55,12 +55,12 @@
         TAILQ_INIT(&msg->annotations);
         TAILQ_INIT(&msg->types);
 
-        char peek = fgetc(descriptor);
+        char peek = (char)fgetc(descriptor);
         while (peek == ':') {
             ungetc(peek, descriptor);
             status = dynMessage_parseSection(msg, descriptor);
             if (status == OK) {
-                peek = fgetc(descriptor);
+                peek = (char)fgetc(descriptor);
             } else {
                 break;
             }
@@ -93,6 +93,7 @@
     if (status == OK) {
         *out = msg;
     } else if (msg != NULL) {
+        LOG_ERROR("Error parsing msg\n");
         dynMessage_destroy(msg);
     }
     return status;
@@ -205,9 +206,6 @@
             if (value != NULL) {
                 free(value);
             }
-            if (entry != NULL) {
-                free(entry);
-            }
             break;
         }
         peek = fgetc(stream);
@@ -225,7 +223,7 @@
     while (peek != ':' && peek != EOF) {
         ungetc(peek, stream);
 
-        char *name;
+        char *name = NULL;
         status = dynCommon_parseName(stream, &name);
 
         if (status == OK) {
@@ -234,10 +232,7 @@
 
         dyn_type *type = NULL;
         if (status == OK) {
-            dynType_parse(stream, name, &msg->types, &type);
-        }
-        if (name != NULL) {
-            free(name);
+            status = dynType_parse(stream, name, &msg->types, &type);
         }
 
         if (status == OK) {
@@ -248,6 +243,7 @@
         if (status == OK) {
             entry = calloc(1, sizeof(*entry));
             if (entry != NULL) {
+                LOG_DEBUG("Adding type '%s' with pointer %p to types", name, type);
                 entry->type = type;
                 TAILQ_INSERT_TAIL(&msg->types, entry, entries);
             } else {
@@ -256,13 +252,14 @@
             }
         }
 
+        if (name != NULL) {
+            free(name);
+        }
+
         if (status != OK) {
             if (type != NULL) {
                 dynType_destroy(type);
             }
-            if (entry != NULL) {
-                free(entry);
-            }
             break;
         }
         peek = fgetc(stream);
diff --git a/dfi/private/src/dyn_type.c b/dfi/private/src/dyn_type.c
index 9b98a43..9beea1d 100644
--- a/dfi/private/src/dyn_type.c
+++ b/dfi/private/src/dyn_type.c
@@ -313,7 +313,7 @@
 
     if (status == OK) {
         type->complex.structType.type =  FFI_TYPE_STRUCT;
-        type->complex.structType.elements = calloc(count + 1, sizeof(ffi_type));
+        type->complex.structType.elements = calloc(count + 1, sizeof(ffi_type*));
         if (type->complex.structType.elements != NULL) {
             type->complex.structType.elements[count] = NULL;
             int index = 0;
@@ -328,7 +328,7 @@
 
     if (status == OK) {
         type->complex.types = calloc(count, sizeof(dyn_type *));
-        if (type != NULL) {
+        if (type->complex.types != NULL) {
             int index = 0;
             TAILQ_FOREACH(entry, &type->complex.entriesHead, entries) {
                 type->complex.types[index++] = entry->type;
@@ -427,15 +427,14 @@
             LOG_ERROR("Error cannot find type '%s'", name);
         }
         free(name);
-    } 
 
-    if (status == OK) {
         int c = fgetc(stream);
         if (c != ';') {
             status = PARSE_ERROR;
             LOG_ERROR("Error expected ';' got '%c'", c);
         } 
-    }
+    } 
+
 
     return status;
 }
@@ -635,6 +634,7 @@
 
 int dynType_complex_dynTypeAt(dyn_type *type, int index, dyn_type **result) {
     assert(type->type == DYN_TYPE_COMPLEX);
+    assert(index >= 0);
     dyn_type *sub = type->complex.types[index];
     if (sub->type == DYN_TYPE_REF) {
         sub = sub->ref.ref;
@@ -656,7 +656,7 @@
     char *l = (char *)inst;
     void *loc = (void *)(l + dynType_getOffset(type, index));
     *result = loc;
-    return 0;
+    return OK;
 }
 
 int dynType_complex_entries(dyn_type *type, struct complex_type_entries_head **entries) {
@@ -1071,8 +1071,9 @@
     dynType_printDepth(depth, stream);
     fprintf(stream, "%s: typed pointer, size is %zu, alignment is %i, points to ->\n", name, type->ffiType->size, type->ffiType->alignment);
     char *subName = NULL;
+    char buf[128];
+    memset(buf,0,128);
     if (name != NULL) {
-        char buf[128];
         snprintf(buf, 128, "*%s", name);
         subName = buf;
     }
diff --git a/dfi/private/src/json_rpc.c b/dfi/private/src/json_rpc.c
index 20d453d..0abbc93 100644
--- a/dfi/private/src/json_rpc.c
+++ b/dfi/private/src/json_rpc.c
@@ -35,302 +35,307 @@
 typedef void (*gen_func_type)(void);
 
 struct generic_service_layout {
-    void *handle;
-    gen_func_type methods[];
+	void *handle;
+	gen_func_type methods[];
 };
 
 int jsonRpc_call(dyn_interface_type *intf, void *service, const char *request, char **out) {
-    int status = OK;
+	int status = OK;
 
-    dyn_type* returnType = NULL;
+	dyn_type* returnType = NULL;
 
-    LOG_DEBUG("Parsing data: %s\n", request);
-    json_error_t error;
-    json_t *js_request = json_loads(request, 0, &error);
-    json_t *arguments = NULL;
-    const char *sig;
-    if (js_request) {
-        if (json_unpack(js_request, "{s:s}", "m", &sig) != 0) {
-            LOG_ERROR("Got json error '%s'\n", error.text);
-        } else {
-            arguments = json_object_get(js_request, "a");
-        }
-    } else {
-        LOG_ERROR("Got json error '%s' for '%s'\n", error.text, request);
-        return 0;
-    }
+	LOG_DEBUG("Parsing data: %s\n", request);
+	json_error_t error;
+	json_t *js_request = json_loads(request, 0, &error);
+	json_t *arguments = NULL;
+	const char *sig;
+	if (js_request) {
+		if (json_unpack(js_request, "{s:s}", "m", &sig) != 0) {
+			LOG_ERROR("Got json error '%s'\n", error.text);
+		} else {
+			arguments = json_object_get(js_request, "a");
+		}
+	} else {
+		LOG_ERROR("Got json error '%s' for '%s'\n", error.text, request);
+		return 0;
+	}
 
-    LOG_DEBUG("Looking for method %s\n", sig);
-    struct methods_head *methods = NULL;
-    dynInterface_methods(intf, &methods);
-    struct method_entry *entry = NULL;
-    struct method_entry *method = NULL;
-    TAILQ_FOREACH(entry, methods, entries) {
-        if (strcmp(sig, entry->id) == 0) {
-            method = entry;
-            break;
-        }
-    }
+	LOG_DEBUG("Looking for method %s\n", sig);
+	struct methods_head *methods = NULL;
+	dynInterface_methods(intf, &methods);
+	struct method_entry *entry = NULL;
+	struct method_entry *method = NULL;
+	TAILQ_FOREACH(entry, methods, entries) {
+		if (strcmp(sig, entry->id) == 0) {
+			method = entry;
+			break;
+		}
+	}
 
-    if (method == NULL) {
-        status = ERROR;
-        LOG_ERROR("Cannot find method with sig '%s'", sig);
-    }
+	if (method == NULL) {
+		status = ERROR;
+		LOG_ERROR("Cannot find method with sig '%s'", sig);
+	}
+	else if (status == OK) {
+		LOG_DEBUG("RSA: found method '%s'\n", entry->id);
+		returnType = dynFunction_returnType(method->dynFunc);
+	}
 
-    if (status == OK) {
-        LOG_DEBUG("RSA: found method '%s'\n", entry->id);
-        returnType = dynFunction_returnType(method->dynFunc);
-    }
+	void (*fp)(void) = NULL;
+	void *handle = NULL;
+	if (status == OK) {
+		struct generic_service_layout *serv = service;
+		handle = serv->handle;
+		fp = serv->methods[method->index];
+	}
 
-    void (*fp)(void) = NULL;
-    void *handle = NULL;
-    if (status == OK) {
-        struct generic_service_layout *serv = service;
-        handle = serv->handle;
-        fp = serv->methods[method->index];
-    }
+	dyn_function_type *func = NULL;
+	int nrOfArgs = 0;
+	if (status == OK) {
+		nrOfArgs = dynFunction_nrOfArguments(entry->dynFunc);
+		func = entry->dynFunc;
+	}
 
-    dyn_function_type *func = NULL;
-    int nrOfArgs = 0;
-    if (status == OK) {
-        nrOfArgs = dynFunction_nrOfArguments(entry->dynFunc);
-        func = entry->dynFunc;
-    }
+	void *args[nrOfArgs];
 
-    void *args[nrOfArgs];
+	json_t *value = NULL;
 
-    json_t *value = NULL;
+	int i;
+	int index = 0;
 
-    int i;
-    int index = 0;
+	void *ptr = NULL;
+	void *ptrToPtr = &ptr;
 
-    void *ptr = NULL;
-    void *ptrToPtr = &ptr;
+	for (i = 0; i < nrOfArgs; i += 1) {
+		dyn_type *argType = dynFunction_argumentTypeForIndex(func, i);
+		enum dyn_function_argument_meta  meta = dynFunction_argumentMetaForIndex(func, i);
+		if (meta == DYN_FUNCTION_ARGUMENT_META__STD) {
+			value = json_array_get(arguments, index++);
+			status = jsonSerializer_deserializeJson(argType, value, &(args[i]));
+		} else if (meta == DYN_FUNCTION_ARGUMENT_META__PRE_ALLOCATED_OUTPUT) {
+			dynType_alloc(argType, &args[i]);
+		} else if (meta == DYN_FUNCTION_ARGUMENT_META__OUTPUT) {
+			args[i] = &ptrToPtr;
+		} else if (meta == DYN_FUNCTION_ARGUMENT_META__HANDLE) {
+			args[i] = &handle;
+		}
 
-    for (i = 0; i < nrOfArgs; i += 1) {
-        dyn_type *argType = dynFunction_argumentTypeForIndex(func, i);
-        enum dyn_function_argument_meta  meta = dynFunction_argumentMetaForIndex(func, i);
-        if (meta == DYN_FUNCTION_ARGUMENT_META__STD) {
-            value = json_array_get(arguments, index++);
-            status = jsonSerializer_deserializeJson(argType, value, &(args[i]));
-        } else if (meta == DYN_FUNCTION_ARGUMENT_META__PRE_ALLOCATED_OUTPUT) {
-            dynType_alloc(argType, &args[i]);
-        } else if (meta == DYN_FUNCTION_ARGUMENT_META__OUTPUT) {
-            args[i] = &ptrToPtr;
-        } else if (meta == DYN_FUNCTION_ARGUMENT_META__HANDLE) {
-            args[i] = &handle;
-        }
+		if (status != OK) {
+			break;
+		}
+	}
+	json_decref(js_request);
 
-        if (status != OK) {
-            break;
-        }
-    }
-    json_decref(js_request);
-
-    if (status == OK) {
+	if (status == OK) {
 		if (dynType_descriptorType(returnType) != 'N') {
 			//NOTE To be able to handle exception only N as returnType is supported
 			LOG_ERROR("Only interface methods with a native int are supported. Found type '%c'", (char)dynType_descriptorType(returnType));
 			status = ERROR;
 		}
-    }
+	}
 
-    ffi_sarg returnVal = 1;
+	ffi_sarg returnVal = 1;
 
-    if (status == OK) {
-        dynFunction_call(func, fp, (void *) &returnVal, args);
-    }
+	if (status == OK) {
+		dynFunction_call(func, fp, (void *) &returnVal, args);
+	}
 
-    int funcCallStatus = (int)returnVal;
-    if (funcCallStatus != 0) {
-        LOG_WARNING("Error calling remote endpoint function, got error code %i", funcCallStatus);
-    }
+	int funcCallStatus = (int)returnVal;
+	if (funcCallStatus != 0) {
+		LOG_WARNING("Error calling remote endpoint function, got error code %i", funcCallStatus);
+	}
 
-    json_t *jsonResult = NULL;
-    for(i = 0; i < nrOfArgs; i += 1) {
-        dyn_type *argType = dynFunction_argumentTypeForIndex(func, i);
-        enum dyn_function_argument_meta  meta = dynFunction_argumentMetaForIndex(func, i);
-        if (meta == DYN_FUNCTION_ARGUMENT_META__STD) {
-            dynType_free(argType, args[i]);
-        }
-    }
+	json_t *jsonResult = NULL;
+	for(i = 0; i < nrOfArgs; i += 1) {
+		dyn_type *argType = dynFunction_argumentTypeForIndex(func, i);
+		enum dyn_function_argument_meta  meta = dynFunction_argumentMetaForIndex(func, i);
+		if (meta == DYN_FUNCTION_ARGUMENT_META__STD) {
+			dynType_free(argType, args[i]);
+		}
+	}
 
-    if (funcCallStatus == 0 && status == OK) {
-        for (i = 0; i < nrOfArgs; i += 1) {
-            dyn_type *argType = dynFunction_argumentTypeForIndex(func, i);
-            enum dyn_function_argument_meta  meta = dynFunction_argumentMetaForIndex(func, i);
-            if (meta == DYN_FUNCTION_ARGUMENT_META__PRE_ALLOCATED_OUTPUT) {
-                if (status == OK) {
-                    status = jsonSerializer_serializeJson(argType, args[i], &jsonResult);
-                }
-                dynType_free(argType, args[i]);
-            } else if (meta == DYN_FUNCTION_ARGUMENT_META__OUTPUT) {
-                if (ptr != NULL) {
-                    dyn_type *typedType = NULL;
-                    if (status == OK) {
-                        status = dynType_typedPointer_getTypedType(argType, &typedType);
-                    }
-                    if (dynType_descriptorType(typedType) == 't') {
-                        status = jsonSerializer_serializeJson(typedType, (void*) &ptr, &jsonResult);
-                        free(ptr);
-                    } else {
-                        dyn_type *typedTypedType = NULL;
-                        if (status == OK) {
-                            status = dynType_typedPointer_getTypedType(typedType, &typedTypedType);
-                        }
+	if (funcCallStatus == 0 && status == OK) {
+		for (i = 0; i < nrOfArgs; i += 1) {
+			dyn_type *argType = dynFunction_argumentTypeForIndex(func, i);
+			enum dyn_function_argument_meta  meta = dynFunction_argumentMetaForIndex(func, i);
+			if (meta == DYN_FUNCTION_ARGUMENT_META__PRE_ALLOCATED_OUTPUT) {
+				if (status == OK) {
+					status = jsonSerializer_serializeJson(argType, args[i], &jsonResult);
+				}
+				dynType_free(argType, args[i]);
+			} else if (meta == DYN_FUNCTION_ARGUMENT_META__OUTPUT) {
+				if (ptr != NULL) {
+					dyn_type *typedType = NULL;
+					if (status == OK) {
+						status = dynType_typedPointer_getTypedType(argType, &typedType);
+					}
+					if (dynType_descriptorType(typedType) == 't') {
+						status = jsonSerializer_serializeJson(typedType, (void*) &ptr, &jsonResult);
+						free(ptr);
+					} else {
+						dyn_type *typedTypedType = NULL;
+						if (status == OK) {
+							status = dynType_typedPointer_getTypedType(typedType, &typedTypedType);
+						}
 
-                        status = jsonSerializer_serializeJson(typedTypedType, ptr, &jsonResult);
+						if(status == OK){
+							status = jsonSerializer_serializeJson(typedTypedType, ptr, &jsonResult);
+						}
 
-                        if (status == OK) {
-                            dynType_free(typedTypedType, ptr);
-                        }
-                    }
+						if (status == OK) {
+							dynType_free(typedTypedType, ptr);
+						}
+					}
 
-                } else {
-                    LOG_DEBUG("Output ptr is null");
-                }
-            }
+				} else {
+					LOG_DEBUG("Output ptr is null");
+				}
+			}
 
-            if (status != OK) {
-                break;
-            }
-        }
-    }
+			if (status != OK) {
+				break;
+			}
+		}
+	}
 
-    char *response = NULL;
-    if (status == OK) {
-        LOG_DEBUG("creating payload\n");
-        json_t *payload = json_object();
-        if (funcCallStatus == 0) {
-            if (jsonResult == NULL) {
-                //ignore -> no result
-            } else {
-                LOG_DEBUG("Setting result payload");
-                json_object_set_new(payload, "r", jsonResult);
-            }
-        } else {
-            LOG_DEBUG("Setting error payload");
-            json_object_set_new(payload, "e", json_integer(funcCallStatus));
-        }
-        response = json_dumps(payload, JSON_DECODE_ANY);
-        json_decref(payload);
-        LOG_DEBUG("status ptr is %p. response is '%s'\n", status, response);
-    }
+	char *response = NULL;
+	if (status == OK) {
+		LOG_DEBUG("creating payload\n");
+		json_t *payload = json_object();
+		if (funcCallStatus == 0) {
+			if (jsonResult == NULL) {
+				//ignore -> no result
+			} else {
+				LOG_DEBUG("Setting result payload");
+				json_object_set_new(payload, "r", jsonResult);
+			}
+		} else {
+			LOG_DEBUG("Setting error payload");
+			json_object_set_new(payload, "e", json_integer(funcCallStatus));
+		}
+		response = json_dumps(payload, JSON_DECODE_ANY);
+		json_decref(payload);
+		LOG_DEBUG("status ptr is %p. response is '%s'\n", status, response);
+	}
 
-    if (status == OK) {
-        *out = response;
-    } else {
-        free(response);
-    }
+	if (status == OK) {
+		*out = response;
+	} else {
+		free(response);
+	}
 
-    return status;
+	return status;
 }
 
 int jsonRpc_prepareInvokeRequest(dyn_function_type *func, const char *id, void *args[], char **out) {
-    int status = OK;
+	int status = OK;
 
 
-    LOG_DEBUG("Calling remote function '%s'\n", id);
-    json_t *invoke = json_object();
-    json_object_set_new(invoke, "m", json_string(id));
+	LOG_DEBUG("Calling remote function '%s'\n", id);
+	json_t *invoke = json_object();
+	json_object_set_new(invoke, "m", json_string(id));
 
-    json_t *arguments = json_array();
-    json_object_set_new(invoke, "a", arguments);
+	json_t *arguments = json_array();
+	json_object_set_new(invoke, "a", arguments);
 
-    int i;
-    int nrOfArgs = dynFunction_nrOfArguments(func);
-    for (i = 0; i < nrOfArgs; i +=1) {
-        dyn_type *type = dynFunction_argumentTypeForIndex(func, i);
-        enum dyn_function_argument_meta  meta = dynFunction_argumentMetaForIndex(func, i);
-        if (meta == DYN_FUNCTION_ARGUMENT_META__STD) {
-            json_t *val = NULL;
+	int i;
+	int nrOfArgs = dynFunction_nrOfArguments(func);
+	for (i = 0; i < nrOfArgs; i +=1) {
+		dyn_type *type = dynFunction_argumentTypeForIndex(func, i);
+		enum dyn_function_argument_meta  meta = dynFunction_argumentMetaForIndex(func, i);
+		if (meta == DYN_FUNCTION_ARGUMENT_META__STD) {
+			json_t *val = NULL;
 
-            int rc = jsonSerializer_serializeJson(type, args[i], &val);
-            if (rc == 0) {
-                json_array_append_new(arguments, val);
-            } else {
-                status = ERROR;
-                break;
-            }
-        } else {
-            //skip handle / output types
-        }
-    }
+			int rc = jsonSerializer_serializeJson(type, args[i], &val);
+			if (rc == 0) {
+				json_array_append_new(arguments, val);
+			} else {
+				status = ERROR;
+				break;
+			}
+		} else {
+			//skip handle / output types
+		}
+	}
 
-    char *invokeStr = json_dumps(invoke, JSON_DECODE_ANY);
-    json_decref(invoke);
+	char *invokeStr = json_dumps(invoke, JSON_DECODE_ANY);
+	json_decref(invoke);
 
-    if (status == OK) {
-        *out = invokeStr;
-    }
+	if (status == OK) {
+		*out = invokeStr;
+	}
 
-    return status;
+	return status;
 }
 
 int jsonRpc_handleReply(dyn_function_type *func, const char *reply, void *args[]) {
-    int status = OK;
+	int status = OK;
 
-    json_error_t error;
-    json_t *replyJson = json_loads(reply, JSON_DECODE_ANY, &error);
-    if (replyJson == NULL) {
-        status = ERROR;
-        LOG_ERROR("Error parsing json '%s', got error '%s'", reply, error.text);
-    }
+	json_error_t error;
+	json_t *replyJson = json_loads(reply, JSON_DECODE_ANY, &error);
+	if (replyJson == NULL) {
+		status = ERROR;
+		LOG_ERROR("Error parsing json '%s', got error '%s'", reply, error.text);
+	}
 
-    json_t *result = NULL;
-    if (status == OK) {
-        result = json_object_get(replyJson, "r"); //TODO check
-        if (result == NULL) {
-            status = ERROR;
-            LOG_ERROR("Cannot find r entry in json reply '%s'", reply);
-        }
-    }
+	json_t *result = NULL;
+	if (status == OK) {
+		result = json_object_get(replyJson, "r"); //TODO check
+		if (result == NULL) {
+			status = ERROR;
+			LOG_ERROR("Cannot find r entry in json reply '%s'", reply);
+		}
+	}
 
-    if (status == OK) {
-        int nrOfArgs = dynFunction_nrOfArguments(func);
-        int i;
-        for (i = 0; i < nrOfArgs; i += 1) {
-            dyn_type *argType = dynFunction_argumentTypeForIndex(func, i);
-            enum dyn_function_argument_meta meta = dynFunction_argumentMetaForIndex(func, i);
-            if (meta == DYN_FUNCTION_ARGUMENT_META__PRE_ALLOCATED_OUTPUT) {
-                void *tmp = NULL;
-                void **out = (void **) args[i];
+	if (status == OK) {
+		int nrOfArgs = dynFunction_nrOfArguments(func);
+		int i;
+		for (i = 0; i < nrOfArgs; i += 1) {
+			dyn_type *argType = dynFunction_argumentTypeForIndex(func, i);
+			enum dyn_function_argument_meta meta = dynFunction_argumentMetaForIndex(func, i);
+			if (meta == DYN_FUNCTION_ARGUMENT_META__PRE_ALLOCATED_OUTPUT) {
+				void *tmp = NULL;
+				void **out = (void **) args[i];
 
-                size_t size = 0;
+				size_t size = 0;
 
-                if (dynType_descriptorType(argType) == 't') {
-                    status = jsonSerializer_deserializeJson(argType, result, &tmp);
-                    size = strnlen(((char *) *(char**) tmp), 1024 * 1024);
-                    memcpy(*out, *(void**) tmp, size);
-                } else {
-                    dynType_typedPointer_getTypedType(argType, &argType);
-                    status = jsonSerializer_deserializeJson(argType, result, &tmp);
-                    size = dynType_size(argType);
-                    memcpy(*out, tmp, size);
-                }
+				if (dynType_descriptorType(argType) == 't') {
+					status = jsonSerializer_deserializeJson(argType, result, &tmp);
+					if(tmp!=NULL){
+						size = strnlen(((char *) *(char**) tmp), 1024 * 1024);
+						memcpy(*out, *(void**) tmp, size);
+					}
+				} else {
+					dynType_typedPointer_getTypedType(argType, &argType);
+					status = jsonSerializer_deserializeJson(argType, result, &tmp);
+					if(tmp!=NULL){
+						size = dynType_size(argType);
+						memcpy(*out, tmp, size);
+					}
+				}
 
-                dynType_free(argType, tmp);
-            } else if (meta == DYN_FUNCTION_ARGUMENT_META__OUTPUT) {
-                dyn_type *subType = NULL;
+				dynType_free(argType, tmp);
+			} else if (meta == DYN_FUNCTION_ARGUMENT_META__OUTPUT) {
+				dyn_type *subType = NULL;
 
-                dynType_typedPointer_getTypedType(argType, &subType);
+				dynType_typedPointer_getTypedType(argType, &subType);
 
-                if (dynType_descriptorType(subType) == 't') {
-                    void ***out = (void ***) args[i];
-                    status = jsonSerializer_deserializeJson(subType, result, *out);
-                } else {
-                    dyn_type *subSubType = NULL;
-                    dynType_typedPointer_getTypedType(subType, &subSubType);
-                    void ***out = (void ***) args[i];
-                    status = jsonSerializer_deserializeJson(subSubType, result, *out);
-                }
-            } else {
-                //skip
-            }
-        }
-    }
+				if (dynType_descriptorType(subType) == 't') {
+					void ***out = (void ***) args[i];
+					status = jsonSerializer_deserializeJson(subType, result, *out);
+				} else {
+					dyn_type *subSubType = NULL;
+					dynType_typedPointer_getTypedType(subType, &subSubType);
+					void ***out = (void ***) args[i];
+					status = jsonSerializer_deserializeJson(subSubType, result, *out);
+				}
+			} else {
+				//skip
+			}
+		}
+	}
 
-    json_decref(replyJson);
+	json_decref(replyJson);
 
-    return status;
+	return status;
 }
diff --git a/dfi/private/src/json_serializer.c b/dfi/private/src/json_serializer.c
index 1a9b4b0..0c06998 100644
--- a/dfi/private/src/json_serializer.c
+++ b/dfi/private/src/json_serializer.c
@@ -82,17 +82,15 @@
         if (status == OK) {
             assert(inst != NULL);
             status = jsonSerializer_parseAny(type, inst, val);
-
-            if (status != OK) {
-                dynType_free(type, inst);
-            }
         }
     }
 
-
     if (status == OK) {
         *result = inst;
     }
+    else{
+    	dynType_free(type, inst);
+    }
 
     return status;
 }
@@ -450,8 +448,14 @@
             json_t *subVal = NULL;
             dyn_type *subType = NULL;
             index = dynType_complex_indexForName(type, entry->name);
-            status = dynType_complex_valLocAt(type, index, input, &subLoc);
-            if (status == OK ) {
+            if (index < 0) {
+		LOG_ERROR("Cannot find index for member '%s'", entry->name);
+                status = ERROR;
+            }
+            if(status == OK){
+		status = dynType_complex_valLocAt(type, index, input, &subLoc);
+            }
+            if (status == OK) {
                 status = dynType_complex_dynTypeAt(type, index, &subType);
             }
             if (status == OK) {
diff --git a/dfi/private/test/avro_descriptor_translator_tests.cpp b/dfi/private/test/avro_descriptor_translator_tests.cpp
index c29932e..5bab518 100644
--- a/dfi/private/test/avro_descriptor_translator_tests.cpp
+++ b/dfi/private/test/avro_descriptor_translator_tests.cpp
@@ -40,6 +40,7 @@
         va_start(ap, msg);
         vfprintf(stderr, msg, ap);
         fprintf(stderr, "\n");
+        va_end(ap);
     }
 
 
diff --git a/dfi/private/test/dyn_closure_tests.cpp b/dfi/private/test/dyn_closure_tests.cpp
index ce70f93..5f13de4 100644
--- a/dfi/private/test/dyn_closure_tests.cpp
+++ b/dfi/private/test/dyn_closure_tests.cpp
@@ -39,6 +39,7 @@
     va_start(ap, msg);
     vfprintf(stderr, msg, ap);
     fprintf(stderr, "\n");
+    va_end(ap);
 }
 
 #define EXAMPLE1_DESCRIPTOR "example(III)I"
diff --git a/dfi/private/test/dyn_function_tests.cpp b/dfi/private/test/dyn_function_tests.cpp
index 1b65be8..34d7116 100644
--- a/dfi/private/test/dyn_function_tests.cpp
+++ b/dfi/private/test/dyn_function_tests.cpp
@@ -37,6 +37,7 @@
         va_start(ap, msg);
         vfprintf(stderr, msg, ap);
         fprintf(stderr, "\n");
+        va_end(ap);
     }
 
     #define EXAMPLE1_DESCRIPTOR "example(III)I"
diff --git a/dfi/private/test/dyn_interface_tests.cpp b/dfi/private/test/dyn_interface_tests.cpp
index d3ef642..ea578f2 100644
--- a/dfi/private/test/dyn_interface_tests.cpp
+++ b/dfi/private/test/dyn_interface_tests.cpp
@@ -42,6 +42,7 @@
         va_start(ap, msg);
         vfprintf(stderr, msg, ap);
         fprintf(stderr, "\n");
+        va_end(ap);
     }
 
     static void checkInterfaceVersion(dyn_interface_type* dynIntf, const char* v) {
@@ -118,57 +119,67 @@
         FILE *desc = fopen("descriptors/invalids/invalid.descriptor", "r");
         assert(desc != NULL);
         status = dynInterface_parse(desc, &dynIntf);
+        //dynInterface_destroy(dynIntf);
         CHECK_EQUAL(1, status); //Test fails because of a space at the end of the name
-        fclose(desc);
-        dynInterface_destroy(dynIntf);
+        fclose(desc); desc=NULL;
+
 
         /* Header without Version */
         desc = fopen("descriptors/invalids/noVersion.descriptor", "r");
+        assert(desc != NULL);
         status = dynInterface_parse(desc, &dynIntf);
+        //dynInterface_destroy(dynIntf);
         CHECK_EQUAL(1, status); //Test fails because of missing version field in header section
-        fclose(desc);
-        dynInterface_destroy(dynIntf);
+        fclose(desc); desc=NULL;
 
         /* Invalid section */
         desc = fopen("descriptors/invalids/invalidSection.descriptor", "r");
+        assert(desc != NULL);
         status = dynInterface_parse(desc, &dynIntf);
+        //dynInterface_destroy(dynIntf);
         CHECK_EQUAL(1, status); //Test fails because of unknown section type
-        fclose(desc);
-        dynInterface_destroy(dynIntf);
+        fclose(desc); desc=NULL;
 
         /* Invalid return type */
         desc = fopen("descriptors/invalids/invalidMethodReturnType.descriptor", "r");
+        assert(desc != NULL);
         status = dynInterface_parse(desc, &dynIntf);
+        //dynInterface_destroy(dynIntf);
         CHECK_EQUAL(1, status); //Test fails because of invalid return type (D instead of N)
-        fclose(desc);
-        dynInterface_destroy(dynIntf);
+        fclose(desc); desc=NULL;
 
         /* Invalid  method section */
         desc = fopen("descriptors/invalids/invalidMethod.descriptor", "r");
+        assert(desc != NULL);
         status = dynInterface_parse(desc, &dynIntf);
+        //dynInterface_destroy(dynIntf);
         CHECK_EQUAL(1, status); //Test fails because of space at the end of the method
-        fclose(desc);
-        dynInterface_destroy(dynIntf);
+        fclose(desc); desc=NULL;
 
         /* Invalid type */
         desc = fopen("descriptors/invalids/invalidType.descriptor", "r");
+        assert(desc != NULL);
         status = dynInterface_parse(desc, &dynIntf);
+        //dynInterface_destroy(dynIntf);
         CHECK_EQUAL(1, status); //Test fails because of space at the end of the type
-        fclose(desc);
-        dynInterface_destroy(dynIntf);
+        fclose(desc); desc=NULL;
 
         /* Invalid metatype in method description */
         desc = fopen("descriptors/invalids/invalidMetaType.descriptor", "r");
+        assert(desc != NULL);
         status = dynInterface_parse(desc, &dynIntf);
-        CHECK_EQUAL(0, status); //Invalid meta type doesn't generate errors, just warnings
-        fclose(desc);
         dynInterface_destroy(dynIntf);
+        CHECK_EQUAL(0, status); //Invalid meta type doesn't generate errors, just warnings
+        fclose(desc); desc=NULL; dynIntf=NULL;
 
         /* Invalid version section */
         desc = fopen("descriptors/invalids/invalidVersion.descriptor", "r");
+        assert(desc != NULL);
         status = dynInterface_parse(desc, &dynIntf);
+        //dynInterface_destroy(dynIntf);
         CHECK_EQUAL(1, status); //Invalid meta type doesn't generate errors, just warnings
-        fclose(desc);
+        fclose(desc); desc=NULL;
+
     }
 }
 
diff --git a/dfi/private/test/dyn_message_tests.cpp b/dfi/private/test/dyn_message_tests.cpp
index 7aafcc3..18c5505 100644
--- a/dfi/private/test/dyn_message_tests.cpp
+++ b/dfi/private/test/dyn_message_tests.cpp
@@ -43,6 +43,7 @@
 	va_start(ap, msg);
 	vfprintf(stderr, msg, ap);
 	fprintf(stderr, "\n");
+	va_end(ap);
 }
 
 static void checkMessageVersion(dyn_message_type* dynMsg, const char* v){
diff --git a/dfi/private/test/dyn_type_tests.cpp b/dfi/private/test/dyn_type_tests.cpp
index db95da4..e65c2b9 100644
--- a/dfi/private/test/dyn_type_tests.cpp
+++ b/dfi/private/test/dyn_type_tests.cpp
@@ -32,6 +32,7 @@
 	    va_start(ap, msg);
 	    vfprintf(stderr, msg, ap);
 	    fprintf(stderr, "\n");
+	    va_end(ap);
 	}
 
     static void runTest(const char *descriptorStr, const char *exName) {
diff --git a/dfi/private/test/json_rpc_tests.cpp b/dfi/private/test/json_rpc_tests.cpp
index 8b4044d..10097ec 100644
--- a/dfi/private/test/json_rpc_tests.cpp
+++ b/dfi/private/test/json_rpc_tests.cpp
@@ -42,6 +42,7 @@
     va_start(ap, msg);
     vfprintf(stderr, msg, ap);
     fprintf(stderr, "\n");
+    va_end(ap);
 }
 
 
@@ -138,7 +139,9 @@
         }
 
         struct tst_StatsResult *result = (struct tst_StatsResult *) calloc(1, sizeof(*result));
-        result->average = total / count;
+        if(count>0){
+		result->average = total / count;
+        }
         result->min = min;
         result->max = max;
         double *buf = (double *)calloc(input.len, sizeof(double));
@@ -367,7 +370,9 @@
         args[0] = NULL;
         args[1] = &out;
 
-        rc = jsonRpc_handleReply(func, reply, args);
+        if(func!=NULL){ // Check needed just to satisfy Coverity
+		rc = jsonRpc_handleReply(func, reply, args);
+        }
 
         STRCMP_EQUAL("this is a test string", result);
 
diff --git a/dfi/private/test/json_serializer_tests.cpp b/dfi/private/test/json_serializer_tests.cpp
index f4e9f2d..bd65b23 100644
--- a/dfi/private/test/json_serializer_tests.cpp
+++ b/dfi/private/test/json_serializer_tests.cpp
@@ -39,6 +39,7 @@
 	va_start(ap, msg);
 	vfprintf(stderr, msg, ap);
 	fprintf(stderr, "\n");
+	va_end(ap);
 }
 
 /*********** example 1 ************************/
diff --git a/documents/building/readme.md b/documents/building/readme.md
index 8df49c0..5f11efb 100644
--- a/documents/building/readme.md
+++ b/documents/building/readme.md
@@ -1,20 +1,34 @@
 #Apache Celix - Building and Installing
+Apache Celix aims to be support a broad range of UNIX platforms.
+ 
+Currently the [continuous integration build server](https://travis-ci.org/apache/celix) builds and tests Apache Celix for:
+
+*   Ubuntu Trusty Tahr (14.04)
+    * GCC 
+    * CLang 
+*   OSX
+    * GCC 
+    * CLang 
+*   Android (cross-compiled on Ubuntu Trusty Tahr) 
+    * GCC 
 
 #Preparing 
 The following packages (libraries + headers) should be installed on your system:
 
 *	Development Environment
-	*	build-essentials 
+	*	build-essentials (gcc/g++ or clang/clang++) 
 	* 	git
     *   java (for packaging bundles)
-	*	cmake (3 or higher)
+	*	cmake (3.2 or higher)
 * 	Apache Celix Dependencies
 	*	curl
 	*	jansson
+	*   libffi
+	*   libxml2 (for remote services and bonjour shell)
+	
 
-For a debian based systems, the following should work:
-
-<pre>
+For debian based systems (apt), the following command should work:
+```bash
 sudo apt-get install -yq --no-install-recommends \
 	build-essential \
     ninja \ 
@@ -23,11 +37,14 @@
   	libjansson-dev \
   	libcurl4-openssl-dev \
     java \
-  	cmake 
-</pre>
+  	cmake \
+  	libffi-dev \
+  	libxml2-dev
+```
 
-For Fedora based systems (dnf), the following should work:
-<pre>
+For Fedora based systems (dnf), the following command should work:
+```bash
+sudo dnf group install -y "C Development Tools and Libraries"
 sudo dnf install \
     cmake \
     ninja-build \
@@ -35,8 +52,18 @@
     git \
     java \
     libcurl-devel \
-    jansson-devel
-</pre>
+    jansson-devel \
+    libffi-devel \
+    libxml2-devel \
+    libuuid-devel
+```
+
+For OSX systems with brew installed, the following command should work:
+```bash
+    brew update && \
+    brew install lcov libffi cmake && \
+    brew link --force libffi
+```
 
 ##Download the Apache Celix sources
 To get started you first have to download the Apache Celix sources. This can be done by cloning the Apache Celix git repository:
@@ -74,8 +101,8 @@
 ```
 
 ##Editing Build options
-With use of CMake Apache Celix makes it possible to edit build options. This enabled users to configure a install location and selecting additional bundles.
-To edit the options use ccmake or cmake-gui. For cmake-gui an additional package install can be neccesary (Fedora: `dnf install cmake-gui`). 
+With use of CMake, Apache Celix makes it possible to edit build options. This enabled users, among other options, to configure a install location and select additional bundles.
+To edit the options use ccmake or cmake-gui. For cmake-gui an additional package install can be necessary (Fedora: `dnf install cmake-gui`). 
 
 ```bash
 cd ${WS}/celix/build
@@ -97,8 +124,10 @@
 ##Running Apache Celix
 
 If Apache Celix is succesfully installed running
-    celix
+```bash
+celix
+```
 should give the following output:
-"Error: invalid or non-existing configuration file: 'config.properties'.No such file or directory"
+"Error: invalid or non-existing configuration file: 'config.properties'.No such file or directory".
 
-For more info how to build your own projects and/or running the Apache Celix examples see [Getting Started](../getting_started/readme.md)
+For more info how to build your own projects and/or running the Apache Celix examples see [Getting Started](../getting_started/readme.md).
diff --git a/documents/cmake_commands/readme.md b/documents/cmake_commands/readme.md
index 30d863e..9045cf2 100644
--- a/documents/cmake_commands/readme.md
+++ b/documents/cmake_commands/readme.md
@@ -56,9 +56,9 @@
 - If DESCRIPTION is provided that will be used as Bundle-Description. Default this is empty
 - If VERSION is provided. That will be used for the Bundle-Version. In combination with SOURCES the version will alse be use to set the activator library target property VERSION and SOVERSION.
 For SOVERSION only the major part is used. Expected scheme is "<major>.<minor>.<path>". Default version is "0.0.0"
-If PRIVATE_LIBRARIES is provided all provided lib are added to the "Private-Library" manifest statement and added in the root of the bundle. libraries can be cmake library targets or absolute paths to existing libraries.  
+- If PRIVATE_LIBRARIES is provided all provided lib are added to the "Private-Library" manifest statement and added in the root of the bundle. libraries can be cmake library targets or absolute paths to existing libraries.  
 - If EXPORT_LIBRARIES is provided all provided lib are added to the "Export-Library" manifest statement and added in the root of the bundle. libraries can be cmake library targets or absolute paths to existing libraries. This is not yet supported by the celix framework.
-- If EXPORT_LIBRARIES is provided all provided lib are added to the "Import-Library" manifest statement and added in the root of the bundle. libraries can be cmake library targets or absolute paths to existing libraries.  This is not yet supported by the celix framework
+- If IMPORT_LIBRARIES is provided all provided lib are added to the "Import-Library" manifest statement and added in the root of the bundle. libraries can be cmake library targets or absolute paths to existing libraries.  This is not yet supported by the celix framework
 - If HEADERS is provided the headers values are appended to the bundle manifest.
 
 ##bundle_private_libs
@@ -160,6 +160,7 @@
     [COPY] 
     [GROUP group_name]
     [NAME deploy_name]
+    [LAUNCHER launcher]
     [BUNDLES <bundle1> <bundle2> ...]
     [PROPERTIES "prop1=val1" "prop2=val2" ...]
 )
@@ -177,6 +178,7 @@
 - If COPY is provided the selected bundles will be copied in a bundles dir and the generated config.properties will use relative paths to the bundle locations. Default bundles will not be copied and the generated config.properties will use absolute references to the bundle locations.
 - If GROUP is provided the deployment will be grouped in the provided group name. 
 - If NAME is provided that name will be used for the deployment dir. Default the deploy target name will be used.
+- If LAUNCHER is provided that path or target will be used as launcher executable for the deployment. If no LAUNCHER is not provided the celix executable will be used.
 - If BUNDLES is provided the list of bundles will be added the the generated config.properties for startup. Combined with COPY the bundles will also be copied to a bundles dir.
 - If PROPERTIES is provided the list of properties will be appended to the generated config.properties
 
@@ -186,7 +188,10 @@
 ```CMake
 deploy_bundles_dir(<deploy_target_name>
     DIR_NAME dir_name
-    BUNDLES bundle1 bundle2 ...
+    BUNDLES 
+        bundle1 
+        bundle2 
+        ...
 )
 ```
 
@@ -195,7 +200,9 @@
 
 ```CMake
 deploy_bundles(<deploy_target_name>
-    bundle1 bundle2 ...
+    bundle1 
+    bundle2 
+    ...
 )
 ```
 
@@ -205,6 +212,8 @@
 Add the provided properties to the target deploy config.properties.
 
 deploy_properties(<deploy_target_name>
-    "prop1=val1" "prop2=val2" ...
+    "prop1=val1" 
+    "prop2=val2" 
+    ...
 )
 
diff --git a/documents/getting_started/creating_a_simple_bundle.md b/documents/getting_started/creating_a_simple_bundle.md
new file mode 100644
index 0000000..c86dcec
--- /dev/null
+++ b/documents/getting_started/creating_a_simple_bundle.md
@@ -0,0 +1,309 @@
+#Apache Celix - Getting Started Guide: Creating a Simple Bundle
+
+##Intro
+This page is intended for first time users of Apache Celix. It should guide you through building & installing Apache Celix, setting up a new project, creating your first bundle, setting up the project for use with Eclipse project and finally running and debugging your bundle directly from eclipse workspace. 
+
+If there are any uncertainties or question, don't hesitate to ask your questions in the [Apache Celix mailing](https://celix.apache.org/support/mailinglist.html).
+
+##Prerequisite
+Some experience with a command line interface (xterm) is expected to be able to follow this guide. 
+
+##Building and Installing
+For Apache Celix see [Building And Installing](../building/readme.md)
+
+##Installing Eclipse CDT
+Download the latest eclipse CDT at [http://www.eclipse.org](http://www.eclipse.org) and install it on your system. For more information on how the install eclipse on your system consult the eclipse documentation. For this getting started guide the luna version of eclipse was used ([linux](http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/luna/R/eclipse-cpp-luna-R-linux-gtk-x86_64.tar.gz) [mac](http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/luna/R/eclipse-cpp-luna-R-macosx-cocoa-x86_64.tar.gz)).
+
+##Apache Celix Bundle project
+Now that Apache Celix and Eclipse is installed, we are ready to create a new Apache Celix Bundle project.
+CMake is used as build tool for Apache Celix projects.
+
+To setup of the project, first create a new project dir to work in:
+
+```bash
+#Create a new workspace to work in, e.g:
+mkdir ${HOME}/workspace
+export WS=${HOME}/workspace
+
+mkdir ${WS}/myproject
+cd ${WS}/myproject
+```
+
+Then create a CMakeLists.txt file - the makefile variant of CMake -in project root directory:
+
+```cmake	
+#${WS}/myproject/CMakeLists.txt
+	
+#Part 1. setup project
+cmake_minimum_required(VERSION 3.4)
+project(myproject C CXX)
+
+#Part 2. setup compilers
+SET(CMAKE_C_FLAGS "-D_GNU_SOURCE -std=gnu99 -Wall -Werror -fPIC ${CMAKE_C_FLAGS}")
+SET(CMAKE_C_FLAGS_DEBUG "-g -DDEBUG")
+SET(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
+SET(CMAKE_CXX_FLAGS_DEBUG "-g -DDEBUG")
+
+#Part 3. Setup Celix cmake files, include paths, libraries and library paths
+#Note. If celix is not installed in /usr/local dir, change the location accordingly.
+set(CMAKE_MODULE_PATH  ${CMAKE_MODULE_PATH} "/usr/local/share/celix/cmake/modules")
+find_package(CELIX REQUIRED)
+include_directories(${CELIX_INCLUDE_DIRS})
+
+#Part 4. Choose C, C++ or both
+add_subdirectory(bundles/hello_world) #C
+add_subdirectory(bundles/HelloWorld) #C++
+```
+		
+This CMakeLists.txt file, sets up the following:
+
+* Part 1 
+	* The minimum cmake version required. 
+	* The project name
+	* The type of source files to expect, in this case C and C++.
+* Part 2
+    * Setup the compilers. c99 for C and C++11 for C++
+* Part 3
+	* The Celix package should be searched, configured and that the Celix package is required. 
+	* For all build targets in this CMakeLists.txt file or any sub directory CMakeLists.txt files the Apache Celix headers directory should be included.
+* Part 4
+	* The CMakelists.txt file in the subdirectory bundles/hello_world and/or bundles/HelloWorld should also be processed.
+	
+
+It is a good practice to create a separate CMakeLists.txt file for every bundle you want to build. For the hello_world bundle a CMakeLists.txt file should be created in the bundles/hello_world sub directory.
+
+Create the sub directory:
+
+```CMake
+#Create directory structure for the hello_world bundles
+cd ${WS}/myproject
+mkdir -p bundles/hello_world/private/src
+mkdir -p bundles/HelloWorld/private/src
+mkdir -p bundles/HelloWorld/private/include
+```
+
+
+And add the following CMakeLists.txt file for the C Bundle:
+
+```CMake	
+#${WS}/myproject/bundles/hello_world/CMakeLists.txt
+
+add_bundle(hello_world
+    VERSION 1.0.0
+	SOURCES
+        private/src/hello_world_activator.c
+)	
+
+if(APPLE)
+    target_link_libraries(hello_world ${CELIX_LIBRARIES} -Wl,-all_load ${CELIX_DM_STATIC_LIB})
+else()  
+    target_link_libraries(hello_world -Wl,--no-undefined -Wl,--whole-archive ${CELIX_DM_STATIC_LIB} -Wl,--no-whole-archive ${CELIX_LIBRARIES})
+endif()
+```
+
+And/or the following CMakeLists.txt for the C++ bundle:
+
+```CMake
+#${WS}/myproject/bundles/HelloWorld/CMakeLists.txt
+
+include_directories(
+    private/include
+)
+
+add_bundle(HelloWorld
+    VERSION 1.0.0
+	SOURCES
+        private/src/HelloWorldActivator.cc
+)
+
+IF(APPLE)
+    target_link_libraries(HelloWorld ${CELIX_LIBRARIES} -Wl,-all_load ${CELIX_DM_CXX_STATIC_LIB})
+else()
+    target_link_libraries(HelloWorld -Wl,--no-undefined -Wl,--whole-archive ${CELIX_DM_CXX_STATIC_LIB} -Wl,--no-whole-archive ${CELIX_LIBRARIES})
+endif()
+```
+	
+These CMakeLists.txt files declare that the bundles should be build based on the build result (shared library) of the declared sources (in this case the `private/src/hello_world_activator.c` or `private/src/HelloWorldActivator.cc` source). 
+The add_bundle function is an Apache Celix specific CMake extension. 
+The library used for the bundle will also be linked against the dependency manager static library. 
+
+
+The Celix framework will install the bundle, load the bundle shared library and call the bundle activator entry symbols. These entries need to be programmed by the user. 
+Note that in these examples we use the dependency manager libraries (C and C++ version) instead of developing a "vanilla" bundle activator; 
+The dependency manager uses a higher abstraction and is more simple to understand and maintain, but not part of the OSGi standard.
+
+The C Bundle Activator:
+```C
+//${WS}/myproject/bundles/hello_world/private/src/hello_world_activator.c
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "dm_activator.h"
+
+
+struct userData {
+	    char * word;
+};
+
+celix_status_t dm_create(bundle_context_pt context, void **out) {
+	celix_status_t status = CELIX_SUCCESS;
+    struct userData* result = calloc(1, sizeof(*result));
+	if (result != NULL) {
+            result->word = "C World";
+            *out = result;
+    } else {
+            status = CELIX_START_ERROR;
+    }
+    return status;
+}
+
+celix_status_t dm_init(void* userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
+    struct userData* data = (struct userData *) userData;
+    printf("Hello %s\n", data->word);
+    return CELIX_SUCCESS;
+}
+
+celix_status_t dm_destroy(void* userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
+    free(userData);
+    return CELIX_SUCCESS;
+}
+```
+	
+The C++ Bundle Activator (header + source):
+```C++
+//${WS}/myproject/bundles/HelloWorld/private/include/HelloWorldActivator.h
+#ifndef HELLOWORLDACTIVATOR_H_
+#define HELLOWORLDACTIVATOR_H_
+
+#include "celix/dm/DmActivator.h"
+
+using namespace celix::dm;
+
+class HelloWorldActivator : public DmActivator {
+private:
+    const std::string word {"C++ World"}; 
+public:
+    HelloWorldActivator(DependencyManager& mng) : DmActivator {mng} {}
+    virtual void init();
+    virtual void deinit();
+};
+
+#endif //HELLOWORLDACTIVATOR_H_
+
+//${WS}/myproject/bundles/HelloWorld/private/src/HelloWorldActivator.cc
+#include "HelloWorldActivator.h"
+#include <iostream>
+
+using namespace celix::dm;
+
+DmActivator* DmActivator::create(DependencyManager& mng) {
+    return new HelloWorldActivator(mng);
+}
+
+void HelloWorldActivator::init() {
+    std::cout << "Hello " << this->word << "\n";
+}
+
+void HelloWorldActivator::deinit() {
+    //nothing to do
+}
+```
+	
+###Building 
+One of the highly recommended features of CMake is the ability to do out of source builds, the benefit is that all of the build results will go in a separate directory without cluttering the (source) project.
+CMake also needs to able to find the cmake files Celix provides. This can be achieved by providing a CMAKE_MODULE_PATH variable (or setting the CMAKE_MODULE_PATH in the top level CMakeLists.txt). 
+For this example it is assumed that Celix in installed in `/usr/local`.
+To create the build directory and build the project execute the following commands:
+
+
+```bash
+cd ${WS}
+mkdir myproject-build
+cd myproject-build
+cmake ../myproject
+make all  
+#Or
+#cmake -G Ninja ../myproject
+#ninja
+```	
+
+Hopefully you will some some build results scrolling over the screen and actual build results in the build directory. There should be a hello_world.zip in the bundles/hello_world directory, this the actual bundle.  
+A bundle on its own has no real value, so lets setup a deployment and run the Apache Celix framwork with these bundles.
+
+###Running 
+
+To create a deployment for the hello world bundles two things are needed: 
+	
+1. Add a `add_deploy` statement in the `CMakeLists.txt` file declaring what to deploy and under which name.
+
+```CMake
+#${WS}/myproject/CMakeLists.txt
+add_deploy(myproject 
+    BUNDLES 
+	    ${CELIX_BUNDLES_DIR}/shell.zip 
+	    ${CELIX_BUNDLES_DIR}/shell_tui.zip
+	    ${CELIX_BUNDLES_DIR}/dm_shell.zip 
+	    hello_world #C bundle
+	    HelloWorld #C++ bundle
+)		
+```
+ 		   
+Rerun make again form the build project. the make files generated by CMake will ensure cmake is run it again to update the actual make files.
+
+```bash 		
+cd ${WS}/myproject-build
+make -j
+#or
+#ninja
+```	
+
+Now a deploy directory myproject should be available in the deploy directory. This directory contains - among other files - a release.sh script. This can be used to setup the required environment variables (like LD_LIBRARY_PATH).
+
+```bash
+cd ${WS}/myproject-build/deploy/myproject
+. ./release.sh
+celix
+#or ./hello
+```
+
+The hello_world bundle should be started with the famous "Hello World" text printed twice from the C and C++ bundle. The shell and shell_tui bundle are also deployed and these can be used to query and control the running framework. Below some commands are shown for querying the installed bundles, listing all known shell command, showing the help of a specific command and stopping a specific bundle (note that bundle 0 is the framework "bundle"):
+
+```
+lb 
+help
+help inspect
+stop 0
+```
+	
+##Apache Celix Bundle Project in Eclipse
+
+A nice feature of CMake is the ability to generate Eclipse project files, with this feature bundles can also be developed with use of Eclipse. This should help speed up the development process. 
+To get started change directory to the build directory and generate a eclipse project file.
+
+	cd ${WS}/myproject-build 
+	cmake -G "Eclipse CDT4 - Unix Makefiles" .
+	
+Startup the Eclipse EDI and a chose the `${WS}`
+
+![select workspace](getting_started_img1.png)
+
+Import the project with existing project. 
+
+![import project](getting_started_img2.png)
+
+To build the project, use Project->Build All. To run or debug from Eclipse navigate to the myproject deploy directory and right click on the 'myproject-deploy.launch' file. And select Run As or Debug As to run or debug the bundle.
+
+![run project](getting_started_img3.png) 
+ 
+##Next
+
+The idea behind service oriented programming is that functionality is provided and used by abstract service, which hide implementation details.
+For a guide how to provide and use services see
+
+* [Apache Celix - Getting Started Guide: Using Services with C](using_services_with_c.md)
+* [Apache Celix - Getting Started Guide: Using Services with C++](using_services_with_cxx.md)
+ 
+
+
+	
+	
diff --git a/documents/getting_started/readme.md b/documents/getting_started/readme.md
index 5257233..60da6d3 100644
--- a/documents/getting_started/readme.md
+++ b/documents/getting_started/readme.md
@@ -1,216 +1,8 @@
-#Apache Celix - Getting Started
+#Apache Celix - Getting Started Guide
 
-##Intro
-This page is intended for first time users of Apache Celix. It should guide you through building & installing Apache Celix, setting up a new project, creating your first bundle, setting up the project for use with Eclipse project and finally running and debugging your bundle directly from eclipse workspace. 
+##Guides
+There are several guide to help you get started. The first guide is [Getting Started: Creating a simple bundle](creating_a_simple_bundle.md) 
+and this should get you started for your first C and/or C++ bundle.
 
-If there are any uncertainties or question, don't hesitate to ask your questions in the [Apache Celix mailing](https://celix.apache.org/support/mailinglist.html).
-
-##Prerequisite
-Some experience with a command line interface (xterm) is expected to be able to follow this guide. 
-
-##Building and Installing
-For Apache Celix see [Building And Installing](../building/readme.md)
-
-##Installing Eclipse CDT
-Download the latest eclipse CDT at [http://www.eclipse.org](http://www.eclipse.org) and install it on your system. For more information on how the install eclipse on your system consult the eclipse documentation. For this getting started guide the luna version of eclipse was used ([linux](http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/luna/R/eclipse-cpp-luna-R-linux-gtk-x86_64.tar.gz) [mac](http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/luna/R/eclipse-cpp-luna-R-macosx-cocoa-x86_64.tar.gz)).
-
-##Apache Celix Bundle project
-Now that Apache Celix and Eclipse is installed, we are ready to create a new Apache Celix Bundle project. In this project cmake will be create a singe hello world bundle with a deployment configuration for testing the bundle.
-
-To setup of the project, first create a new project dir to work in:
-
-```bash
-#Create a new workspace to work in, e.g:
-mkdir ${HOME}/workspace
-export WS=${HOME}/workspace
-
-mkdir ${WS}/myproject
-cd ${WS}/myproject
-```
-Then create a CMakeLists.txt file - the makefile variant of CMake -in project root directory:
-
-```cmake	
-#${WS}/myproject/CMakeLists.txt
-	
-#PART 1
-cmake_minimum_required(VERSION 3)
-project(myproject C)
-
-#PART 2
-    #Note. If celix is not installed in /usr/local dir, change the location accordingly.
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "/usr/local/share/celix/cmake/modules")
-find_package(CELIX REQUIRED)
-include_directories(${CELIX_INCLUDE_DIRS})
-
-#PART 3
-add_subdirectory(bundles/hello_world)
-```
-		
-This CMakeLists.txt file, sets up the following:
-
-* Part 1 
-	* The minimum cmake version required. 
-	* The project name
-	* The type of source files to expect, in this case C.
-* Part 2
- 	* The CMake module path to be used (e.g. where CMake find_package module can be found)
-	* That Celix package should be searched, configured and that the Celix package is required. 
-	* That for all build targets in this CMakeLists.txt file or any sub directory CMakeLists.txt files the Apache Celix headers directory should be included.
-* Part 3
-	* The CMakelists.txt file in the subdirectory bundles/hello_world should also be processed.
-	
-
-It is a good pratice to create a seperate CMakeLists.txt file for every bundle you want to build. For the hello_world bundle a CMakeLists.txt file should be created in the bundles/hello_world sub directory.
-
-Create the sub directory:
-
-```CMake
-#Create directory structure for the hello_world bundles
-cd ${WS}/myproject
-mkdir -p bundles/hello_world/private/src
-```
-
-
-And add the following CMakeList.txt file:
-
-```CMake	
-#${WS}/myproject/bundles/hello_world/CMakeLists.txt
-
-add_bundle(hello_world
-    VERSION 1.0.0
-	SOURCES(private/src/activator)
-)	
-```
-	
-This CMakeLists.txt file declares that a bundle should be build based on the build result (shared library) of the declared sources (in this caese the private/src/activator.c source). The add_bundle function is an Apache Celix specific CMake extension. 
-
-The last part for the hello_world bundle is the bundle activator source. The bundle activator is the entry point for an Apache Celix Bundle. Think of the bundle activator as the main function for a bundle, whith the difference that is does not only control the start of a bundle, but also the stopping of a bundle. 
-
-Creating/starting and stopping/destroying is seperated in bundle activator. This is done to make a clear seperation between the instantion/creation of a structure (e.g. object) and exposure of that instantation to other parts of the program. The same, but then reserve hold for seperating stopping and destroying a bundle. 
-
-```C
-//${WS}/myproject/bundles/hello_world/private/src/activator.c
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "bundle_activator.h"
-#include "bundle_context.h"
-
-
-struct userData {
-	    char * word;
-};
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
-	celix_status_t status = CELIX_SUCCESS;
-    *userData = malloc(sizeof(struct userData));
-	if (userData != NULL) {
-            ((struct userData *)(*userData))->word = "World";
-    } else {
-            status = CELIX_START_ERROR;
-    }
-    return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
-    struct userData * data = (struct userData *) userData;
-    printf("Hello %s\n", data->word);
-    return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
-    struct userData * data = (struct userData *) userData;
-    printf("Goodbye %s\n", data->word);
-    return CELIX_SUCCESS;
-}       
-    
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
-	free(userData);
-    return CELIX_SUCCESS;
-}
-```
-	
-###Building 
-One of the highly recommended features of CMake is the ability to do out of source builds, the benefit is that all of the build results will go in a seperate directory without cluttering the (source) project. To create the build directory and build the project execute the following commands:
-
-```bash
-cd ${WS}
-mkdir myproject/build
-cd myproject/build
-cmake ..
-make all  
-#Or
-#cmake -G Ninja ..
-#ninja
-```	
-
-Hopefully you will some some build results scrolling over the screen and actual build results in the build directory. There should be a hello_world.zip in the bundles/hello_world directory, this the actual bundle. But a bundle on its own has no real value, so lets setup a deployment and run the Apache Celix framwork with this bundle.
-
-
-###Running 
-
-To create a deployment for the hello_world bundle two things are needed: 
-	
-1. Add a `add_deploy` statement in the `bundles/hello_world/CMakeLists.txt` file declaring what to deploy and under which name.
-
-```CMake
-${WS}/myproject/bundles/hello_world/CMakeLists.txt
-add_deploy("myproject-deploy" BUNDLES 
-	${CELIX_BUNDLES_DIR}/shell.zip 
-	${CELIX_BUNDLES_DIR}/shell_tui.zip
-	hello_world
-)		
-```
- 		   
-Rerun make again form the  build project. the make files genereated by CMake will ensure cmake is runned again to update the actual make files.
-
-```bash 		
-cd ${WS}/myproject-build
-make 
-#or
-#ninja
-```	
-
-Now a deploy directory myproject should be availabe in the deploy directory. This directory contains - among other files - the run.sh script. This can be used to run the Apache Celix framework with the declared bundles from the deploy.cmake.
-
-```bash
-cd ${WS}/myproject-build/deploy/myproject-deploy
-sh run.sh
-```
-
-The hello_world bundle should be started with the famous "Hello World" text printed. The shell and shell_tui bundle are also deployed and these can be used to query and control the running framework. Below some commands are shown for printed the installed bundles, printing all known shell command, printing help of a specific command and stopping a specific bundle (note that bundle 0 is the framework):
-
-```
-lb 
-help
-help inspect
-stop 0
-```
-	
-##Apache Celix Bundle Project in Eclipse
-
-A nice feature of CMake is the ability to generate Eclipse project files, with this feature bundles can also be developed with use of Eclipse. This should help speed up the development process. 
-To get started change directory to the build directory and generate a eclipse project file.
-
-	cd ${WS}/myproject/build 
-	cmake -G "Eclipse CDT4 - Unix Makefiles" .
-	
-Startup the Eclipse EDI and a chose the `${WS}`
-
-![select workspace](getting_started_img1.png)
-
-Import the project with existing project. 
-
-![import project](getting_started_img2.png)
-
-To build the project, use Project->Build All. To run or debug from Eclipse navigate to the myproject deploy directory and right click on the 'myproject.launch' file. And select Run As or Debug As to run or debug the bundle.
-
-![run project](getting_started_img3.png) 
- 
-
- 
- 
-
-
-	
-	
+After that you can extend the example by providing and use services using the 
+guide [Getting Started: Using Services with C](using_services_with_c.md) or [Getting Started: Using Services with C++](using_services_with_cxx.md). 
diff --git a/documents/getting_started/using_services_with_c.md b/documents/getting_started/using_services_with_c.md
new file mode 100644
index 0000000..9934fa5
--- /dev/null
+++ b/documents/getting_started/using_services_with_c.md
@@ -0,0 +1,593 @@
+#Apache Celix - Using Services with C
+
+## Intro 
+
+This example gives an overview for providing and using services with Apache Celix with C.
+
+## Services
+
+To start of, C services in Celix are just a pointer to a memory location registered in the service registry using a name and an optional set of key/value pairs. 
+
+By convention use the following service layout:
+
+```C
+//example.h
+#ifndef EXAMPLE_H_
+#define EXAMPLE_H_
+
+#define EXAMPLE_NAME 			"org.example"
+#define EXAMPLE_VERSION 		"1.0.0"
+#define EXAMPLE_CONSUMER_RANGE   "[1.0.0,2.0.0)"
+
+
+struct example_struct {
+	void *handle;
+	int (*method)(void *handle, int arg1, double arg2, double *result);
+} ;
+
+typedef struct example_struct example_t;
+
+#endif /* EXAMPLE_H_ */
+
+```
+
+
+For a Celix service a service name, service provider version and service consumer range should be declared.
+This is explicitly done with macros to prevent symbols so to that no linking dependencies are introduced.
+
+Then the actual struct for the service needs to be declared.
+The first element of the service struct should be a handle which can be used to store the service context, as convention we keep this pointer a void pointer to explicitly make it opaque.
+Note that also an opaque struct could be used (e.g a declared but not defined struct), but this can become problematic concerning components registering multiple services. 
+In that case explicit cast are needed to prevent warning and this can be confusing for the To prevent that issues void pointers are preferred.
+
+The rest of the element should be function pointers, which by convention should return an celix_status_t or int (which is technically the same). 
+The return value is used as a way of handling errors and is also needed to be able to make remote services (e.g. to be able to handle remote exceptions).
+
+The first argument of a service function should be the service handle and if there is a result the last argument should be a output parameter (either pre allocated (e.g. double *) or not (e.g. double **)).
+If the caller is not the owner of the output argument, a const pointer should be used (e.g. const char**). 
+It is also possible to create typedef of the pointer to the service struct (e.g. typedef struct example_struct example_t), but this is not needed. 
+
+In the Celix code base there are still service which uses a typedef with a pointer (e.g. typedef struct example_struct* example_struct_pt). This should be avoided, 
+because it is not possible to create the const pointer of those typedefs and it is not possible to include those typedef inside a existing struct without the needed for an additional malloc.
+
+### Semantic Versioning
+
+For versioning, semantic versioning should be used.
+
+A backward incompatible change should lead to a major version increase (e.g. 1.0.0 -> 2.0.0).
+For a C Service versioning is used to express binary compatibility (for the same platform / compiler), change that are incompatible are:
+
+- Removing a function
+- Adding a function to before any other function
+- Moving a function to an other location in the service struct
+- Changing the signature of a function
+- Changing the semantics of a argument (e.g. changing range input from "range in kilometer" to "range in meters")
+
+A backwards binary compatible change which extend the functionality should lead to a minor version increase (e.g. 1.0.0 -> 1.1.0).
+Changes considered backwards compatible which extend the functionality are:
+
+- Adding a function to the back of the service struct
+
+A backwards binary compatible change which does not extend the functionality should lead to a micro version increase (e.g. 1.0.0 -> 1.0.1).
+Changes considered backwards binary compatible which does not extend the functionality are:
+
+- Changes in the documentation
+- Renaming of arguments
+
+For C services generally platform specific calling convention are used therefore binary compatibility between service provider and consumers from different compilers is possible (e.g. gcc and clang), 
+ but not advisable
+
+ 
+## Components
+
+Component should use the ADT principle (see [ADT in C](http://inst.eecs.berkeley.edu/~selfpace/studyguide/9C.sg/Output/ADTs.in.C.html)).
+Note that is a a convention.
+
+Components should have a `<cmpName>_create` and `<cmpName>_destroy` function.
+Components can have a `<cmpName>_start` and `<cmpName>_stop` function to start/stop threads or invoke functionality needed a fully created component. 
+The start function will only be called if all required service are available and the stop function will be called when some required are going or if the component needs to be stopped.
+
+Components can also have a `<cmpName>_init` and `<cmpName>_deinit` function which will be called before and after respectively the start and stop function. 
+The init/deinit function can be used to include (de)initialization which is not needed/wanted every time when service dependencies are being removed/added. 
+
+## Code Examples
+
+The next code blocks contains some code examples of components to indicate how to handle service dependencies, how to specify providing services and how to cope with locking/synchronizing.
+The complete example can be found [here](../../examples/services_example_c).
+
+The error checking is very minimal in these example to keep the focus on how to interact with services and how to deal with errors in C / Celix.
+
+
+### Bar example
+
+The bar example is a simple component providing the `example` service. 
+ 
+```C
+//bar.h
+#ifndef BAR_H_
+#define BAR_H_
+
+#include "example.h"
+
+typedef struct bar_struct bar_t;
+
+bar_t* bar_create(void);
+void bar_destroy(bar_t *self);
+
+int bar_method(bar_t *self, int arg1, double arg2, double *out);
+
+#endif //BAR_H_
+```
+
+```C
+//bar.c
+#define OK 0
+#define ERROR 1
+
+struct bar_struct {
+    double prefValue;
+};
+
+bar_t* bar_create(void) {
+    bar_t *self = calloc(1, sizeof(*self));
+    if (self != NULL) {
+        self->prefValue = 42;
+    } else {
+        //log error
+    }
+    return self;
+};
+
+void bar_destroy(bar_t *self) {
+    free(self);
+}
+
+int bar_method(bar_t *self, int arg1, double arg2, double *out) {
+    double update = (self->prefValue + arg1) * arg2;
+    self->prefValue = update;
+    *out = update;
+    return OK;
+}
+```
+
+```C
+//bar_activator.c
+#include "dm_activator.h"
+#include "bar.h"
+
+#include <stdlib.h>
+
+struct activator {
+	bar_t *bar;
+	example_t exampleService;
+};
+
+celix_status_t dm_create(bundle_context_pt context, void **userData) {
+	celix_status_t status = CELIX_SUCCESS;
+	struct activator *act = calloc(1, sizeof(*act));
+	if (act != NULL) {
+
+		act->bar = bar_create();
+		act->exampleService.handle = act->bar;
+		act->exampleService.method = (void*) bar_method;
+
+		if (act->bar != NULL) {
+            *userData = act;
+        } else {
+            free(act);
+        }
+	} else {
+		status = CELIX_ENOMEM;
+	}
+	return status;
+}
+
+celix_status_t dm_init(void *userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
+    celix_status_t status = CELIX_SUCCESS;
+	struct activator *activator = userData;
+
+	dm_component_pt cmp = NULL;
+	component_create(context, "BAR", &cmp);
+	component_setImplementation(cmp, activator->bar);
+	component_addInterface(cmp, EXAMPLE_NAME, EXAMPLE_VERSION, &activator->exampleService, NULL);
+
+	dependencyManager_add(manager, cmp);
+    return status;
+}
+
+celix_status_t dm_destroy(void *userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
+	celix_status_t status = CELIX_SUCCESS;
+	struct activator *activator = userData;
+	bar_destroy(activator->bar);
+	free(activator);
+	return status;
+};
+```
+
+### Foo1 example
+
+The Foo1 example shows how add a service dependency, implement the callback, invoke a service and how to protect the usage of service with use of a mutex.
+
+```C
+//foo1.h
+#ifndef FOO1_H_
+#define FOO1_H_
+
+#include "example.h"
+
+typedef struct foo1_struct foo1_t;
+
+foo1_t* foo1_create(void);
+void foo1_destroy(foo1_t *self);
+
+int foo1_start(foo1_t *self);
+int foo1_stop(foo1_t *self);
+
+int foo1_setExample(foo1_t *self, const example_t *example);
+
+
+#endif //FOO1_H_
+```
+
+```C
+//foo1.c
+#include "foo1.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <signal.h>
+#include <stdbool.h>
+#include <pthread.h>
+#include <assert.h>
+
+
+#define OK 0
+#define ERROR 1
+
+static void* foo1_thread(void*);
+
+struct foo1_struct {
+    const example_t *example;
+    pthread_mutex_t mutex; //protecting example
+    pthread_t thread;
+    bool running;
+};
+
+foo1_t* foo1_create(void) {
+    foo1_t *self = calloc(1, sizeof(*self));
+    if (self != NULL) {
+        pthread_mutex_init(&self->mutex, NULL);
+        self->running = false;
+    } else {
+        //log error
+    }
+    return self;
+};
+
+void foo1_destroy(foo1_t *self) {
+    assert(!self->running);
+    pthread_mutex_destroy(&self->mutex);
+    free(self);
+}
+
+int foo1_start(foo1_t *self) {
+    self->running = true;
+    pthread_create(&self->thread, NULL, foo1_thread, self);
+    return OK;
+}
+
+int foo1_stop(foo1_t *self) {
+    self->running = false;
+    pthread_kill(self->thread, SIGUSR1);
+    pthread_join(self->thread, NULL);
+    return OK;
+}
+
+int foo1_setExample(foo1_t *self, const example_t *example) {
+    pthread_mutex_lock(&self->mutex);
+    self->example = example; //NOTE could be NULL if req is not mandatory
+    pthread_mutex_unlock(&self->mutex);
+    return OK;
+}
+
+static void* foo1_thread(void *userdata) {
+    foo1_t *self = userdata;
+    double result;
+    int rc;
+    while (self->running) {
+        pthread_mutex_lock(&self->mutex);
+        if (self->example != NULL) {
+            rc = self->example->method(self->example->handle, 1, 2.0, &result);
+            if (rc == 0) {
+                printf("Result is %f\n", result);
+            } else {
+                printf("Error invoking method for example\n");
+            }
+        }
+        pthread_mutex_unlock(&self->mutex);
+        usleep(10000000);
+    }
+    return NULL;
+}
+```
+
+```C
+//foo1_activator.c
+#include "dm_activator.h"
+#include "foo1.h"
+
+#include <stdlib.h>
+
+struct activator {
+	foo1_t *foo;
+};
+
+celix_status_t dm_create(bundle_context_pt context, void **userData) {
+	celix_status_t status = CELIX_SUCCESS;
+	struct activator *act = calloc(1, sizeof(*act));
+	if (act != NULL) {
+		act->foo = foo1_create();
+        if (act->foo != NULL) {
+            *userData = act;
+        } else {
+            free(act);
+        }
+	} else {
+		status = CELIX_ENOMEM;
+	}
+	return status;
+}
+
+celix_status_t dm_init(void *userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
+    celix_status_t status = CELIX_SUCCESS;
+	struct activator *activator = userData;
+
+	dm_component_pt cmp = NULL;
+	component_create(context, "FOO1", &cmp);
+	component_setImplementation(cmp, activator->foo);
+
+	/*
+	With the component_setCallbacksSafe we register callbacks when a component is started / stopped using a component
+	 with type foo1_t*
+	*/
+    component_setCallbacksSafe(cmp, foo1_t*, NULL, foo1_start, foo1_stop, NULL);
+
+	dm_service_dependency_pt dep = NULL;
+	serviceDependency_create(&dep);
+	serviceDependency_setRequired(dep, true);
+	serviceDependency_setService(dep, EXAMPLE_NAME, EXAMPLE_CONSUMER_RANGE, NULL);
+	serviceDependency_setStrategy(dep, DM_SERVICE_DEPENDENCY_STRATEGY_LOCKING);
+
+	/*
+	With the serviceDependency_setCallbacksSafe we register callbacks when a service
+	is added and about to be removed for the component type foo1_t* and service type example_t*.
+
+	We should protect the usage of the
+ 	service because after removal of the service the memory location of that service
+	could be freed
+	*/
+    serviceDependency_setCallbacksSafe(dep, foo1_t*, const example_t*, foo1_setExample, NULL, NULL, NULL, NULL);
+	component_addServiceDependency(cmp, dep);
+
+	dependencyManager_add(manager, cmp);
+
+    return status;
+}
+
+celix_status_t dm_destroy(void *userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
+	celix_status_t status = CELIX_SUCCESS;
+	struct activator *activator = userData;
+	foo1_destroy(activator->foo);
+	free(activator);
+	return status;
+};
+
+```
+
+### Foo2 example
+
+The Foo2 example shows how to cope with multiple services and how to remove the need for locking by ensuring only access to the services and the services container by a single thread.
+
+```C
+//foo2.h
+#ifndef FOO2_H_
+#define FOO2_H_
+
+#include "example.h"
+
+typedef struct foo2_struct foo2_t;
+
+foo2_t* foo2_create(void);
+void foo2_destroy(foo2_t *self);
+
+int foo2_start(foo2_t *self);
+int foo2_stop(foo2_t *self);
+
+int foo2_addExample(foo2_t *self, const example_t *example);
+int foo2_removeExample(foo2_t *self, const example_t *example);
+
+#endif //FOO2_H_
+```
+
+```C
+//foo2.c
+#include "foo2.h"
+
+#include "array_list.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <signal.h>
+#include <stdbool.h>
+#include <pthread.h>
+#include <assert.h>
+
+
+#define OK 0
+#define ERROR 1
+
+static void* foo2_thread(void*);
+
+struct foo2_struct {
+    array_list_pt examples;
+    pthread_t thread;
+    bool running;
+};
+
+foo2_t* foo2_create(void) {
+    foo2_t *self = calloc(1, sizeof(*self));
+    if (self != NULL) {
+        self->examples = NULL;
+        arrayList_create(&self->examples);
+        self->running = false;
+    } else {
+        //log error
+    }
+    return self;
+};
+
+void foo2_destroy(foo2_t *self) {
+    assert(!self->running);
+    arrayList_destroy(self->examples);
+    free(self);
+}
+
+int foo2_start(foo2_t *self) {
+    self->running = true;
+    pthread_create(&self->thread, NULL, foo2_thread, self);
+    return OK;
+}
+
+int foo2_stop(foo2_t *self) {
+    self->running = false;
+    pthread_kill(self->thread, SIGUSR1);
+    pthread_join(self->thread, NULL);
+    return OK;
+}
+
+int foo2_addExample(foo2_t *self, const example_t *example) {
+    //NOTE foo2 is suspended -> thread is not running  -> safe to update
+    int status = OK;
+    status = arrayList_add(self->examples, (void *)example);
+    return status;
+}
+
+int foo2_removeExample(foo2_t *self, const example_t *example) {
+    //NOTE foo2 is suspended -> thread is not running  -> safe to update
+    int status = OK;
+    status = arrayList_removeElement(self->examples, (void*)example);
+    return status;
+}
+
+static void* foo2_thread(void *userdata) {
+    foo2_t *self = userdata;
+    double result;
+    int rc;
+    while (self->running) {
+        unsigned int size = arrayList_size(self->examples);
+        int i;
+        for (i = 0; i < size; i += 1) {
+            const example_t* example = arrayList_get(self->examples, i);
+            rc = example->method(example->handle, 1, 2.0, &result);
+            if (rc == 0) {
+                printf("Result is %f\n", result);
+            } else {
+                printf("Error invoking method for example\n");
+            }
+        }
+        usleep(10000000);
+    }
+    return NULL;
+
+```
+
+```C
+//foo2_activator.c
+#include "dm_activator.h"
+#include "foo2.h"
+
+#include <stdlib.h>
+
+struct activator {
+	foo2_t *foo;
+};
+
+celix_status_t dm_create(bundle_context_pt context, void **userData) {
+	celix_status_t status = CELIX_SUCCESS;
+	struct activator *act = calloc(1, sizeof(*act));
+	if (act != NULL) {
+		act->foo = foo2_create();
+        if (act->foo != NULL) {
+            *userData = act;
+        } else {
+            free(act);
+        }
+	} else {
+		status = CELIX_ENOMEM;
+	}
+	return status;
+}
+
+celix_status_t dm_init(void *userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
+    celix_status_t status = CELIX_SUCCESS;
+	struct activator *activator = userData;
+
+	dm_component_pt cmp = NULL;
+	component_create(context, "FOO2", &cmp);
+	component_setImplementation(cmp, activator->foo);
+
+	/*
+	With the component_setCallbacksSafe we register callbacks when a component is started / stopped using a component
+	 with type foo1_t*
+	*/
+    component_setCallbacksSafe(cmp, foo2_t*, NULL, foo2_start, foo2_stop, NULL);
+
+	dm_service_dependency_pt dep = NULL;
+	serviceDependency_create(&dep);
+	serviceDependency_setRequired(dep, false);
+	serviceDependency_setService(dep, EXAMPLE_NAME, EXAMPLE_CONSUMER_RANGE, NULL);
+	serviceDependency_setStrategy(dep, DM_SERVICE_DEPENDENCY_STRATEGY_SUSPEND);
+
+	/*
+	With the serviceDependency_setCallbacksSafe we register callbacks when a service
+	is added and about to be removed for the component type foo1_t* and service type example_t*.
+
+	We should protect the usage of the
+ 	service because after removal of the service the memory location of that service
+	could be freed
+	*/
+    serviceDependency_setCallbacksSafe(dep, foo2_t*, const example_t*, NULL, foo2_addExample, NULL, foo2_removeExample, NULL);
+	component_addServiceDependency(cmp, dep);
+
+	dependencyManager_add(manager, cmp);
+
+    return status;
+}
+
+celix_status_t dm_destroy(void *userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
+	celix_status_t status = CELIX_SUCCESS;
+	struct activator *activator = userData;
+	foo2_destroy(activator->foo);
+	free(activator);
+	return status;
+};
+```
+
+## Locking and Suspending
+ 
+As you may notice, the Foo1 example uses locks. 
+In principle, locking is necessary in order to ensure coherence in case service dependencies are removed/added/changed; on the other hands, locking increases latency and, when misused, can lead to poor performance. 
+For this reason, the serviceDependency interface gives the possibility to choose between a locking and suspend (a non-locking) strategy through the serviceDependency_setStrategy function, as is used in the Foo2 example.
+
+The locking strategy `DM_SERVICE_DEPENDENCY_STRATEGY_LOCKING` notifies the component in case the dependencies' set changes (e.g. a dependency is added/removed): the component is responsible for protecting via locks the dependencies' list and check (always under lock) if the service he's depending on is still available.
+The suspend or non-locking strategy `DM_SERVICE_DEPENDENCY_STRATEGY_SUSPEND` (default when no strategy is explicitly set) reliefs the programmer from dealing with service dependencies' consistency issues: in case this strategy is adopted, the component is stopped and restarted (i.e. temporarily suspended) upon service dependencies' changes.
+
+The suspend strategy has the advantage of reducing locks' usage: of course, suspending the component has its own overhead (e.g. stopping and restarting threads), but this overhead is "paid" only in case of changes in service dependencies, while the locking overhead is always paid.
+
+## See also
+
+See the [C Dependeny Manager](../../dependency_manager/readme.md) and [C Dependency Manager example](../../examples/dm_example) for more information and a more complex working example.
diff --git a/documents/getting_started/using_services_with_cxx.md b/documents/getting_started/using_services_with_cxx.md
new file mode 100644
index 0000000..3401d68
--- /dev/null
+++ b/documents/getting_started/using_services_with_cxx.md
@@ -0,0 +1,554 @@
+#Apache Celix - Using Services with C
+
+## Intro 
+
+This example gives an overview for providing and using C and C++ services with Apache Celix with C++.
+
+## Services
+
+### C++ Services
+To start of, C++ service in Celix are just (abstract) classes. 
+
+In the following example there also a projected default constructor and destructor to ensure no instantiation / deletion of the service is possible:
+```C++
+#ifndef IANOTHER_EXAMPLE_H
+#define IANOTHER_EXAMPLE_H
+
+#define IANOTHER_EXAMPLE_VERSION "1.0.0"
+#define IANOTHER_EXAMPLE_CONSUMER_RANGE "[1.0.0,2.0.0)"
+
+class IAnotherExample {
+protected:
+    IAnotherExample() = default;
+    virtual ~IAnotherExample() = default;
+public:
+    virtual double method(int arg1, double arg2) = 0;
+};
+
+#endif //IANOTHER_EXAMPLE_H
+```
+
+For a Celix service a service name, service provider version and service consumer range should be declared.
+This is explicitly done with macros to prevent symbols so to that no linking dependencies are introduced. 
+For C++ the service name can be inferred. 
+
+### C Services
+C services in Celix are just a pointer to a memory location registered in the service registry using a name and an optional set of key/value pairs.
+
+By convention use the following service layout:
+```C
+//example.h
+#ifndef EXAMPLE_H_
+#define EXAMPLE_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define EXAMPLE_NAME 			"org.example"
+#define EXAMPLE_VERSION 		"1.0.0"
+#define EXAMPLE_CONSUMER_RANGE   "[1.0.0,2.0.0)"
+
+
+struct example_struct {
+	void *handle;
+	int (*method)(void *handle, int arg1, double arg2, double *result);
+} ;
+
+typedef struct example_struct example_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* EXAMPLE_H_ */
+```
+
+For C service a struct containing the function pointers needs to be declared.
+The first element of the service struct should be a handle which can be used to store the service context, as convention we keep this pointer a void pointer to explicitly make it opaque.
+Note that also an opaque struct could be used (e.g a declared but not defined struct), but this can become problematic concerning components registering multiple services. 
+In that case explicit cast are needed to prevent warning and this can be confusing for the To prevent that issues void pointers are preferred.
+
+The rest of the element should be function pointers, which by convention should return an celix_status_t or int (which is technically the same). 
+The return value is used as a way of handling errors and is also needed to be able to make remote services (e.g. to be able to handle remote exceptions).
+
+The first argument of a service function should be the service handle and if there is a result the last argument should be a output parameter (either pre allocated (e.g. double *) or not (e.g. double **)).
+If the caller is not the owner of the output argument, a const pointer should be used (e.g. const char**). 
+It is also possible to create typedef of the pointer to the service struct (e.g. typedef struct example_struct example_t), but this is not needed. 
+
+In the Celix code base there are still service which uses a typedef with a pointer (e.g. typedef struct example_struct* example_struct_pt). This should be avoided, 
+because it is not possible to create the const pointer of those typedefs and it is not possible to include those typedef inside a existing struct without the needed for an additional malloc.
+
+
+
+### Semantic Versioning
+For versioning, semantic versioning should be used.
+
+A backward incompatible change should lead to a major version increase (e.g. 1.0.0 -> 2.0.0).
+
+### Versioning C++ Services
+For C++ Services versioning is used ot express binary compatibility changes that are incompatible are:
+
+- Everything. Seriously, binary compatibility in C++ is difficult and should be avoided. 
+
+Note that is is possible to use versioning for source compatibility and setup the build environment accordingly, but this is not part of this guide.
+
+### Versioning C Services
+For C Services versioning is used to express binary compatibility (for the same platform / compiler), change that are incompatible are:
+
+- Removing a function
+- Adding a function to before any other function
+- Moving a function to an other location in the service struct
+- Changing the signature of a function
+- Changing the semantics of a argument (e.g. changing range input from "range in kilometer" to "range in meters")
+
+A backwards binary compatible change which extend the functionality should lead to a minor version increase (e.g. 1.0.0 -> 1.1.0).
+Changes considered backwards compatible which extend the functionality are:
+
+- Adding a function to the back of the service struct
+
+A backwards binary compatible change which does not extend the functionality should lead to a micro version increase (e.g. 1.0.0 -> 1.0.1).
+Changes considered backwards binary compatible which does not extend the functionality are:
+
+- Changes in the documentation
+- Renaming of arguments
+
+For C services generally platform specific calling convention are used therefore binary compatibility between service provider and consumers from different compilers is possible (e.g. gcc and clang), 
+ but not advisable
+
+ 
+## Components
+
+Component are concrete classes in C++. This do not have to implement specific interface, expect the C++ service interfaces they provide.
+
+## Code Examples
+
+The next code blocks contains some code examples of components to indicate how to handle service dependencies, how to specify providing services and how to cope with locking/synchronizing.
+The complete example can be found [here](../../examples/services_example_cxx).
+
+### Bar Example
+
+The Bar example is a simple component providing the C `example` service and C++ `IAnotherExample` service.
+ 
+Note that the `Bar` component is just a plain old C++ object and does need to implement any specific Celix interfaces. 
+
+The `BarActivator` is the entry point for a C++ bundle. It must implement the `DmActivator::create` method so that C++ Dependency manager can create a instance `DmActivator` without needing to known the subclass. 
+It should also override the `DmActivator::init` to be able to declaratively program components and their provided service and service dependencies.
+
+The C++ Dependency Manager can use C++ member function pointers to control the component lifecycle (`init`, `start`, `stop` and `deinit`)  
+
+```C++
+//Bar.h
+#ifndef BAR_H
+#define BAR_H
+
+#include "IAnotherExample.h"
+
+class Bar : public IAnotherExample {
+    const double seed = 42;
+public:
+    Bar() = default;
+    virtual ~Bar() = default;
+
+    void init();
+    void start();
+    void stop();
+    void deinit();
+
+    virtual double method(int arg1, double arg2); //implementation of IAnotherExample::method
+    int cMethod(int arg1, double arg2, double *out); //implementation of example_t->method;
+};
+
+#endif //BAR_H
+```
+
+```C++
+//BarActivator.h
+#ifndef BAR_ACTIVATOR_H
+#define BAR_ACTIVATOR_H
+
+#include "celix/dm/DmActivator.h"
+#include "example.h"
+
+using namespace celix::dm;
+
+class BarActivator : public DmActivator {
+private:
+    example_t cExample {nullptr, nullptr};
+public:
+    BarActivator(DependencyManager& mng) : DmActivator(mng) {}
+    virtual void init();
+};
+
+#endif //BAR_ACTIVATOR_H
+```
+
+```C++
+//Bar.cc
+#include "Bar.h"
+#include <iostream>
+
+void Bar::init() {
+    std::cout << "init Bar\n";
+}
+
+void Bar::start() {
+    std::cout << "start Bar\n";
+}
+
+void Bar::stop() {
+    std::cout << "stop Bar\n";
+}
+
+void Bar::deinit() {
+    std::cout << "deinit Bar\n";
+}
+
+double Bar::method(int arg1, double arg2) {
+    double update = (this->seed + arg1) * arg2;
+    return update;
+}
+
+int Bar::cMethod(int arg1, double arg2, double *out) {
+    double r = this->method(arg1, arg2);
+    *out = r;
+    return 0;
+}
+```
+
+```C++
+//BarActivator.cc
+#include "Bar.h"
+#include "BarActivator.h"
+
+using namespace celix::dm;
+
+DmActivator* DmActivator::create(DependencyManager& mng) {
+    return new BarActivator(mng);
+}
+
+void BarActivator::init() {
+    std::shared_ptr<Bar> bar = std::shared_ptr<Bar>{new Bar{}};
+
+    Properties props;
+    props["meta.info.key"] = "meta.info.value";
+
+    Properties cProps;
+    cProps["also.meta.info.key"] = "also.meta.info.value";
+
+    this->cExample.handle = bar.get();
+    this->cExample.method = [](void *handle, int arg1, double arg2, double *out) {
+        Bar* bar = static_cast<Bar*>(handle);
+        return bar->cMethod(arg1, arg2, out);
+    };
+
+    createComponent(bar)  //using a pointer a instance. Also supported is lazy initialization (default constructor needed) or a rvalue reference (move)
+        .addInterface<IAnotherExample>(IANOTHER_EXAMPLE_VERSION, props)
+        .addCInterface(&this->cExample, EXAMPLE_NAME, EXAMPLE_VERSION, cProps)
+        .setCallbacks(&Bar::init, &Bar::start, &Bar::stop, &Bar::deinit);
+}
+```
+
+### Foo Example
+
+The `Foo` example has a dependency to the C++ and C services provider by the `Bar` component. Note that it depends on the services and not directly on the Bar component.
+
+```C++
+//Foo.h
+#ifndef FOO_H
+#define FOO_H
+
+#include "example.h"
+#include "IAnotherExample.h"
+#include <thread>
+
+class Foo  {
+    IAnotherExample* example {nullptr};
+    const example_t* cExample {nullptr};
+    std::thread pollThread {};
+    bool running = false;
+public:
+    Foo() = default;
+    virtual ~Foo() = default;
+
+    void start();
+    void stop();
+
+    void setAnotherExample(IAnotherExample* e);
+    void setExample(const example_t* e);
+
+    void poll();
+};
+
+#endif //FOO_H
+```
+
+```C++
+//FooActivator.h
+#ifndef FOO_ACTIVATOR_H
+#define FOO_ACTIVATOR_H
+
+#include "celix/dm/DmActivator.h"
+
+using namespace celix::dm;
+
+class FooActivator : public DmActivator {
+private:
+public:
+    FooActivator(DependencyManager& mng) : DmActivator(mng) {}
+    virtual void init();
+};
+
+#endif //FOO_ACTIVATOR_H
+```
+
+```C++
+//Foo.cc
+#include "Foo.h"
+#include <iostream>
+
+void Foo::start() {
+    std::cout << "start Foo\n";
+    this->running = true;
+    pollThread = std::thread {&Foo::poll, this};
+}
+
+void Foo::stop() {
+    std::cout << "stop Foo\n";
+    this->running = false;
+    this->pollThread.join();
+}
+
+void Foo::setAnotherExample(IAnotherExample *e) {
+    this->example = e;
+}
+
+void Foo::setExample(const example_t *e) {
+    this->cExample = e;
+}
+
+void Foo::poll() {
+    double r1 = 1.0;
+    double r2 = 1.0;
+    while (this->running) {
+        //c++ service required -> if component started always available
+        r1 = this->example->method(3, r1);
+        std::cout << "Result IAnotherExample is " << r1 << "\n";
+
+        //c service is optional, can be nullptr
+        if (this->cExample != nullptr) {
+            double out;
+            this->cExample->method(this->cExample->handle, 4, r2, &out);
+            r2 = out;
+            std::cout << "Result example_t is " << r2 << "\n";
+        }
+        std::this_thread::sleep_for(std::chrono::milliseconds(5000));
+    }
+}
+```
+
+```C++
+//FooActivator.cc
+#include "Foo.h"
+#include "FooActivator.h"
+
+using namespace celix::dm;
+
+DmActivator* DmActivator::create(DependencyManager& mng) {
+    return new FooActivator(mng);
+}
+
+void FooActivator::init() {
+
+    Component<Foo>& cmp = createComponent<Foo>()
+        .setCallbacks(nullptr, &Foo::start, &Foo::stop, nullptr);
+
+    cmp.createServiceDependency<IAnotherExample>()
+            .setRequired(true)
+            .setVersionRange(IANOTHER_EXAMPLE_CONSUMER_RANGE)
+            .setCallbacks(&Foo::setAnotherExample);
+
+    cmp.createCServiceDependency<example_t>(EXAMPLE_NAME)
+            .setRequired(false)
+            .setVersionRange(EXAMPLE_CONSUMER_RANGE)
+            .setCallbacks(&Foo::setExample);
+}
+```
+
+### Baz Example
+
+The `Baz` example has a dependency to the C++ and C services provider by the `Bar` component, 
+but uses the add / remove callbacks instead of set and as result is able to depend on multiple instance of a declared service dependencies.
+
+
+```C++
+//Baz.h
+#ifndef BAZ_H
+#define BAZ_H
+
+#include "example.h"
+#include "IAnotherExample.h"
+#include <thread>
+#include <list>
+#include <mutex>
+
+class Baz  {
+    std::list<IAnotherExample*> examples {};
+    std::mutex lock_for_examples {};
+
+    std::list<const example_t*> cExamples {};
+    std::mutex lock_for_cExamples {};
+
+    std::thread pollThread {};
+    bool running = false;
+public:
+    Baz() = default;
+    virtual ~Baz() = default;
+
+    void start();
+    void stop();
+
+    void addAnotherExample(IAnotherExample* e);
+    void removeAnotherExample(IAnotherExample* e);
+
+    void addExample(const example_t* e);
+    void removeExample(const example_t* e);
+
+    void poll();
+};
+
+#endif //BAZ_H
+```
+
+```C++
+//BazActivator.h
+#ifndef BAZ_ACTIVATOR_H
+#define BAZ_ACTIVATOR_H
+
+#include "celix/dm/DmActivator.h"
+
+using namespace celix::dm;
+
+class BazActivator : public DmActivator {
+private:
+public:
+    BazActivator(DependencyManager& mng) : DmActivator(mng) {}
+    virtual void init();
+};
+
+#endif //BAZ_ACTIVATOR_H
+```
+
+```C++
+//Baz.cc
+#include "Baz.h"
+#include <iostream>
+
+void Baz::start() {
+    std::cout << "start Baz\n";
+    this->running = true;
+    pollThread = std::thread {&Baz::poll, this};
+}
+
+void Baz::stop() {
+    std::cout << "stop Baz\n";
+    this->running = false;
+    this->pollThread.join();
+}
+
+void Baz::addAnotherExample(IAnotherExample *e) {
+    std::lock_guard<std::mutex> lock(this->lock_for_examples);
+    this->examples.push_back(e);
+}
+
+void Baz::removeAnotherExample(IAnotherExample *e) {
+    std::lock_guard<std::mutex> lock(this->lock_for_examples);
+    this->examples.remove(e);
+}
+
+void Baz::addExample(const example_t *e) {
+    std::lock_guard<std::mutex> lock(this->lock_for_cExamples);
+    this->cExamples.push_back(e);
+}
+
+void Baz::removeExample(const example_t *e) {
+    std::lock_guard<std::mutex> lock(this->lock_for_cExamples);
+    this->cExamples.remove(e);
+}
+
+void Baz::poll() {
+    double r1 = 1.0;
+    double r2 = 1.0;
+    while (this->running) {
+        //c++ service required -> if component started always available
+
+        {
+            std::lock_guard<std::mutex> lock(this->lock_for_examples);
+            int index = 0;
+            for (IAnotherExample *e : this->examples) {
+                r1 = e->method(3, r1);
+                std::cout << "Result IAnotherExample " << index++ << " is " << r1 << "\n";
+            }
+        }
+
+
+        {
+            std::lock_guard<std::mutex> lock(this->lock_for_cExamples);
+            int index = 0;
+            for (const example_t *e : this->cExamples) {
+                double out;
+                e->method(e->handle, 4, r2, &out);
+                r2 = out;
+                std::cout << "Result example_t " << index++ << " is " << r2 << "\n";
+            }
+        }
+
+        std::this_thread::sleep_for(std::chrono::milliseconds(4000));
+    }
+}
+```
+
+```C++
+//BazActivator.cc
+#include "Baz.h"
+#include "BazActivator.h"
+
+using namespace celix::dm;
+
+DmActivator* DmActivator::create(DependencyManager& mng) {
+    return new BazActivator(mng);
+}
+
+void BazActivator::init() {
+
+    Component<Baz>& cmp = createComponent<Baz>()
+        .setCallbacks(nullptr, &Baz::start, &Baz::stop, nullptr);
+
+    cmp.createServiceDependency<IAnotherExample>()
+            .setRequired(true)
+            .setStrategy(DependencyUpdateStrategy::locking)
+            .setVersionRange(IANOTHER_EXAMPLE_CONSUMER_RANGE)
+            .setCallbacks(&Baz::addAnotherExample, &Baz::removeAnotherExample);
+
+    cmp.createCServiceDependency<example_t>(EXAMPLE_NAME)
+            .setRequired(false)
+            .setStrategy(DependencyUpdateStrategy::locking)
+            .setVersionRange(EXAMPLE_CONSUMER_RANGE)
+            .setCallbacks(&Baz::addExample, &Baz::removeExample);
+}
+```
+
+## Locking and Suspending
+ 
+As you may notice, the Baz example uses locks.
+In principle, locking is necessary in order to ensure coherence in case service dependencies are removed/added/changed; on the other hands, locking increases latency and, when misused, can lead to poor performance. 
+For this reason, the serviceDependency interface gives the possibility to choose between a locking and suspend (a non-locking) strategy through the serviceDependency_setStrategy function, as is used in the Foo2 example.
+
+The locking strategy `DependencyUpdateStrategy::locking` notifies the component in case the dependencies' set changes (e.g. a dependency is added/removed): the component is responsible for protecting via locks the dependencies' list and check (always under lock) if the service he's depending on is still available.
+The suspend or non-locking strategy `DependencyUpdateStrategy::suspend` (default when no strategy is explicitly set) reliefs the programmer from dealing with service dependencies' consistency issues: in case this strategy is adopted, the component is stopped and restarted (i.e. temporarily suspended) upon service dependencies' changes.
+
+The suspend strategy has the advantage of reducing locks' usage: of course, suspending the component has its own overhead (e.g. stopping and restarting threads), but this overhead is "paid" only in case of changes in service dependencies, while the locking overhead is always paid.
+
+## See also
+
+See the [C++ Dependeny Manager](../../dependency_manager_cxx/readme.md) and [C++ Dependency Manager example](../../examples/dm_example_cxx) for more information and a more complex working example.
\ No newline at end of file
diff --git a/documents/intro/readme.md b/documents/intro/readme.md
new file mode 100644
index 0000000..7557e5a
--- /dev/null
+++ b/documents/intro/readme.md
@@ -0,0 +1,136 @@
+#Apache Celix Introduction
+
+##What is Apache Celix
+Apache Celix is an implementation of the [OSGi specification](https://www.osgi.org/developer/specifications) adapted to C and C++. It is a provides a framework to develop (dynamic) modular software applications using component and/or service-oriented programming.
+
+Apache Celix is primarily developed in C and adds an additional abstraction, in the form of a library, to support for C++. 
+
+##C and Objects
+C is a procedural programming language and as result has no direct support for the notion of a object. 
+To be able to follow the OSGi specification, a standard mapping from C to Java is used. This mapping takes care of how instances, parameters, return values and exceptions (error codes) work in Apache Celix.
+
+###Example
+Before going into detail, here is an example of the mapping from a method in Java to a function in C:
+
+```Java
+//Java signature
+public interface BundleContext {
+    public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException;
+}
+```
+
+```C
+//bundle_context.h
+
+//C prototype
+celix_status_t bundleContext_getServiceReferences(bundle_context_pt context, const char* serviceName, const char* filter, array_list_pt* service_references);
+```
+
+###Object methods 
+Using the provided example, the following templates can be extracted for mapping a object method to a C function:
+
+```C
+/**
+ * 1st template
+ * celix_status_t: return type of the status code
+ * 
+ * typeName: name of the object/type this function is part of
+ * functionName: the name of the function
+ * 
+ * typeName_t: The actual instance to "invoke" this function on
+ * parameters: default function parameters
+ * output parameter: the output which the caller can use
+ */
+celix_status_t <typeName>_<functionName>(<typeName>_t* self [,parameters, ] [, output parameter]);
+
+//OR
+
+/**
+* 2nd template
+ * celix_status_t: return type of the status code
+ * 
+ * typeName: name of the object/type this function is part of
+ * functionName: the name of the function
+ * 
+ * typeName_t: The actual instance to "invoke" this function on
+ * parameters: default function parameters
+ * output parameter: the output which the caller can use
+ */
+celix_status_t <typeName>_<functionName>(<typeName>_pt self [,parameters, ] [, output parameter]);
+```
+
+Note that although the first template is preferred, Apache Celix still uses the second template. 
+
+Unless stated otherwise, the caller is owner of the output and should destroy/deallocate the result.
+An exception is a const output parameters, this indicates the callee is still owner.
+
+###Creating and destroying Objects
+Objects in Apache Celix can generally be created and destroyed using a create and destroy functions.
+For example:
+
+```C
+celix_status_t bundleContext_create(framework_pt framework, framework_logger_pt, bundle_pt bundle, bundle_context_pt *bundle_context);
+celix_status_t bundleContext_destroy(bundle_context_pt context);
+```
+
+For some types a separate allocate and init and a separate deallocate and deinit are also available.
+This gives a user the option the initialize and deinitialize a object on the stack. the hash_map_iterator uses this:
+
+```C
+hash_map_iterator_pt hashMapIterator_create(hash_map_pt map);
+void hashMapIterator_destroy(hash_map_iterator_pt iterator);
+
+hash_map_iterator_pt hashMapIterator_alloc(void);
+void hashMapIterator_dealloc(hash_map_iterator_pt iterator);
+
+void hashMapIterator_init(hash_map_pt map, hash_map_iterator_pt iterator);
+void hashMapIterator_deinit(hash_map_iterator_pt iterator);
+```
+
+###OSGi documentation and Apache Celix
+Apache Celix follows the OSGi API as close as possible, but since the OSGi specification is written primarily for Java, there will be differences (Java is OO, C is procedural).
+Taking into account those differences and mapping explained before the OSGi javadoc can be used for a more in depth description of what the Apache Celix API offers. 
+
+* [OSGi core specification 4.3](https://osgi.org/javadoc/r4v43/core/index.html)
+* [OSGi compendium specification 4.3](https://osgi.org/javadoc/r4v43/cmpn/index.html)
+
+##What is a OSGi service?
+A OSGi service is a Java object register to the OSGi framework under a certain set of properties.
+OSGi services are generally registered as a well known interface (using the `objectClass` property).
+ 
+Consumers can dynamically lookup the services providing a filter to specify what kind of services their are interested in.   
+
+##C services in Apache Celix
+As mentioned OSGi uses Java Interfaces to define a service. Since C does not have Interfaces as compilable unit, this is not possible for Celix.  To be able to define a service which hides implementation details, Celix uses structs with function pointers.
+ 
+See [Apache Celix Best Practices](../best_practices/readme.md) for a more in depth look at services and service usage.
+ 
+##Impact of dynamic services
+Services in Apache Celix are dynamic, meaning that they can come and go at any moment. 
+How to cope with this dynamic behaviour is very critical for creating a stable solution.
+ 
+For Java OSGi this is already a challenge to program correctly, but less critical because generally speaking the garbage collector will arrange that objects still exists even if the providing bundle is deinstalled.
+Taking into account that C has no garbage collection handling the dynamic behaviour correctly is even more critical; If a bundle providing a certain services is removed the code segment / memory allocated for the service will be removed / deallocated.
+ 
+Apache Celix offers different solutions how to cope with this dynamic behaviour:
+
+* Bundle Context & Service References  - This (low level) [API](../../framework/public/include/bundle_context.h) exists to be compatible with the OSGi standard. This should not be used in production code, because no locking/syncing mechanisms are available.   
+* Service Listener - This (log level) [API](../../framework/public/include/service_listener.h) can be used to retrieve event when services are being removed or are added. Combined with locking this can be used to safely monitor and use services. 
+* Service Tracker - This [API](../../framework/public/include/service_tracker.h) can be used to register callbacks function when services are being removed or are added. Combined with locking this can be used to safely use services.
+* [Dependency Manager](../../dependency_manager/readme.md) - This library can be used to add service dependency is a declarative way.  A locking or syncing mechanism can be selected to safely use services. Note that this is not part of the OSGi standard.
+
+Even though the dependency manager is not part of the OSGi specification, this is the preferred way because it uses a higher abstraction and removes a lot boilerplate code. 
+
+##C++ Support
+
+One of the reasons why C was chosen as implementation language is that C can act as a common denominator for (service oriented) interoperability between a range of languages.
+C++ support is added with the use of a [C++ Dependency Manager](../../dependency_manager_cxx/readme.md).
+The Dependency Manager is arguably the most convenient way to interact with services, confers most uses cases and eliminates the necessity to port the rest of the (large) API to C++.
+
+##Documentation
+
+For more information see:
+
+* [Apache Celix - Building and Installing] (../building/readme.md)
+* [Apache Celix - Getting Started Guide](../getting_started/readme.md)
+* [Apache Celix - CMake Commands](../cmake_commands/readme.md)
diff --git a/documents/subprojects/readme.md b/documents/subprojects/readme.md
index 7e4fd50..92a5bc0 100644
--- a/documents/subprojects/readme.md
+++ b/documents/subprojects/readme.md
@@ -3,7 +3,8 @@
 Apache Celix is organized into several subprojects. The following subproject are currently available:
 
 * [Framework](../../framework) - The Apache Celix framework, an implementation of OSGi adapted to C.
-* [Dependency Manager](../../dependency_manager) - A component/dependency model for use through an API provided as library.
+* [Dependency Manager](../../dependency_manager) - A C component/dependency model for use through an API provided as library.
+* [C++ Dependency Manager](../../dependency_manager_cxx) - A C++ component/dependency model for use through an API provided as library.
 * [Device Access](../../device_access) - An implementation of the OSGi Device Access specification adapted to C.
 * [Examples](../../examples) - A Selection of examples showing how the framework can be used.
 * [Log Service](../../log_service) - An implementation of the OSGi Log Service adapated to C.
@@ -18,6 +19,7 @@
     * [Discovery SHM](../../remote_services/dicovery_shm) - A RSA Discovery implementation using shared memory.
 * [Shell](../../shell) - A OSGi shell implementation.
 * [Shell TUI](../../shell_tui) - A textual UI for the Celix Shell.
-* [Remote Shell](../../remote_shell) - A remote (telnet) frontend for the Celix Shell.
+* [Remote Shell](../../remote_shell) - A remote (telnet) frontend for the Celix shell.
+* [Bonjour Shell](../../shell_bonjour) - A remote (Bonjour / mDNS) frontend for the Celix shell.
 * [Deployment Admin](../../deployment_admin) - A deployment admin implementation.
 
diff --git a/event_admin/CMakeLists.txt b/event_admin/CMakeLists.txt
index 68a582f..e0d830c 100644
--- a/event_admin/CMakeLists.txt
+++ b/event_admin/CMakeLists.txt
@@ -17,16 +17,27 @@
 
 celix_subproject(EVENT_ADMIN "Option to enable building the Event Admin Service bundles" OFF DEPS LAUNCHER LOG_SERVICE SHELL shell_tui)
 if(EVENT_ADMIN)
-	if(NOT ${WITH_APR})
-		message(FATAL_ERROR "EVENT_ADMIN requires APR, enable WITH_APR option.")
-	endif()
+
 	#add_subdirectory(utils)
 	add_subdirectory(event_admin)
 	add_subdirectory(event_handler)
 	add_subdirectory(event_publisher)
-	
-	deploy("event_admin" BUNDLES event_admin shell shell_tui log_service log_writer)
-    deploy("event_publisher_example" BUNDLES event_admin event_publisher shell shell_tui log_service log_writer)
-	deploy("event_handler_example" BUNDLES event_admin event_handler shell shell_tui log_service log_writer)
-	deploy("event_admin_example" BUNDLES event_admin event_publisher event_handler shell shell_tui log_service log_writer)
+
+	#deploy("event_admin_bundle" BUNDLES event_admin shell shell_tui log_service log_writer)
+  #  deploy("event_publisher_example" BUNDLES event_admin event_publisher shell shell_tui log_service log_writer)
+#	deploy("event_handler_example" BUNDLES event_admin event_handler shell shell_tui log_service log_writer)
+#	deploy("event_admin_example" BUNDLES event_admin event_publisher event_handler shell shell_tui log_service log_writer)
+	add_deploy(event_admin_service
+			NAME "event_admin_service"
+			GROUP "event_admin/event_admin"
+			BUNDLES event_admin shell shell_tui log_service log_writer
+			)
+	add_deploy(event_handler_consumer
+			NAME "event_handler_consumer"
+			GROUP "event_handler"
+			BUNDLES event_handler event_admin shell shell_tui log_service log_writer)
+	add_deploy(event_publisher_consumer
+			NAME "event_publisher_consumer"
+			GROUP "event_publisher"
+			BUNDLES event_publisher event_handler event_admin shell shell_tui log_service log_writer)
 endif(EVENT_ADMIN)
diff --git a/event_admin/event_admin/CMakeLists.txt b/event_admin/event_admin/CMakeLists.txt
index b2e8013..4fe7ccd 100644
--- a/event_admin/event_admin/CMakeLists.txt
+++ b/event_admin/event_admin/CMakeLists.txt
@@ -15,7 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
-find_package(APR REQUIRED)
+
 
 include_directories(public/include)
 include_directories(private/include)
@@ -34,11 +34,6 @@
 		${PROJECT_SOURCE_DIR}/log_service/public/src/log_helper.c
 )
 
-install_add_bundle(event_admin
-	HEADERS
-	    public/include/event_admin.h
-	    public/include/event_constants.h
-	    public/include/event_handler.h
-)
+install_bundle(event_admin)
 
-target_link_libraries(event_admin celix_framework celix_utils ${APR_LIBRARY} ${APRUTIL_LIBRARY})
+target_link_libraries(event_admin celix_framework celix_utils)
diff --git a/event_admin/event_admin/private/include/event_admin_impl.h b/event_admin/event_admin/private/include/event_admin_impl.h
index 38a8606..20b0f1b 100644
--- a/event_admin/event_admin/private/include/event_admin_impl.h
+++ b/event_admin/event_admin/private/include/event_admin_impl.h
@@ -27,8 +27,6 @@
 #ifndef EVENT_ADMIN_IMPL_H_
 #define EVENT_ADMIN_IMPL_H_
 #include <string.h>
-#include <apr.h>
-#include <apr_pools.h>
 #include "celix_errno.h"
 #include "bundle_context.h"
 #include "constants.h"
@@ -45,7 +43,6 @@
 #include "log_helper.h"
 
 struct event_admin {
-        apr_pool_t *pool;
         hash_map_pt channels;
         array_list_pt event_handlers;
         bundle_context_pt context;
@@ -56,7 +53,7 @@
         char *topic;
         hash_map_pt eventHandlers;///array list containing all listeners subscribed to the channel
        // hash_map_pt channels;
-        apr_thread_mutex_t *channelLock;
+       // apr_thread_mutex_t *channelLock;
 
 };
 /**
@@ -65,7 +62,11 @@
  * @param bundle_context_pt context. Pointer to the bundle context.
  * @param event_admin_pt *event_admin. The event admin result.
  */
-celix_status_t eventAdmin_create(apr_pool_t *pool, bundle_context_pt context, event_admin_pt *event_admin);
+celix_status_t eventAdmin_create( bundle_context_pt context, event_admin_pt *event_admin);
+
+
+celix_status_t eventAdmin_destroy(event_admin_pt *event_admin);
+
 /**
  * @desc Post event. sends the event to the handlers in async.
  * @param event_admin_pt event_admin. the event admin instance
@@ -100,7 +101,8 @@
  * @param char *topic, the topic string.
  * @param array_list_pt event_handlers. The array list to contain the interested handlers.
  */
-celix_status_t eventAdmin_findHandlersByTopic(event_admin_pt event_admin, char *topic , array_list_pt event_handlers);
+celix_status_t eventAdmin_findHandlersByTopic(event_admin_pt event_admin, const char *topic,
+                                              array_list_pt event_handlers);
 /**
  * @desc create the needed event channels for an event handler.
  * @desc apr_pool_t *pool. a memory pool pointer.
@@ -108,21 +110,24 @@
  * @desc char *topic the topic
  * @desc channel_t *channel. the top level channel.
  */
-celix_status_t eventAdmin_createEventChannelsByEventHandler(apr_pool_t *pool,event_handler_service_pt event_handler_service, char *topic, channel_t *channel);
+celix_status_t eventAdmin_createEventChannelsByEventHandler(event_handler_service_pt event_handler_service,
+                                                            const char *topic, channel_t *channel);
 /**
  * @desc mutex functions for the channels
  * @param event_admin_pt event_admin. the event admin instance.
  * @param char *topic. the topic for which the channels need to be locked or unlocked
  */
-celix_status_t eventAdmin_lockHandlersList(event_admin_pt event_admin, char *topic );
-celix_status_t eventAdmin_releaseHandersList(event_admin_pt event_admin, char *topic );
+celix_status_t eventAdmin_lockHandlersList(event_admin_pt event_admin, const char *topic);
+
+celix_status_t eventAdmin_releaseHandersList(event_admin_pt event_admin, const char *topic);
 
 /**
  * @desc create an event
  * @param char *topic. String containing the topic
  * @param properties_pt properties.
  */
-celix_status_t eventAdmin_createEvent(event_admin_pt event_admin, char *topic, properties_pt properties, event_pt *event);
+celix_status_t eventAdmin_createEvent(event_admin_pt event_admin, const char *topic, properties_pt properties,
+                                      event_pt *event);
 /**
  * @desc checks if an event contains the property
  * @param event_pt *event. the event to check
@@ -143,7 +148,7 @@
  * @param char *propertyKey the key of the property to get
  * @param char **propertyValue. the result param will contain the property if it exists in the event.
  */
-celix_status_t eventAdmin_getProperty( event_pt *event, char *propertyKey, char **propertyValue);
+celix_status_t eventAdmin_getProperty(event_pt *event, char *propertyKey, const char **propertyValue);
 /**
  * @desc gets all property names from the event
  * @param event_pt *event. the event to get the property names from
@@ -155,7 +160,7 @@
  * @param event_pt *event. the event to get the topic from
  * @param char **topic, result pointer will contain the topic.
  */
-celix_status_t eventAdmin_getTopic( event_pt *event, char **topic);
+celix_status_t eventAdmin_getTopic(event_pt *event, const char **topic);
 celix_status_t eventAdmin_hashCode(event_pt *event, int *hashCode);
 celix_status_t eventAdmin_matches( event_pt *event);
 celix_status_t eventAdmin_toString( event_pt *event, char *eventString);
diff --git a/event_admin/event_admin/private/src/event_admin_activator.c b/event_admin/event_admin/private/src/event_admin_activator.c
index abe7fb0..a5f8cb2 100644
--- a/event_admin/event_admin/private/src/event_admin_activator.c
+++ b/event_admin/event_admin/private/src/event_admin_activator.c
@@ -31,7 +31,7 @@
 #include "log_service.h"
 
 struct activator {
-	apr_pool_t *pool;
+
 	event_admin_service_pt event_admin_service;
 	event_admin_pt event_admin;
 	service_registration_pt registration;
@@ -42,50 +42,47 @@
 
 celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
 	celix_status_t status = CELIX_SUCCESS;
-	apr_pool_t *pool = NULL;
-	apr_pool_t *parentPool;
+
 	struct activator *activator;
-	status = bundleContext_getMemoryPool(context, &parentPool);
-	if( status == CELIX_SUCCESS ) {
-		if(apr_pool_create(&pool,parentPool) != APR_SUCCESS) {
-			status = CELIX_BUNDLE_EXCEPTION;
-		}else {
-			activator = apr_palloc(pool,sizeof(*activator));
-			activator->pool = pool;
-			activator->registration = NULL;
-			logHelper_create(context, &activator->loghelper);
+	activator = calloc(1, sizeof(*activator));
 
-			*userData = activator;
-			event_admin_pt event_admin = NULL;
-			event_admin_service_pt event_admin_service = NULL;
-			status = eventAdmin_create(activator->pool,context, &event_admin);
-			if(status == CELIX_SUCCESS){
-				activator->event_admin = event_admin;
-				event_admin_service = apr_palloc(activator->pool, sizeof(event_admin_service));
-				if(!event_admin_service){
-					status = CELIX_ENOMEM;
-				} else {
-					event_admin->context = context;
-					event_admin->loghelper = &activator->loghelper;
-					event_admin_service->eventAdmin = event_admin;
-					event_admin_service->postEvent = eventAdmin_postEvent;
-					event_admin_service->sendEvent = eventAdmin_sendEvent;
-					event_admin_service->createEvent = eventAdmin_createEvent;
-					event_admin_service->containsProperty = eventAdmin_containsProperty;
-					event_admin_service->event_equals = eventAdmin_event_equals;
-					event_admin_service->getProperty = eventAdmin_getProperty;
-					event_admin_service->getPropertyNames = eventAdmin_getPropertyNames;
-					event_admin_service->getTopic = eventAdmin_getTopic;
-					event_admin_service->hashCode = eventAdmin_hashCode;
-					event_admin_service->matches = eventAdmin_matches;
-					event_admin_service->toString = eventAdmin_toString;
+	if(!activator) {
+		status = CELIX_BUNDLE_EXCEPTION;
+	}else {
+		activator->registration = NULL;
+		logHelper_create(context, &activator->loghelper);
 
-				}
+		*userData = activator;
+		event_admin_pt event_admin = NULL;
+		event_admin_service_pt event_admin_service = NULL;
+		status = eventAdmin_create(context, &event_admin);
+		if(status == CELIX_SUCCESS){
+			activator->event_admin = event_admin;
+			event_admin_service = calloc(1, sizeof(event_admin_service));
+			if(!event_admin_service){
+				status = CELIX_ENOMEM;
+			} else {
+				event_admin->context = context;
+				event_admin->loghelper = &activator->loghelper;
+				event_admin_service->eventAdmin = event_admin;
+				event_admin_service->postEvent = eventAdmin_postEvent;
+				event_admin_service->sendEvent = eventAdmin_sendEvent;
+				event_admin_service->createEvent = eventAdmin_createEvent;
+				event_admin_service->containsProperty = eventAdmin_containsProperty;
+				event_admin_service->event_equals = eventAdmin_event_equals;
+				event_admin_service->getProperty = eventAdmin_getProperty;
+				event_admin_service->getPropertyNames = eventAdmin_getPropertyNames;
+				event_admin_service->getTopic = eventAdmin_getTopic;
+				event_admin_service->hashCode = eventAdmin_hashCode;
+				event_admin_service->matches = eventAdmin_matches;
+				event_admin_service->toString = eventAdmin_toString;
+
 			}
-			activator->event_admin_service = event_admin_service;
 		}
+		activator->event_admin_service = event_admin_service;
 	}
 
+
 	return status;
 }
 
@@ -93,8 +90,7 @@
 	celix_status_t status = CELIX_SUCCESS;
 	struct activator *activator = userData;
 	event_admin_service_pt event_admin_service = NULL;
-	apr_pool_t *pool;
-	status = bundleContext_getMemoryPool(context, &pool);
+
 	if(status == CELIX_SUCCESS) {
 		struct activator * data = (struct activator *) userData;
 		service_tracker_customizer_pt cust = NULL;
@@ -110,7 +106,6 @@
 		properties_pt properties = NULL;
 		properties = properties_create();
 		event_admin_service = activator->event_admin_service;
-		//printf("pointer of event admin service %p\n",event_admin_service);
 		bundleContext_registerService(context, (char *) EVENT_ADMIN_NAME, event_admin_service, properties, &activator->registration);
 		logHelper_start(activator->loghelper);
 	}
@@ -120,9 +115,10 @@
 celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
 	celix_status_t status = CELIX_SUCCESS;
 	struct activator * data =  userData;
-
+    serviceRegistration_unregister(data->registration);
 	serviceTracker_close(data->tracker);
 	status = logHelper_stop(data->loghelper);
+    logHelper_destroy(&data->loghelper);
 
 	return status;
 }
@@ -130,9 +126,9 @@
 
 celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
 	celix_status_t status = CELIX_SUCCESS;
-	struct activator * data =  userData;
+    //stop  struct activator *activator = userData;
 
-	status = logHelper_destroy(&data->loghelper);
+    // free(activator);
 
 	return status;
 }
diff --git a/event_admin/event_admin/private/src/event_admin_impl.c b/event_admin/event_admin/private/src/event_admin_impl.c
index 83df555..a7eeb49 100644
--- a/event_admin/event_admin/private/src/event_admin_impl.c
+++ b/event_admin/event_admin/private/src/event_admin_impl.c
@@ -33,13 +33,12 @@
 #include "celix_log.h"
 
 
-celix_status_t eventAdmin_create(apr_pool_t *pool, bundle_context_pt context, event_admin_pt *event_admin){
+celix_status_t eventAdmin_create(bundle_context_pt context, event_admin_pt *event_admin){
 	celix_status_t status = CELIX_SUCCESS;
-	*event_admin = apr_palloc(pool, sizeof(**event_admin));
+	*event_admin = calloc(1,sizeof(**event_admin));
 	if (!*event_admin) {
         status = CELIX_ENOMEM;
     } else {
-        (*event_admin)->pool = pool;
         (*event_admin)->channels = hashMap_create(utils_stringHash, utils_stringHash, utils_stringEquals, utils_stringEquals);
         (*event_admin)->context =context;
         status = arrayList_create(&(*event_admin)->event_handlers);
@@ -47,15 +46,23 @@
 	return status;
 }
 
+celix_status_t eventAdmin_destroy(event_admin_pt *event_admin)
+{
+	celix_status_t status = CELIX_SUCCESS;
+	//free(*event_admin);
+	return status;
+}
+
 celix_status_t eventAdmin_getEventHandlersByChannel(bundle_context_pt context, const char * serviceName, array_list_pt *eventHandlers) {
-	celix_status_t status = bundleContext_getServiceReferences(context, serviceName, NULL, eventHandlers);
+	celix_status_t status = CELIX_SUCCESS;
+	//celix_status_t status = bundleContext_getServiceReferences(context, serviceName, NULL, eventHandlers);
 	return status;
 }
 
 celix_status_t eventAdmin_postEvent(event_admin_pt event_admin, event_pt event) {
 	celix_status_t status = CELIX_SUCCESS;
 
-	char *topic;
+	const char *topic;
 
     eventAdmin_getTopic(&event, &topic);
 
@@ -77,7 +84,7 @@
 celix_status_t eventAdmin_sendEvent(event_admin_pt event_admin, event_pt event) {
 	celix_status_t status = CELIX_SUCCESS;
 
-	char *topic;
+	const char *topic;
 	eventAdmin_getTopic(&event, &topic);
 
 	array_list_pt event_handlers;
@@ -94,7 +101,8 @@
 	return status;
 }
 
-celix_status_t eventAdmin_findHandlersByTopic(event_admin_pt event_admin, char *topic, array_list_pt event_handlers) {
+celix_status_t eventAdmin_findHandlersByTopic(event_admin_pt event_admin, const char *topic,
+											  array_list_pt event_handlers) {
 	celix_status_t status = CELIX_SUCCESS;
 	hash_map_pt channels = event_admin->channels;
     channel_t channel = hashMap_get(channels, topic);
@@ -113,25 +121,25 @@
 	return status;
 }
 
-celix_status_t eventAdmin_createEventChannels(event_admin_pt *event_admin, char *topic, event_handler_service_pt event_handler_service){
+celix_status_t eventAdmin_createEventChannels(event_admin_pt *event_admin, const char *topic,
+											  event_handler_service_pt event_handler_service) {
 	celix_status_t status = CELIX_SUCCESS;
     channel_t channel = hashMap_get((*event_admin)->channels, topic);
 	if (channel == NULL) {
 		//create channel
-		logHelper_log(*(*event_admin)->loghelper, OSGI_LOGSERVICE_INFO, "Creating channel: %s", topic);
+		logHelper_log(*(*event_admin)->loghelper, OSGI_LOGSERVICE_ERROR, "Creating channel: %s", topic);
 
-        apr_pool_t *subPool = NULL;
-        apr_pool_create(&subPool, (*event_admin)->pool);
 
-		channel = apr_palloc(subPool, sizeof(*channel));
+
+		channel = calloc(1, sizeof(*channel));
 		if (!channel) {
             status = CELIX_ENOMEM;
         } else {
             char *channel_name = strdup(topic);
 			channel->topic = channel_name;
 			channel->eventHandlers = hashMap_create(NULL,NULL,NULL,NULL);
-			channel->channelLock = NULL;
-            apr_thread_mutex_create(&channel->channelLock, APR_THREAD_MUTEX_NESTED, subPool);
+			//channel->channelLock = NULL;
+          //  apr_thread_mutex_create(&channel->channelLock, APR_THREAD_MUTEX_NESTED, subPool);
 			hashMap_put((*event_admin)->channels, channel_name, channel);
 		}
     }
@@ -140,64 +148,30 @@
     }
 	return status;
 
-	/*apr_pool_t *subPool= NULL;
-     apr_pool_create(&subPool,(*event_admin)->pool);
-     char delims[] = "/";
-     char *result = NULL;
-     result = strtok_r( topic, delims );
-     if(result != NULL){
-     strcpy(complete_channel_name, result);
-     }
-     while( result != NULL  && status == CELIX_SUCCESS) {
-     channel_t channel;
-     //check if the channel exists
-     if(hashMap_containsKey((*event_admin)->channels,complete_channel_name)==1) {
-     channel = hashMap_get((*event_admin)->channels,complete_channel_name);
-     //hashMap_put(channel->eventHandlers,&event_handler_service,event_handler_service);
-     }else {
-     //create channel
-     channel = apr_palloc(subPool, sizeof(*channel));
-     if(!channel){
-     status = CELIX_ENOMEM;
-     }else {
-     channel->topic = complete_channel_name;
-     channel->eventHandlers = hashMap_create(NULL,NULL,NULL,NULL);
-     channel->channelLock = NULL;
-     apr_thread_mutex_create(&channel->channelLock,APR_THREAD_MUTEX_NESTED, subPool);
-     }
-     }
-     result = strtok_r( NULL, delims );
-     if(result != NULL && status == CELIX_SUCCESS){
-     strcat(complete_channel_name, "/");
-     strcat(complete_channel_name, result);
-     }else if(status == CELIX_SUCCESS) {
-     hashMap_put(channel->eventHandlers,&event_handler_service,event_handler_service);
-     }
-     }*/
 
 }
 
-celix_status_t eventAdmin_lockHandlersList(event_admin_pt event_admin, char *topic) {
+celix_status_t eventAdmin_lockHandlersList(event_admin_pt event_admin, const char *topic) {
 	celix_status_t status = CELIX_SUCCESS;
-    channel_t channel = hashMap_get(event_admin->channels, topic);
+    /*channel_t channel = hashMap_get(event_admin->channels, topic);
 	if (channel != NULL) {
         // TODO verify this will never deadlock...
-        apr_status_t status;
+       // apr_status_t status;
         do {
-            status = apr_thread_mutex_trylock(channel->channelLock);
+         //   status = apr_thread_mutex_trylock(channel->channelLock);
         } while (status != 0 && !APR_STATUS_IS_EBUSY(status));
         logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_DEBUG, "LOCK: %s!", topic);
-    }
+    }*/
 	return status;
 }
 
-celix_status_t eventAdmin_releaseHandersList(event_admin_pt event_admin, char *topic) {
+celix_status_t eventAdmin_releaseHandersList(event_admin_pt event_admin, const char *topic) {
 	celix_status_t status = CELIX_SUCCESS;
     channel_t channel = hashMap_get(event_admin->channels, topic);
 	if (channel != NULL) {
         // TODO check the result value...
-        apr_thread_mutex_unlock(channel->channelLock);
-        logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_DEBUG, "UNLOCK: %s!", topic);
+       // apr_thread_mutex_unlock(channel->channelLock);
+		logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_ERROR, "UNLOCK: %s!", topic);
     }
 	return status;
 }
@@ -206,6 +180,8 @@
 	celix_status_t status = CELIX_SUCCESS;
 	event_admin_pt  event_admin = handle;
 	status = bundleContext_getService(event_admin->context, ref, service);
+	logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_ERROR, "test");
+	printf("eventadmin adding service \n");
   	return status;
 }
 
@@ -214,21 +190,23 @@
 	event_admin_pt event_admin = handle;
 	event_handler_service_pt event_handler_service = NULL;
 	event_handler_service = (event_handler_service_pt) service;
-	char *topic = NULL;
+	const char *topic = NULL;
 	serviceReference_getProperty(ref, (char*)EVENT_TOPIC, &topic);
-	logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_DEBUG, "Original TOPIC: %s", topic);
+	logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_ERROR, "Original TOPIC: %s", topic);
+	printf("original topic: %s\n", topic);
 	eventAdmin_createEventChannels(&event_admin,topic,event_handler_service);
 	return status;
 }
 
 celix_status_t eventAdmin_modifiedService(void * handle, service_reference_pt ref, void * service) {
 	event_admin_pt event_admin = (event_admin_pt) handle;
-	logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_DEBUG, "Event admin Modified");
+	logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_ERROR, "Event admin Modified");
 	return CELIX_SUCCESS;
 }
 
 celix_status_t eventAdmin_removedService(void * handle, service_reference_pt ref, void * service) {
 	event_admin_pt event_admin = (event_admin_pt) handle;
-	logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_DEBUG, "Event admin Removed %p", service);
+	logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_ERROR, "Event admin Removed %p", service);
+	printf("Event admin Removed %p", service);
 	return CELIX_SUCCESS;
 }
diff --git a/event_admin/event_admin/private/src/event_impl.c b/event_admin/event_admin/private/src/event_impl.c
index b3a7f43..aad9877 100644
--- a/event_admin/event_admin/private/src/event_impl.c
+++ b/event_admin/event_admin/private/src/event_impl.c
@@ -24,28 +24,24 @@
  *  \copyright	Apache License, Version 2.0
  *
  */
-
+#include <stdlib.h>
 
 #include "event_admin.h"
 #include "event_admin_impl.h"
 #include "event_constants.h"
 #include "celix_errno.h"
 #include "stddef.h"
-#include <apr.h>
-#include <apr_pools.h>
 
-struct event {
-	char *topic;
-	properties_pt properties;
-};
 
-celix_status_t eventAdmin_createEvent(event_admin_pt event_admin, char *topic, properties_pt properties, event_pt *event){
+
+celix_status_t eventAdmin_createEvent(event_admin_pt event_admin, const char *topic, properties_pt properties,
+									  event_pt *event) {
 	celix_status_t status = CELIX_SUCCESS;
 
 	logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_DEBUG, "create event event admin pointer: %p",event_admin);
-	logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_DEBUG, "pool create event: %p",event_admin->pool);
 
-	*event = apr_palloc(event_admin->pool,sizeof(**event));
+
+	*event = calloc(1, sizeof(**event));
 	if(!*event){
 	       status = CELIX_ENOMEM;
 	       logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_ERROR, "No MEM");
@@ -63,7 +59,7 @@
 	if((*event)==NULL || property == NULL){
 		status = CELIX_BUNDLE_EXCEPTION;
 	}else {
-		char * propertyValue = properties_get((*event)->properties,property);
+		const char *propertyValue = properties_get((*event)->properties, property);
 		if(propertyValue == NULL){
 			(*result)= false;
 		}else {
@@ -89,7 +85,7 @@
 	return status;
 }
 
-celix_status_t eventAdmin_getProperty( event_pt *event, char *propertyKey,  char **propertyValue){
+celix_status_t eventAdmin_getProperty(event_pt *event, char *propertyKey, const char **propertyValue) {
 	celix_status_t status = CELIX_SUCCESS;
 	*propertyValue = properties_get((*event)->properties,propertyKey);
 
@@ -110,9 +106,9 @@
 	return status;
 }
 
-celix_status_t eventAdmin_getTopic( event_pt *event, char **topic){
+celix_status_t eventAdmin_getTopic(event_pt *event, const char **topic) {
 	celix_status_t status = CELIX_SUCCESS;
-	char *value;
+	const char *value;
 	value = properties_get((*event)->properties,(char*) EVENT_TOPIC);
 	*topic = value;
 
diff --git a/event_admin/event_admin/public/include/event_admin.h b/event_admin/event_admin/public/include/event_admin.h
index 47b431f..4955b54 100644
--- a/event_admin/event_admin/public/include/event_admin.h
+++ b/event_admin/event_admin/public/include/event_admin.h
@@ -26,7 +26,6 @@
 
 #ifndef EVENT_ADMIN_H_
 #define EVENT_ADMIN_H_
-/*#include "event.h"*/
 #include "celix_errno.h"
 
 #include "listener_hook_service.h"
@@ -34,7 +33,13 @@
 #define EVENT_ADMIN_NAME "event_admin"
 typedef struct event_admin *event_admin_pt;
 typedef struct event_admin_service *event_admin_service_pt;
+
+struct event {
+	const char *topic;
+	properties_pt properties;
+};
 typedef struct event *event_pt;
+
 /**
  * @desc service description for the event admin.
  * @param event_admin_pt eventAdmin. incomplete type for the event admin instance.
@@ -46,12 +51,15 @@
 	celix_status_t (*postEvent)(event_admin_pt event_admin, event_pt event);
 	celix_status_t (*sendEvent)(event_admin_pt event_admin, event_pt event);
 
-	celix_status_t (*createEvent)(event_admin_pt event_admin, char *topic, properties_pt properties,  event_pt *event);
+	celix_status_t (*createEvent)(event_admin_pt event_admin, const char *topic, properties_pt properties,
+								  event_pt *event);
 	celix_status_t (*containsProperty)(event_pt *event, char *property, bool *result);
 	celix_status_t (*event_equals)(event_pt *event, event_pt *compare, bool *result);
-	celix_status_t (*getProperty)( event_pt *event, char *propertyKey, char **propertyValue);
+
+	celix_status_t (*getProperty)(event_pt *event, char *propertyKey, const char **propertyValue);
 	celix_status_t (*getPropertyNames)(event_pt *event, array_list_pt *names);
-	celix_status_t (*getTopic)( event_pt *event, char **topic);
+
+	celix_status_t (*getTopic)(event_pt *event, const char **topic);
 	celix_status_t (*hashCode)(event_pt *event, int *hashCode);
 	celix_status_t (*matches)( event_pt *event);
 	celix_status_t (*toString)( event_pt *event, char *eventString);
diff --git a/event_admin/event_admin/public/include/event_handler.h b/event_admin/event_admin/public/include/event_handler.h
index d7b71f6..5f76c6d 100644
--- a/event_admin/event_admin/public/include/event_handler.h
+++ b/event_admin/event_admin/public/include/event_handler.h
@@ -32,6 +32,9 @@
 
 typedef struct event_handler_service *event_handler_service_pt;
 typedef struct event_handler *event_handler_pt; //ADT
+
+
+
 /**
  * @desc description of the event handler service
  * @param event_handler_pt event_handler incomplete type pointer for the event_handler instance
diff --git a/event_admin/event_handler/CMakeLists.txt b/event_admin/event_handler/CMakeLists.txt
index 6c269aa..c786a78 100644
--- a/event_admin/event_handler/CMakeLists.txt
+++ b/event_admin/event_handler/CMakeLists.txt
@@ -15,7 +15,6 @@
 # specific language governing permissions and limitations
 # under the License.
 
-find_package(APR REQUIRED)
 
 include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
 include_directories(private/include)
@@ -31,6 +30,6 @@
 		${PROJECT_SOURCE_DIR}/log_service/public/src/log_helper.c
 )
 
-install_add_bundle(event_handler)
+install_bundle(event_handler)
 
-target_link_libraries(event_handler celix_framework celix_utils ${APR_LIBRARY} ${APRUTIL_LIBRARY})
+target_link_libraries(event_handler celix_framework celix_utils)
diff --git a/event_admin/event_handler/private/include/event_handler_impl.h b/event_admin/event_handler/private/include/event_handler_impl.h
index a796733..44fc671 100644
--- a/event_admin/event_handler/private/include/event_handler_impl.h
+++ b/event_admin/event_handler/private/include/event_handler_impl.h
@@ -49,7 +49,7 @@
  * @param apr_pool_t *pool the apr pool to contain the handler
  * @param event_handler_pt *event_handler. the event handler to be made.
  */
-celix_status_t eventHandlerCreate(apr_pool_t *pool, bundle_context_pt context,  event_handler_pt *event_handler);
+celix_status_t eventHandlerCreate(bundle_context_pt context, event_handler_pt *event_handler);
 celix_status_t  eventHandlerRemovedService(void * handle, service_reference_pt ref, void * service) ;
 celix_status_t  eventHandlerModifiedService(void * handle, service_reference_pt ref, void * service) ;
 celix_status_t  eventHandlerAddedService(void * handle, service_reference_pt ref, void * service) ;
diff --git a/event_admin/event_handler/private/src/event_handler_activator.c b/event_admin/event_handler/private/src/event_handler_activator.c
index cadde59..d39cfd9 100644
--- a/event_admin/event_handler/private/src/event_handler_activator.c
+++ b/event_admin/event_handler/private/src/event_handler_activator.c
@@ -31,7 +31,6 @@
 
 static const char * const EVENT_HANDLER_NAME = "demo";
 struct activator {
-	apr_pool_t *pool;
 	event_handler_service_pt event_handler_service;
 	service_registration_pt registration;
 	service_tracker_pt eventAdminTracker;
@@ -39,38 +38,29 @@
 
 celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
 	celix_status_t status = CELIX_SUCCESS;
-	apr_pool_t *pool = NULL;
-	apr_pool_t *parentPool;
 	struct activator *activator;
 
-	status = bundleContext_getMemoryPool(context, &parentPool);
-	if (status == CELIX_SUCCESS) {
-		if (apr_pool_create(&pool,parentPool) != APR_SUCCESS) {
-			status = CELIX_BUNDLE_EXCEPTION;
-		} else {
-			activator = apr_palloc(pool, sizeof(*activator));
-			activator->pool = pool;
-			activator->registration = NULL;
-			*userData = activator;
+    activator = calloc(1, sizeof(*activator));
+    activator->registration = NULL;
+    *userData = activator;
 
-			event_handler_pt event_handler = NULL;
-			event_handler_service_pt event_handler_service = NULL;
+    event_handler_pt event_handler = NULL;
+    event_handler_service_pt event_handler_service = NULL;
 
-			status = eventHandlerCreate(activator->pool, context, &event_handler);
-			if (status == CELIX_SUCCESS) {
-				event_handler_service = apr_palloc(activator->pool, sizeof(event_handler_service));
-				if (!event_handler_service) {
-					status = CELIX_ENOMEM;
-				} else {
-					event_handler_service->event_handler = event_handler;
-					event_handler_service->handle_event = eventHandlerHandleEvent;
-				}
-			}
-			activator->event_handler_service = event_handler_service;
+    status = eventHandlerCreate(context, &event_handler);
+    if (status == CELIX_SUCCESS) {
+        event_handler_service = calloc(1, sizeof(event_handler_service));
+        if (!event_handler_service) {
+            status = CELIX_ENOMEM;
+        } else {
+            event_handler_service->event_handler = event_handler;
+            event_handler_service->handle_event = eventHandlerHandleEvent;
 		}
 	}
+    activator->event_handler_service = event_handler_service;
 
-	return status;
+
+    return status;
 }
 
 celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
@@ -79,26 +69,31 @@
 
 	properties_pt properties = NULL;
 	properties = properties_create();
-	properties_set(properties,(char*)EVENT_HANDLER_SERVICE,(char *)EVENT_HANDLER_NAME);
-	properties_set(properties,(char*)EVENT_TOPIC, (char*) "log/error/eventpublishers/event");
+    properties_set(properties, (char *) EVENT_HANDLER_SERVICE, (const char *) EVENT_HANDLER_NAME);
+    properties_set(properties, (char *) EVENT_TOPIC, (const char *) "log/error/eventpublishers/event");
 
 	event_handler_service_pt event_handler_service = activator->event_handler_service;
-	bundleContext_registerService(context, (char *) EVENT_HANDLER_SERVICE, event_handler_service, properties, &activator->registration);
-	apr_pool_t *pool;
-	status = bundleContext_getMemoryPool(context, &pool);
-	if (status == CELIX_SUCCESS) {
-		service_tracker_customizer_pt customizer = NULL;
-		service_tracker_pt tracker = NULL;
-		serviceTrackerCustomizer_create(activator->event_handler_service->event_handler, eventHandlerAddingService, eventHandlerAddedService, eventHandlerModifiedService, eventHandlerRemovedService, &customizer);
-		serviceTracker_create(context, (char *) EVENT_ADMIN_NAME, customizer, &tracker);
-		activator->eventAdminTracker = tracker;
-		serviceTracker_open(tracker);
-	}
+    bundleContext_registerService(context, (const char *) EVENT_HANDLER_SERVICE, event_handler_service, properties,
+                                  &activator->registration);
+
+    /*if (status == CELIX_SUCCESS) {
+        service_tracker_customizer_pt customizer = NULL;
+        service_tracker_pt tracker = NULL;
+        serviceTrackerCustomizer_create(activator->event_handler_service->event_handler, eventHandlerAddingService, eventHandlerAddedService, eventHandlerModifiedService, eventHandlerRemovedService, &customizer);
+        serviceTracker_create(context, (const char *) EVENT_ADMIN_NAME, customizer, &tracker);
+        activator->eventAdminTracker = tracker;
+        serviceTracker_open(tracker);
+    }*/
 	return status;
 }
 
 celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
 	celix_status_t status = CELIX_SUCCESS;
+    struct activator *data = userData;
+    serviceRegistration_unregister(data->registration);
+    //serviceTracker_close(data->tracker);
+    //status = logHelper_stop(data->loghelper);
+    //logHelper_destroy(&data->loghelper);
 	return status;
 }
 
diff --git a/event_admin/event_handler/private/src/event_handler_impl.c b/event_admin/event_handler/private/src/event_handler_impl.c
index 24505e9..52ff1b7 100644
--- a/event_admin/event_handler/private/src/event_handler_impl.c
+++ b/event_admin/event_handler/private/src/event_handler_impl.c
@@ -23,25 +23,24 @@
  *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
  *  \copyright	Apache License, Version 2.0
  */
+#include <stdlib.h>
 #include "event_handler.h"
 #include "log_helper.h"
 #include "log_service.h"
 
 struct event_handler {
-	apr_pool_t *pool;
 	event_admin_service_pt event_admin_service;
 	bundle_context_pt context;
 	log_helper_pt loghelper;
 
 };
 
-celix_status_t eventHandlerCreate(apr_pool_t *pool, bundle_context_pt context, event_handler_pt *event_handler){
+celix_status_t eventHandlerCreate(bundle_context_pt context, event_handler_pt *event_handler) {
 	celix_status_t status = CELIX_SUCCESS;
-	*event_handler = apr_palloc(pool, sizeof(**event_handler));
+    *event_handler = calloc(1, sizeof(**event_handler));
 	if (!*event_handler) {
         status = CELIX_ENOMEM;
 	} else {
-        (*event_handler)->pool = pool;
         (*event_handler)->event_admin_service = NULL;
         (*event_handler)->context = context;
 
@@ -55,19 +54,27 @@
 celix_status_t eventHandlerHandleEvent(event_handler_pt *event_handler, event_pt event) {
 	celix_status_t status = CELIX_SUCCESS;
 	if (event != NULL) {
-		char *topic = NULL;
-		status = (*event_handler)->event_admin_service->getTopic(&event, &topic);
+        const char *topic = event->topic;
+        //status = (*event_handler)->event_admin_service->getTopic(&event, &topic);
 		logHelper_log((*event_handler)->loghelper, OSGI_LOGSERVICE_INFO, "[SUB] topic of event: %s.", topic);
 
 		array_list_pt propertyNames;
 		arrayList_create(&propertyNames);
-		status = (*event_handler)->event_admin_service->getPropertyNames(&event, &propertyNames);
-
+        properties_pt properties = event->properties;
+        if (hashMap_size(properties) > 0) {
+            hash_map_iterator_pt iterator = hashMapIterator_create(properties);
+            while (hashMapIterator_hasNext(iterator)) {
+                hash_map_entry_pt entry = hashMapIterator_nextEntry(iterator);
+                char *key = hashMapEntry_getKey(entry);
+                arrayList_add(propertyNames, key);
+            }
+        }
 		array_list_iterator_pt propertyIter = arrayListIterator_create(propertyNames);
 		while (arrayListIterator_hasNext(propertyIter)) {
-			char *key = arrayListIterator_next(propertyIter);
-			char *value = NULL;
-			(*event_handler)->event_admin_service->getProperty(&event,key,&value);
+            char *key = arrayListIterator_next(propertyIter);
+            const char *value = NULL;
+            value = properties_get((*event).properties, key);
+
 
 			logHelper_log((*event_handler)->loghelper, OSGI_LOGSERVICE_INFO, "[SUB] Key: %s value: %s.", key, value);
 		}
@@ -98,7 +105,7 @@
 
 celix_status_t eventHandlerRemovedService(void * handle, service_reference_pt ref, void * service) {
 	event_handler_pt data = (event_handler_pt) handle;
-logHelper_log(data->loghelper, OSGI_LOGSERVICE_DEBUG, "[SUB] Event admin removed.");
+    logHelper_log(data->loghelper, OSGI_LOGSERVICE_DEBUG, "[SUB] Event admin removed.");
 	data->event_admin_service = NULL;
 	return CELIX_SUCCESS;
 }
diff --git a/event_admin/event_publisher/CMakeLists.txt b/event_admin/event_publisher/CMakeLists.txt
index a7fd886..1999a9c 100644
--- a/event_admin/event_publisher/CMakeLists.txt
+++ b/event_admin/event_publisher/CMakeLists.txt
@@ -15,20 +15,20 @@
 # specific language governing permissions and limitations
 # under the License.
 
-find_package(APR REQUIRED)
 
 include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
 include_directories(private/include)
 include_directories(${PROJECT_SOURCE_DIR}/event_admin/event_admin/public/include)
 include_directories(${PROJECT_SOURCE_DIR}/log_service/public/include)
 
-add_bundle(event_publisher SOURCES
+add_bundle(event_publisher
     VERSION 0.0.0
-	private/src/event_publisher_activator.c
-	private/src/event_publisher_impl.c
-	${PROJECT_SOURCE_DIR}/log_service/public/src/log_helper.c	
+		SOURCES
+		private/src/event_publisher_activator.c
+		private/src/event_publisher_impl.c
+		${PROJECT_SOURCE_DIR}/log_service/public/src/log_helper.c
 )
 
-install_add_bundle(event_publisher)
+install_bundle(event_publisher)
 
-target_link_libraries(event_publisher celix_framework celix_utils ${APR_LIBRARY} ${APRUTIL_LIBRARY})
+target_link_libraries(event_publisher celix_framework celix_utils)
diff --git a/event_admin/event_publisher/private/include/event_publisher_impl.h b/event_admin/event_publisher/private/include/event_publisher_impl.h
index 31f306d..a2cab83 100644
--- a/event_admin/event_publisher/private/include/event_publisher_impl.h
+++ b/event_admin/event_publisher/private/include/event_publisher_impl.h
@@ -40,17 +40,13 @@
 #include "log_helper.h"
 #include "log_service.h"
 
-#include <apr.h>
-#include <apr_pools.h>
-#include <apr_thread_proc.h>
 
 typedef struct event_publisher *event_publisher_pt;
 struct event_publisher {
-	apr_pool_t *pool;
 	event_admin_service_pt event_admin_service;
 	bool running;
 	bool eventAdminAdded;
-	apr_thread_t *sender;
+	celix_thread_t sender;
 	bundle_context_pt context;
 	log_helper_pt loghelper;
 };
@@ -60,7 +56,7 @@
  * @param bundle_context_pt context the bundle context
  * @param event_publisher_pt *event_publisher. The publisher to be made.
  */
-celix_status_t eventPublisherCreate(apr_pool_t *pool, bundle_context_pt context, event_publisher_pt *event_publisher);
+celix_status_t eventPublisherCreate(bundle_context_pt context, event_publisher_pt *event_publisher);
 /**
  * @desc start the event publisher. Starts the threads and trackers.
  * @param event_publisher_pt *event_publisher the publisher to start
@@ -82,4 +78,6 @@
  * @param event_publisher_pt *event_publisher. pointer to the publisher.
  */
 celix_status_t eventPublisherStop(event_publisher_pt *event_publisher);
+
+void *produceEvents(void *handle);
 #endif /* EVENT_PUBLISHER_H_ */
diff --git a/event_admin/event_publisher/private/src/event_publisher_activator.c b/event_admin/event_publisher/private/src/event_publisher_activator.c
index 70cd1ec..279942f 100644
--- a/event_admin/event_publisher/private/src/event_publisher_activator.c
+++ b/event_admin/event_publisher/private/src/event_publisher_activator.c
@@ -24,13 +24,11 @@
  *  \copyright	Apache License, Version 2.0
  */
 #include <stdlib.h>
-#include <apr_thread_proc.h>
 
 
 #include "event_publisher_impl.h"
 
 struct activator {
-	apr_pool_t *pool;
 	bundle_context_pt context;
 	event_publisher_pt event_publisher;
 	service_tracker_pt tracker;
@@ -38,24 +36,18 @@
 
 celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
 	celix_status_t status = CELIX_SUCCESS;
-	apr_pool_t *pool = NULL;
-	apr_pool_t *parentPool;
+
 	struct activator *activator = NULL;
-	status = bundleContext_getMemoryPool(context, &parentPool);
+
+	activator = calloc(1, sizeof(*activator));
+	activator->context = context;
+	*userData = activator;
+
+	event_publisher_pt eventpublisher;
+	status = eventPublisherCreate(context, &eventpublisher);
 	if(status == CELIX_SUCCESS) {
-		if(apr_pool_create(&pool,parentPool) != APR_SUCCESS) {
-			status = CELIX_BUNDLE_EXCEPTION;
-		}else {
-			activator = apr_palloc(pool,sizeof(*activator));
-			activator->pool = pool;
-			activator->context = context;
-			*userData = activator;
-		}
-		event_publisher_pt eventpublisher;
-        status = eventPublisherCreate(activator->pool,context,&eventpublisher);
-        if(status == CELIX_SUCCESS) {
-            activator->event_publisher = eventpublisher;
-        }
+		activator->event_publisher = eventpublisher;
+
 	}
 
 	return status;
@@ -64,10 +56,9 @@
 celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
 	celix_status_t status = CELIX_SUCCESS;
 	struct activator * data = (struct activator *) userData;
-	apr_pool_t *pool;
-	status = bundleContext_getMemoryPool(context, &pool);
-	if(status == CELIX_SUCCESS){
-		service_tracker_customizer_pt cust = NULL;
+
+
+	service_tracker_customizer_pt cust = NULL;
 		service_tracker_pt tracker = NULL;
 		data->context = context;
 		serviceTrackerCustomizer_create(data->event_publisher, eventPublisherAddingService, eventPublisherAddedService, eventPublisherModifiedService, eventPublisherRemovedService, &cust);
@@ -75,7 +66,7 @@
 		data->tracker = tracker;
 
 		serviceTracker_open(tracker);
-	}
+
 	eventPublisherStart(&data->event_publisher);
 	return status;
 }
diff --git a/event_admin/event_publisher/private/src/event_publisher_impl.c b/event_admin/event_publisher/private/src/event_publisher_impl.c
index 0b3fb40..6a8bc00 100644
--- a/event_admin/event_publisher/private/src/event_publisher_impl.c
+++ b/event_admin/event_publisher/private/src/event_publisher_impl.c
@@ -23,46 +23,69 @@
  * \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
  * \copyright	Apache License, Version 2.0
  */
+#include <stdlib.h>
 
+#include <unistd.h>
+#include <sys/time.h>
 #include "event_publisher_impl.h"
 
-static void *APR_THREAD_FUNC eventPublisherSendEventThread(apr_thread_t *thd, void *handle);
+celix_thread_start_t eventPublisherSendEventThread(celix_thread_t *thd, void *handle);
 
-celix_status_t eventPublisherCreate(apr_pool_t *pool, bundle_context_pt context, event_publisher_pt *event_publisher) {
+celix_status_t eventPublisherCreate(bundle_context_pt context, event_publisher_pt *event_publisher) {
     celix_status_t status = CELIX_SUCCESS;
-    *event_publisher = apr_palloc(pool, sizeof(**event_publisher));
+    *event_publisher = calloc(1, sizeof(**event_publisher));
     if (!*event_publisher) {
         status = CELIX_ENOMEM;
     } else {
         (*event_publisher)->event_admin_service = NULL;
-        (*event_publisher)->pool = NULL;
+
         (*event_publisher)->eventAdminAdded = false;
         (*event_publisher)->running = false;
-        (*event_publisher)->pool = pool;
         (*event_publisher)->context = context;
-
+        (*event_publisher)->sender = celix_thread_default;
         logHelper_create(context, &(*event_publisher)->loghelper);
     }
     return status;
 }
 
 celix_status_t eventPublisherStart(event_publisher_pt *event_publisher) {
+    celix_status_t status = CELIX_SUCCESS;
 	(*event_publisher)->running = true;
     logHelper_start((*event_publisher)->loghelper);
-	apr_thread_create(&(*event_publisher)->sender, NULL, eventPublisherSendEventThread, event_publisher, (*event_publisher)->pool);
-	return CELIX_SUCCESS;
+    // celixThread_create((*event_publisher)->sender, NULL, eventPublisherSendEventThread, event_publisher);
+    status = celixThread_create(&(*event_publisher)->sender, NULL, produceEvents, &(*event_publisher));
+    return status;
 }
 
 celix_status_t eventPublisherStop(event_publisher_pt *event_publisher) {
 	(*event_publisher)->running = false;
-	apr_status_t status;
-	apr_thread_join(&status,(*event_publisher)->sender);
+    //void * status;
+    // celixThread_join((*event_publisher)->sender, &status);
 	logHelper_stop((*event_publisher)->loghelper);
 	logHelper_destroy(&(*event_publisher)->loghelper);
 	return CELIX_SUCCESS;
 }
 
-static void *APR_THREAD_FUNC eventPublisherSendEventThread(apr_thread_t *thd, void *handle) {
+void *produceEvents(void *handle) {
+    event_publisher_pt *event_publisher = handle;
+    while ((*event_publisher)->running && (*event_publisher)->eventAdminAdded) {
+        //   sleep(1000000); // 1 sec.
+        event_admin_service_pt *event_admin_service = &(*event_publisher)->event_admin_service;
+        event_admin_pt event_admin = (*event_admin_service)->eventAdmin;
+        if (event_admin_service != NULL) {
+            event_pt event;
+            properties_pt props = properties_create();
+            properties_set(props, "This is a key", "this is a value");
+            (*event_admin_service)->createEvent(event_admin, "log/error/eventpublishers/event", props, &event);
+            (*event_admin_service)->postEvent(event_admin, event);
+            (*event_admin_service)->sendEvent(event_admin, event);
+            printf("send event\n");
+        }
+    }
+    return CELIX_SUCCESS;
+}
+
+/*celix_thread_start_t eventPublisherSendEventThread(celix_thread_t *thd, void *handle) {
     event_publisher_pt *client = (event_publisher_pt *) handle;
 
     while ((*client)->running && (*client)->eventAdminAdded) {
@@ -79,21 +102,22 @@
             (*event_admin_service)->sendEvent(event_admin, event);
         }
     }
-	apr_thread_exit(thd, APR_SUCCESS);
-	return NULL;
-}
+    celixThread_exit( APR_SUCCESS);
+	return NULL;*
+}*/
 
 celix_status_t eventPublisherAddingService(void * handle, service_reference_pt ref, void **service) {
 	celix_status_t status = CELIX_SUCCESS;
 	event_publisher_pt event_publisher = handle;
 	status = bundleContext_getService(event_publisher->context, ref, service);
-	return status;
+
+    return status;
 }
 
 celix_status_t eventPublisherAddedService(void * handle, service_reference_pt ref, void * service) {
     event_publisher_pt data = (event_publisher_pt) handle;
 	logHelper_log(data->loghelper, OSGI_LOGSERVICE_DEBUG, "[PUB] Event admin added.");
-
+    printf(" added event admin");
     data->event_admin_service = (event_admin_service_pt) service;
     data->eventAdminAdded = true;
 	return CELIX_SUCCESS;
diff --git a/event_admin/utils/CMakeLists.txt b/event_admin/utils/CMakeLists.txt
deleted file mode 100644
index 576dd08..0000000
--- a/event_admin/utils/CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-find_package(APR REQUIRED)
-
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/event_admin/event_admin/public/include")
-include_directories(public/include)
-
-add_library(event_admin_utils STATIC private/src/event_impl.c)
-target_link_libraries(event_admin_utils ${APRUTIL_LIBRARY})
-#install(TARGETS event_admin_utils DESTINATION lib COMPONENT framework)
-#FILE(GLOB files "public/include/*.h")
-#INSTALL(FILES ${files} DESTINATION include/celix COMPONENT framework)
diff --git a/event_admin/utils/private/src/event_impl.c b/event_admin/utils/private/src/event_impl.c
deleted file mode 100644
index 3a5d07c..0000000
--- a/event_admin/utils/private/src/event_impl.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * event_impl.c
- *
- *  \Created on: Aug 22, 2013
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- *
- */
-
-
-#include "event.h"
-#include "event_constants.h"
-#include "celix_errno.h"
-#include "stddef.h"
-#include <apr.h>
-#include <apr_pools.h>
-struct event {
-	char *topic;
-	properties_pt properties;
-};
-
-celix_status_t createEvent(char *topic, properties_pt properties, apr_pool_t *pool, event_pt *event){
-	celix_status_t status = CELIX_SUCCESS;
-
-	*event= apr_palloc(pool,sizeof(**event));
-	if(!*event){
-	       status = CELIX_ENOMEM;
-	}else {
-		(*event)->topic = topic;
-		(*event)->properties = properties;
-		properties_set((*event)->properties, (char *)EVENT_TOPIC, topic);
-	}
-	return status;
-}
-
-celix_status_t containsProperty(event_pt *event, char *property, bool *result){
-	celix_status_t status = CELIX_SUCCESS;
-	if((*event)==NULL || property == NULL){
-		status = CELIX_BUNDLE_EXCEPTION;
-	}else {
-		char * propertyValue = properties_get((*event)->properties,property);
-		if(propertyValue == NULL){
-			(*result)= false;
-		}else {
-			(*result) = true;
-		}
-	}
-	return status;
-}
-
-celix_status_t event_equals(event_pt *event, event_pt *compare, bool *result){
-	celix_status_t status = CELIX_SUCCESS;
-	if(event == compare){
-		(*result) = true;
-	}else {
-		int sizeofEvent = hashMap_size((*event)->properties);
-		int sizeofCompare = hashMap_size((*compare)->properties);
-		if(sizeofEvent == sizeofCompare){
-			(*result) = true;
-		}else {
-
-		}
-	}
-	return status;
-}
-
-celix_status_t getProperty(event_pt *event, char *propertyKey,  char **propertyValue){
-	celix_status_t status = CELIX_SUCCESS;
-	*propertyValue = properties_get((*event)->properties,propertyKey);
-
-	return status;
-}
-
-celix_status_t getPropertyNames(event_pt *event, array_list_pt *names){
-	celix_status_t status = CELIX_SUCCESS;
-	properties_pt properties =  (*event)->properties;
-	if (hashMap_size(properties) > 0) {
-		hash_map_iterator_pt iterator = hashMapIterator_create(properties);
-		while (hashMapIterator_hasNext(iterator)) {
-			hash_map_entry_pt entry = hashMapIterator_nextEntry(iterator);
-			char * key =hashMapEntry_getKey(entry);
-			arrayList_add((*names),key);
-		}
-	}
-	return status;
-}
-
-celix_status_t getTopic(event_pt *event, char **topic){
-	celix_status_t status = CELIX_SUCCESS;
-	char *value;
-	value = properties_get((*event)->properties,(char*) EVENT_TOPIC);
-	*topic = value;
-
-	return status;
-}
-
-celix_status_t hashCode(event_pt *event, int *hashCode){
-	celix_status_t status = CELIX_SUCCESS;
-	return status;
-}
-
-celix_status_t matches(event_pt *event){
-	celix_status_t status = CELIX_SUCCESS;
-	return status;
-}
-
-celix_status_t toString(event_pt *event, char *eventString){
-	celix_status_t status = CELIX_SUCCESS;
-	return status;
-}
-
-
-
-
-
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 81fe2e1..5192ee3 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -14,39 +14,21 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-celix_subproject(EXAMPLES "Option to enable building the Examples" "OFF" DEPS FRAMEWORK DEPENDENCY_MANAGER2 LAUNCHER SHELL_TUI LOG_SERVICE LOG_WRITER)
+celix_subproject(EXAMPLES "Option to enable building the Examples" ON DEPS FRAMEWORK LAUNCHER SHELL_TUI LOG_SERVICE LOG_WRITER)
 if (EXAMPLES)
     add_subdirectory(hello_world)
     add_subdirectory(hello_world_test)
 
+    add_subdirectory(services_example_c)
+    add_subdirectory(services_example_cxx)
+
+    add_subdirectory(dm_example)
+    add_subdirectory(dm_example_cxx)
+
     if (NOT ANDROID)
     	add_subdirectory(mongoose)
     endif()
- 
     add_subdirectory(whiteboard)
-    add_subdirectory(echo_service)
-    add_subdirectory(producer_consumer)
-    add_subdirectory(dm_example)
-    
-    add_subdirectory(osgi-in-action/chapter04-correct-lookup)
-    add_subdirectory(osgi-in-action/chapter04-correct-listener)
-    add_subdirectory(osgi-in-action/chapter01-greeting-example)
-    #add_subdirectory(osgi-in-action/chapter04-paint-example) chapter4 example is still based on APR
-    add_subdirectory(locking)
-    
     add_subdirectory(embedding)
 
-    add_deploy(chapter01-greeting-example-d BUNDLES shell shell_tui log_service chapter01-greeting-example-client chapter01-greeting-example)
-    add_deploy(chapter04-correct-lookup-d BUNDLES shell shell_tui log_service chapter04-correct-lookup)
-    add_deploy(chapter04-correct-listener-d BUNDLES shell shell_tui log_service chapter04-correct-listener)
-
-    #deploy("hello_world" BUNDLES shell shell_tui apache_celix_examples_hello_world hello_world_test log_service log_writer)
-    add_deploy("wb" BUNDLES tracker publisherA publisherB shell shell_tui log_service log_writer)
-    add_deploy("wb_dp" BUNDLES tracker_depman publisherA publisherB shell shell_tui log_service log_writer dm_shell)
-    add_deploy("echo" BUNDLES echo_server echo_client shell shell_tui)
-    add_deploy("producer_consumer" BUNDLES producer consumer database shell shell_tui)
-    if (NOT ANDROID)
-        add_deploy("mongoose_deploy" BUNDLES shell shell_tui log_service mongoose)
-    endif ()
-
 endif(EXAMPLES)
diff --git a/examples/dm_example/CMakeLists.txt b/examples/dm_example/CMakeLists.txt
index 18738ef..816d738 100644
--- a/examples/dm_example/CMakeLists.txt
+++ b/examples/dm_example/CMakeLists.txt
@@ -30,13 +30,13 @@
     add_deploy("dm_example"
         COPY 
         BUNDLES
+            shell
+            shell_tui
+            dm_shell
             phase1
             phase2a
             phase2b
             phase3
-            shell
-            shell_tui
-            dm_shell
         PROPERTIES
             LOGHELPER_ENABLE_STDOUT_FALLBACK=true
     )
diff --git a/examples/dm_example/phase2a/private/include/phase2a_cmp.h b/examples/dm_example/phase2a/private/include/phase2a_cmp.h
index 5b8431a..060b23d 100644
--- a/examples/dm_example/phase2a/private/include/phase2a_cmp.h
+++ b/examples/dm_example/phase2a/private/include/phase2a_cmp.h
@@ -38,7 +38,7 @@
 int phase2a_deinit(phase2a_cmp_t *cmp);
 void phase2a_destroy(phase2a_cmp_t *cmp);
 
-int phase2a_setPhase1(phase2a_cmp_t *cmp, phase1_t *phase1);
+int phase2a_setPhase1(phase2a_cmp_t *cmp, const phase1_t* phase1);
 
 int phase2a_getData(phase2a_cmp_t *cmp, double *data);
 
diff --git a/examples/dm_example/phase2a/private/src/phase2a_activator.c b/examples/dm_example/phase2a/private/src/phase2a_activator.c
index a05ab54..6416c68 100644
--- a/examples/dm_example/phase2a/private/src/phase2a_activator.c
+++ b/examples/dm_example/phase2a/private/src/phase2a_activator.c
@@ -69,8 +69,8 @@
 		dm_service_dependency_pt dep;
 		serviceDependency_create(&dep);
 		serviceDependency_setService(dep, PHASE1_NAME, PHASE1_RANGE_ALL, NULL);
-
-        serviceDependency_setCallbacksSafe(dep, phase2a_cmp_t *, phase1_t *, phase2a_setPhase1, NULL, NULL, NULL, NULL);
+        serviceDependency_setCallbacksSafe(dep, phase2a_cmp_t*, const phase1_t*, phase2a_setPhase1, NULL, NULL, NULL, NULL);
+		serviceDependency_setStrategy(dep, DM_SERVICE_DEPENDENCY_STRATEGY_LOCKING);
 		serviceDependency_setRequired(dep, true);
 		component_addServiceDependency(cmp, dep);
 
diff --git a/examples/dm_example/phase2a/private/src/phase2a_cmp.c b/examples/dm_example/phase2a/private/src/phase2a_cmp.c
index b18ea99..e0b1cc8 100644
--- a/examples/dm_example/phase2a/private/src/phase2a_cmp.c
+++ b/examples/dm_example/phase2a/private/src/phase2a_cmp.c
@@ -38,7 +38,7 @@
     bool running;
 	double currentValue;
     celix_thread_mutex_t mutex;
-    phase1_t *phase1Serv;
+    const phase1_t* phase1Serv;
 };
 
 static void *phase2a_thread(void *data);
@@ -74,7 +74,7 @@
 }
 
 int phase2a_deinit(phase2a_cmp_t *cmp) {
-    printf("deinit phase1\n");
+    printf("deinit phase2a\n");
     return 0;
 }
 
@@ -85,7 +85,7 @@
 	printf("destroy phase2a\n");
 }
 
-int phase2a_setPhase1(phase2a_cmp_t *cmp, phase1_t *phase1) {
+int phase2a_setPhase1(phase2a_cmp_t *cmp, const phase1_t* phase1) {
     printf("phase2a_setPhase1 called!\n\n");
     celixThreadMutex_lock(&cmp->mutex);
     cmp->phase1Serv = phase1;
diff --git a/examples/dm_example/phase2b/private/include/phase2b_cmp.h b/examples/dm_example/phase2b/private/include/phase2b_cmp.h
index 527975b..7ae0358 100644
--- a/examples/dm_example/phase2b/private/include/phase2b_cmp.h
+++ b/examples/dm_example/phase2b/private/include/phase2b_cmp.h
@@ -38,7 +38,7 @@
 int phase2b_deinit(phase2b_cmp_t *cmp);
 void phase2b_destroy(phase2b_cmp_t *cmp);
 
-int phase2b_setPhase1(phase2b_cmp_t *cmp, phase1_t *phase1);
+int phase2b_setPhase1(phase2b_cmp_t *cmp, const phase1_t* phase1);
 
 int phase2b_getData(phase2b_cmp_t *cmp, double *data);
 
diff --git a/examples/dm_example/phase2b/private/src/phase2b_activator.c b/examples/dm_example/phase2b/private/src/phase2b_activator.c
index ca66d44..c7692d4 100644
--- a/examples/dm_example/phase2b/private/src/phase2b_activator.c
+++ b/examples/dm_example/phase2b/private/src/phase2b_activator.c
@@ -69,8 +69,9 @@
 		dm_service_dependency_pt dep;
 		serviceDependency_create(&dep);
 		serviceDependency_setService(dep, PHASE1_NAME, PHASE1_RANGE_EXACT, NULL);
-		serviceDependency_setCallbacksSafe(dep, phase2b_cmp_t *, phase1_t *, phase2b_setPhase1, NULL, NULL, NULL, NULL);
+		serviceDependency_setCallbacksSafe(dep, phase2b_cmp_t*, const phase1_t*, phase2b_setPhase1, NULL, NULL, NULL, NULL);
 		serviceDependency_setRequired(dep, true);
+		serviceDependency_setStrategy(dep, DM_SERVICE_DEPENDENCY_STRATEGY_LOCKING);
 		component_addServiceDependency(cmp, dep);
 
 		dependencyManager_add(manager, cmp);
diff --git a/examples/dm_example/phase2b/private/src/phase2b_cmp.c b/examples/dm_example/phase2b/private/src/phase2b_cmp.c
index 3f8d319..ccaa94d 100644
--- a/examples/dm_example/phase2b/private/src/phase2b_cmp.c
+++ b/examples/dm_example/phase2b/private/src/phase2b_cmp.c
@@ -38,7 +38,7 @@
     bool running;
 	double currentValue;
     celix_thread_mutex_t mutex;
-    phase1_t *phase1Serv;
+    const phase1_t* phase1Serv;
 };
 
 static void *phase2b_thread(void *data);
@@ -74,7 +74,7 @@
 }
 
 int phase2b_deinit(phase2b_cmp_t *cmp) {
-    printf("deinit phase1\n");
+    printf("deinit phase2b\n");
     return 0;
 }
 
@@ -85,7 +85,7 @@
 	printf("destroy phase2b\n");
 }
 
-int phase2b_setPhase1(phase2b_cmp_t *cmp, phase1_t *phase1) {
+int phase2b_setPhase1(phase2b_cmp_t *cmp, const phase1_t* phase1) {
     celixThreadMutex_lock(&cmp->mutex);
     cmp->phase1Serv = phase1;
     celixThreadMutex_unlock(&cmp->mutex);
diff --git a/examples/dm_example/phase3/private/include/phase3_cmp.h b/examples/dm_example/phase3/private/include/phase3_cmp.h
index 64c4137..9c63845 100644
--- a/examples/dm_example/phase3/private/include/phase3_cmp.h
+++ b/examples/dm_example/phase3/private/include/phase3_cmp.h
@@ -38,8 +38,8 @@
 int phase3_deinit(phase3_cmp_t *cmp);
 void phase3_destroy(phase3_cmp_t *cmp);
 
-int phase3_addPhase2(phase3_cmp_t *cmp, phase2_t *phase2);
-int phase3_removePhase2(phase3_cmp_t *cmp, phase2_t *phase2);
+int phase3_addPhase2(phase3_cmp_t *cmp, const phase2_t* phase2);
+int phase3_removePhase2(phase3_cmp_t *cmp, const phase2_t* phase2);
 
 
 #endif //PHASE3_CMP_H
diff --git a/examples/dm_example/phase3/private/src/phase3_activator.c b/examples/dm_example/phase3/private/src/phase3_activator.c
index 6377fcf..64b7a0b 100644
--- a/examples/dm_example/phase3/private/src/phase3_activator.c
+++ b/examples/dm_example/phase3/private/src/phase3_activator.c
@@ -58,8 +58,8 @@
 		dm_service_dependency_pt dep;
 		serviceDependency_create(&dep);
 		serviceDependency_setService(dep, PHASE2_NAME, NULL, NULL);
-		serviceDependency_setStrategy(dep, DM_SERVICE_DEPENDENCY_STRATEGY_SUSPEND);
-        serviceDependency_setCallbacksSafe(dep, phase3_cmp_t *, phase2_t *, NULL, phase3_addPhase2, NULL, phase3_removePhase2, NULL);
+		serviceDependency_setStrategy(dep, DM_SERVICE_DEPENDENCY_STRATEGY_SUSPEND); //SUSPEND Strategy is default
+        serviceDependency_setCallbacksSafe(dep, phase3_cmp_t*, const phase2_t*, NULL, phase3_addPhase2, NULL, phase3_removePhase2, NULL);
 		serviceDependency_setRequired(dep, true);
 		component_addServiceDependency(cmp, dep);
 
diff --git a/examples/dm_example/phase3/private/src/phase3_cmp.c b/examples/dm_example/phase3/private/src/phase3_cmp.c
index db01ad3..47cb720 100644
--- a/examples/dm_example/phase3/private/src/phase3_cmp.c
+++ b/examples/dm_example/phase3/private/src/phase3_cmp.c
@@ -74,7 +74,7 @@
 }
 
 int phase3_deinit(phase3_cmp_t *cmp) {
-    printf("deinit phase1\n");
+    printf("deinit phase3\n");
     return 0;
 }
 
@@ -84,13 +84,13 @@
 	printf("destroy phase3\n");
 }
 
-int phase3_addPhase2(phase3_cmp_t *cmp, phase2_t *phase2) {
-    arrayList_add(cmp->phase2Services, phase2);
+int phase3_addPhase2(phase3_cmp_t *cmp, const phase2_t* phase2) {
+    arrayList_add(cmp->phase2Services, (void*)phase2);
     return 0;
 }
 
-int phase3_removePhase2(phase3_cmp_t *cmp, phase2_t *phase2) {
-    arrayList_removeElement(cmp->phase2Services, phase2);
+int phase3_removePhase2(phase3_cmp_t *cmp, const phase2_t *phase2) {
+    arrayList_removeElement(cmp->phase2Services, (void*)phase2);
     return 0;
 }
 
@@ -104,7 +104,7 @@
     while (cmp->running) {
         size = arrayList_size(cmp->phase2Services);
         for (i = 0; i < size; i += 1) {
-            phase2_t *serv = arrayList_get(cmp->phase2Services, i);
+            const phase2_t* serv = arrayList_get(cmp->phase2Services, i);
             serv->getData(serv->handle, &value);
             printf("PHASE3: Data from %p is %f\n", serv, value);
         }
diff --git a/examples/dm_example_cxx/CMakeLists.txt b/examples/dm_example_cxx/CMakeLists.txt
new file mode 100644
index 0000000..88e1a89
--- /dev/null
+++ b/examples/dm_example_cxx/CMakeLists.txt
@@ -0,0 +1,55 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+if (BUILD_DEPENDENCY_MANAGER_CXX)
+    #set -Wall, -Werror locally, currenctly cpputest contains warnings
+    set(CMAKE_CXX_FLAGS "-Wall -Werror -fno-rtti -fno-exceptions ${CMAKE_CXX_FLAGS}")
+
+    include_directories(
+            ${PROJECT_SOURCE_DIR}/dependency_manager/public/include
+            ${PROJECT_SOURCE_DIR}/dependency_manager_cxx/include
+            ${PROJECT_SOURCE_DIR}/utils/public/include
+            ${PROJECT_SOURCE_DIR}/shell/public/include
+            ${PROJECT_SOURCE_DIR}/log_service/public/include
+            api
+    )
+
+    add_subdirectory(phase1)
+    add_subdirectory(phase2a)
+    add_subdirectory(phase2b)
+    add_subdirectory(phase3)
+    add_subdirectory(phase3_locking)
+
+
+    add_deploy("dm_example_cxx"
+        COPY 
+        BUNDLES
+            shell
+            shell_tui
+            dm_shell
+            log_service
+            log_writer
+
+            phase1_cxx
+            phase2a_cxx
+            phase2b_cxx
+            phase3_cxx
+            phase3_locking_cxx
+        PROPERTIES
+            LOGHELPER_ENABLE_STDOUT_FALLBACK=true
+    )
+
+endif ()
diff --git a/examples/producer_consumer/database/public/include/data.h b/examples/dm_example_cxx/api/IPhase1.h
similarity index 67%
copy from examples/producer_consumer/database/public/include/data.h
copy to examples/dm_example_cxx/api/IPhase1.h
index d5bd059..3f5fd3b 100644
--- a/examples/producer_consumer/database/public/include/data.h
+++ b/examples/dm_example_cxx/api/IPhase1.h
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0 
- * 
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -17,22 +17,16 @@
  * under the License.
  */
 
-/*
- * data.h
- *
- *  \date       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
+#ifndef CELIX_PHASE1_H
+#define CELIX_PHASE1_H
 
-#ifndef _DATA_H_
-#define _DATA_H_
+#define IPHASE1_VERSION "1.0.0"
 
-struct data {
-    int id;
-    char description[100];
+class IPhase1 {
+protected:
+    IPhase1() = default;
+public:
+    virtual int getData() = 0;
 };
 
-typedef struct data* data_pt;
-
-#endif
+#endif //CELIX_PHASE1_H
diff --git a/examples/producer_consumer/database/public/include/data.h b/examples/dm_example_cxx/api/IPhase2.h
similarity index 67%
copy from examples/producer_consumer/database/public/include/data.h
copy to examples/dm_example_cxx/api/IPhase2.h
index d5bd059..7b9fa05 100644
--- a/examples/producer_consumer/database/public/include/data.h
+++ b/examples/dm_example_cxx/api/IPhase2.h
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0 
- * 
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -17,22 +17,16 @@
  * under the License.
  */
 
-/*
- * data.h
- *
- *  \date       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
+#ifndef CELIX_PHASE2_H
+#define CELIX_PHASE2_H
 
-#ifndef _DATA_H_
-#define _DATA_H_
+#define IPHASE2_VERSION "1.0.0"
 
-struct data {
-    int id;
-    char description[100];
+class IPhase2 {
+protected:
+    IPhase2() = default;
+public:
+    virtual double getData() = 0;
 };
 
-typedef struct data* data_pt;
-
-#endif
+#endif //CELIX_PHASE2_H
diff --git a/examples/dm_example_cxx/phase1/CMakeLists.txt b/examples/dm_example_cxx/phase1/CMakeLists.txt
new file mode 100644
index 0000000..9f125ef
--- /dev/null
+++ b/examples/dm_example_cxx/phase1/CMakeLists.txt
@@ -0,0 +1,40 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+include_directories(
+        include
+        ../api
+)
+
+add_bundle(phase1_cxx
+    SYMBOLIC_NAME phase1_cxx
+    VERSION 0.0.1
+    SOURCES
+        src/Phase1Activator.cc
+        src/Phase1Cmp.cc
+)
+
+IF(APPLE)
+    target_link_libraries(phase1_cxx celix_framework -Wl,-all_load dependency_manager_cxx_static)
+else()
+    if(ENABLE_ADDRESS_SANITIZER)
+        #With asan there can be undefined symbols
+        target_link_libraries(phase1_cxx -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
+    else()
+        target_link_libraries(phase1_cxx -Wl,--no-undefined -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
+    endif()
+endif()
diff --git a/examples/producer_consumer/database/public/include/data.h b/examples/dm_example_cxx/phase1/include/Phase1Activator.h
similarity index 63%
copy from examples/producer_consumer/database/public/include/data.h
copy to examples/dm_example_cxx/phase1/include/Phase1Activator.h
index d5bd059..6029cec 100644
--- a/examples/producer_consumer/database/public/include/data.h
+++ b/examples/dm_example_cxx/phase1/include/Phase1Activator.h
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0 
- * 
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -17,22 +17,20 @@
  * under the License.
  */
 
-/*
- * data.h
- *
- *  \date       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
+#ifndef CELIX_PHASE1ACTIVATOR_H
+#define CELIX_PHASE1ACTIVATOR_H
 
-#ifndef _DATA_H_
-#define _DATA_H_
+#include "celix/dm/DmActivator.h"
+#include "command.h"
 
-struct data {
-    int id;
-    char description[100];
+using namespace celix::dm;
+
+class Phase1Activator : public DmActivator {
+    command_service_t cmd {};
+public:
+    Phase1Activator(DependencyManager& mng) : DmActivator(mng) {}
+    virtual void init();
+    virtual void deinit();
 };
 
-typedef struct data* data_pt;
-
-#endif
+#endif //CELIX_PHASE1ACTIVATOR_H
diff --git a/examples/producer_consumer/database/private/include/reader_service_impl.h b/examples/dm_example_cxx/phase1/include/Phase1Cmp.h
similarity index 62%
copy from examples/producer_consumer/database/private/include/reader_service_impl.h
copy to examples/dm_example_cxx/phase1/include/Phase1Cmp.h
index 6db7195..4401be0 100644
--- a/examples/producer_consumer/database/private/include/reader_service_impl.h
+++ b/examples/dm_example_cxx/phase1/include/Phase1Cmp.h
@@ -17,23 +17,26 @@
  * under the License.
  */
 
-/*
- * reader_service_impl.h
- *
- *  \date       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
+#ifndef CELIX_PHASE1CMP_H
+#define CELIX_PHASE1CMP_H
 
+#include "IPhase1.h"
+#include <stdint.h>
+#include <stdio.h>
 
+class Phase1Cmp : public IPhase1 {
+    uint32_t counter = 0;
+public:
+    Phase1Cmp() = default;
+    virtual ~Phase1Cmp() = default;
 
-#ifndef READER_SERVICE_IMPL_H_
-#define READER_SERVICE_IMPL_H_
+    void init();
+    void start();
+    void stop();
+    void deinit();
 
-#include "data.h"
-#include "database.h"
+    virtual int getData(); //implements IPhase1
+    virtual int infoCmd(char* line, FILE *out, FILE* err);  //implements cmd service
+};
 
-celix_status_t readerService_getFirstData(database_handler_pt, data_pt firstData);
-celix_status_t readerService_getNextData(database_handler_pt, data_pt* nextData);
-
-#endif
+#endif //CELIX_PHASE1CMP_H
diff --git a/examples/dm_example_cxx/phase1/src/BarActivator.cc b/examples/dm_example_cxx/phase1/src/BarActivator.cc
new file mode 100644
index 0000000..2f84d8e
--- /dev/null
+++ b/examples/dm_example_cxx/phase1/src/BarActivator.cc
@@ -0,0 +1,57 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "Phase1Cmp.h"
+#include "Phase1Activator.h"
+
+using namespace celix::dm;
+
+/* This example create a C++ component providing a C++ and C service
+ * For the C service a service struct in initialized and registered
+ * For the C++ service the object itself is used
+ */
+
+DmActivator* DmActivator::create(DependencyManager& mng) {
+    return new Phase1Activator(mng);
+}
+
+void Phase1Activator::init() {
+    std::shared_ptr<Phase1Cmp> cmp {new Phase1Cmp()};
+
+    Properties cmdProps;
+    cmdProps[OSGI_SHELL_COMMAND_NAME] = "phase1_info";
+    cmdProps[OSGI_SHELL_COMMAND_USAGE] = "phase1_info";
+    cmdProps[OSGI_SHELL_COMMAND_DESCRIPTION] = "Print information about the Phase1Cmp";
+
+
+    cmd.handle = cmp.get();
+    cmd.executeCommand = [](void *handle, char* line, FILE* out, FILE *err) {
+        Phase1Cmp* cmp = (Phase1Cmp*)handle;
+        return cmp->infoCmd(line, out, err);
+    };
+
+    createComponent(cmp)  //using a pointer a instance. Also supported is lazy initialization (default constructor needed) or a rvalue reference (move)
+        .addInterface<IPhase1>(IPHASE1_VERSION)
+        .addCInterface(&cmd, OSGI_SHELL_COMMAND_SERVICE_NAME, "", cmdProps)
+        .setCallbacks(&Phase1Cmp::init, &Phase1Cmp::start, &Phase1Cmp::stop, &Phase1Cmp::deinit);
+}
+
+void Phase1Activator::deinit() {
+    //nothing to do
+}
\ No newline at end of file
diff --git a/examples/dm_example_cxx/phase1/src/Phase1Activator.cc b/examples/dm_example_cxx/phase1/src/Phase1Activator.cc
new file mode 100644
index 0000000..2f84d8e
--- /dev/null
+++ b/examples/dm_example_cxx/phase1/src/Phase1Activator.cc
@@ -0,0 +1,57 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "Phase1Cmp.h"
+#include "Phase1Activator.h"
+
+using namespace celix::dm;
+
+/* This example create a C++ component providing a C++ and C service
+ * For the C service a service struct in initialized and registered
+ * For the C++ service the object itself is used
+ */
+
+DmActivator* DmActivator::create(DependencyManager& mng) {
+    return new Phase1Activator(mng);
+}
+
+void Phase1Activator::init() {
+    std::shared_ptr<Phase1Cmp> cmp {new Phase1Cmp()};
+
+    Properties cmdProps;
+    cmdProps[OSGI_SHELL_COMMAND_NAME] = "phase1_info";
+    cmdProps[OSGI_SHELL_COMMAND_USAGE] = "phase1_info";
+    cmdProps[OSGI_SHELL_COMMAND_DESCRIPTION] = "Print information about the Phase1Cmp";
+
+
+    cmd.handle = cmp.get();
+    cmd.executeCommand = [](void *handle, char* line, FILE* out, FILE *err) {
+        Phase1Cmp* cmp = (Phase1Cmp*)handle;
+        return cmp->infoCmd(line, out, err);
+    };
+
+    createComponent(cmp)  //using a pointer a instance. Also supported is lazy initialization (default constructor needed) or a rvalue reference (move)
+        .addInterface<IPhase1>(IPHASE1_VERSION)
+        .addCInterface(&cmd, OSGI_SHELL_COMMAND_SERVICE_NAME, "", cmdProps)
+        .setCallbacks(&Phase1Cmp::init, &Phase1Cmp::start, &Phase1Cmp::stop, &Phase1Cmp::deinit);
+}
+
+void Phase1Activator::deinit() {
+    //nothing to do
+}
\ No newline at end of file
diff --git a/examples/dm_example_cxx/phase1/src/Phase1Cmp.cc b/examples/dm_example_cxx/phase1/src/Phase1Cmp.cc
new file mode 100644
index 0000000..1137f72
--- /dev/null
+++ b/examples/dm_example_cxx/phase1/src/Phase1Cmp.cc
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "Phase1Cmp.h"
+#include <iostream>
+#include <stdlib.h>
+#include <stdio.h>
+
+void Phase1Cmp::init() {
+    std::cout << "init Phase1Cmp\n";
+}
+
+void Phase1Cmp::start() {
+    std::cout << "start Phase1Cmp\n";
+}
+
+void Phase1Cmp::stop() {
+    std::cout << "stop Phase1Cmp\n";
+}
+
+void Phase1Cmp::deinit() {
+    std::cout << "deinit Phase1Cmp\n";
+}
+
+int Phase1Cmp::getData() {
+    counter += 1;
+    return rand();
+};
+
+int Phase1Cmp::infoCmd(char * line, FILE *out, FILE *err) {
+    fprintf(out, "Phase1: number of getData calls: %u\n", counter);
+    return 0;
+}
diff --git a/examples/producer_consumer/database/public/include/data.h b/examples/dm_example_cxx/phase2/include/Phase2Activator.h
similarity index 66%
copy from examples/producer_consumer/database/public/include/data.h
copy to examples/dm_example_cxx/phase2/include/Phase2Activator.h
index d5bd059..069b2ae 100644
--- a/examples/producer_consumer/database/public/include/data.h
+++ b/examples/dm_example_cxx/phase2/include/Phase2Activator.h
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0 
- * 
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -17,22 +17,18 @@
  * under the License.
  */
 
-/*
- * data.h
- *
- *  \date       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
+#ifndef CELIX_PHASE2AACTIVATOR_H
+#define CELIX_PHASE2AACTIVATOR_H
 
-#ifndef _DATA_H_
-#define _DATA_H_
+#include "celix/dm/DmActivator.h"
 
-struct data {
-    int id;
-    char description[100];
+using namespace celix::dm;
+
+class Phase2Activator : public DmActivator {
+public:
+    Phase2Activator(DependencyManager& mng) : DmActivator(mng) {}
+    virtual void init();
+    virtual void deinit();
 };
 
-typedef struct data* data_pt;
-
-#endif
+#endif //CELIX_PHASE2AACTIVATOR_H
diff --git a/examples/dm_example_cxx/phase2/include/Phase2Cmp.h b/examples/dm_example_cxx/phase2/include/Phase2Cmp.h
new file mode 100644
index 0000000..a0de396
--- /dev/null
+++ b/examples/dm_example_cxx/phase2/include/Phase2Cmp.h
@@ -0,0 +1,50 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef CELIX_PHASE2CMP_H
+#define CELIX_PHASE2CMP_H
+
+#include "IPhase1.h"
+#include "IPhase2.h"
+#include <stdint.h>
+#include <stdio.h>
+#include <thread>
+#include <iostream>
+
+extern "C" {
+#include "log_service.h"
+};
+
+class Phase2Cmp : public IPhase2 {
+public:
+    Phase2Cmp() = default;
+    Phase2Cmp(Phase2Cmp&& other);
+    Phase2Cmp(const Phase2Cmp& other) = delete;
+    virtual ~Phase2Cmp() { std::cout << "Destroying Phase2\n"; };
+
+    void setPhase1(IPhase1* phase); //injector used by dependency manager
+    void setLogService(const log_service_t* logSrv);
+
+    virtual double getData(); //implements IPhase2
+private:
+    IPhase1* phase1 {nullptr};
+    const log_service_t* logSrv {nullptr};
+};
+
+#endif //CELIX_PHASE2CMP_H
diff --git a/examples/dm_example_cxx/phase2a/CMakeLists.txt b/examples/dm_example_cxx/phase2a/CMakeLists.txt
new file mode 100644
index 0000000..c423380
--- /dev/null
+++ b/examples/dm_example_cxx/phase2a/CMakeLists.txt
@@ -0,0 +1,41 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+include_directories(
+        ../phase2/include
+        ../api
+)
+
+add_bundle(phase2a_cxx
+    SYMBOLIC_NAME phase2a_cxx
+    VERSION 0.0.1
+    SOURCES
+        src/Phase2aActivator.cc
+        src/Phase2aCmp.cc
+)
+
+
+IF(APPLE)
+    target_link_libraries(phase2a_cxx celix_framework -Wl,-all_load dependency_manager_cxx_static)
+else()
+    if(ENABLE_ADDRESS_SANITIZER)
+        #With asan there can be undefined symbols
+        target_link_libraries(phase2a_cxx -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
+    else()
+        target_link_libraries(phase2a_cxx -Wl,--no-undefined -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
+    endif()
+endif()
diff --git a/examples/dm_example_cxx/phase2a/src/Phase2aActivator.cc b/examples/dm_example_cxx/phase2a/src/Phase2aActivator.cc
new file mode 100644
index 0000000..fdb8236
--- /dev/null
+++ b/examples/dm_example_cxx/phase2a/src/Phase2aActivator.cc
@@ -0,0 +1,52 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "Phase2Cmp.h"
+#include "Phase2Activator.h"
+#include "log_service.h"
+
+using namespace celix::dm;
+
+
+DmActivator* DmActivator::create(DependencyManager& mng) {
+    return new Phase2Activator(mng);
+}
+
+
+void Phase2Activator::init() {
+
+    Properties props {};
+    props["name"] = "phase2a";
+
+    Component<Phase2Cmp>& cmp = createComponent<Phase2Cmp>()
+            .setInstance(Phase2Cmp())
+            .addInterface<IPhase2>(IPHASE2_VERSION, props);
+
+    cmp.createServiceDependency<IPhase1>()
+            .setRequired(true)
+            .setCallbacks(&Phase2Cmp::setPhase1);
+
+    cmp.createCServiceDependency<log_service_t>(OSGI_LOGSERVICE_NAME)
+            .setRequired(false)
+            .setCallbacks(&Phase2Cmp::setLogService);
+}
+
+void Phase2Activator::deinit() {
+
+}
diff --git a/examples/dm_example_cxx/phase2a/src/Phase2aCmp.cc b/examples/dm_example_cxx/phase2a/src/Phase2aCmp.cc
new file mode 100644
index 0000000..8523ebe
--- /dev/null
+++ b/examples/dm_example_cxx/phase2a/src/Phase2aCmp.cc
@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "Phase2Cmp.h"
+#include <iostream>
+#include <stdlib.h>
+#include <stdio.h>
+
+Phase2Cmp::Phase2Cmp(Phase2Cmp&& other) : phase1(other.phase1), logSrv{other.logSrv} {
+    std::cout << "Move constructor Phase2Cmp called\n";
+    other.phase1 = nullptr;
+    other.logSrv = nullptr;
+}
+
+void Phase2Cmp::setPhase1(IPhase1* phase1) {
+    std::cout << "setting phase1 for phase2\n";
+    this->phase1 = phase1;
+}
+
+void Phase2Cmp::setLogService(const log_service_t* logSrv) {
+    this->logSrv = logSrv;
+}
+
+double Phase2Cmp::getData() {
+    if (this->logSrv != NULL) {
+        this->logSrv->log(this->logSrv->logger, OSGI_LOGSERVICE_DEBUG, (char *) "getting data from phase2cmp A\n");
+    }
+    return phase1->getData() * 42.0;
+};
diff --git a/examples/dm_example_cxx/phase2b/CMakeLists.txt b/examples/dm_example_cxx/phase2b/CMakeLists.txt
new file mode 100644
index 0000000..ae73563
--- /dev/null
+++ b/examples/dm_example_cxx/phase2b/CMakeLists.txt
@@ -0,0 +1,41 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+include_directories(
+        ../phase2/include
+        include
+        ../api
+)
+
+add_bundle(phase2b_cxx
+    SYMBOLIC_NAME phase2b_cxx
+    VERSION 0.0.1
+    SOURCES
+        src/Phase2bActivator.cc
+        src/Phase2bCmp.cc
+)
+
+IF(APPLE)
+    target_link_libraries(phase2b_cxx celix_framework -Wl,-all_load dependency_manager_cxx_static)
+else()
+    if(ENABLE_ADDRESS_SANITIZER)
+        #With asan there can be undefined symbols
+        target_link_libraries(phase2b_cxx -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
+    else()
+        target_link_libraries(phase2b_cxx -Wl,--no-undefined -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
+    endif()
+endif()
diff --git a/examples/dm_example_cxx/phase2b/src/Phase2bActivator.cc b/examples/dm_example_cxx/phase2b/src/Phase2bActivator.cc
new file mode 100644
index 0000000..1aae052
--- /dev/null
+++ b/examples/dm_example_cxx/phase2b/src/Phase2bActivator.cc
@@ -0,0 +1,50 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "Phase2Cmp.h"
+#include "Phase2Activator.h"
+#include "log_service.h"
+
+using namespace celix::dm;
+
+
+DmActivator* DmActivator::create(DependencyManager& mng) {
+    return new Phase2Activator(mng);
+}
+
+void Phase2Activator::init() {
+
+    Properties props {};
+    props["name"] = "phase2b";
+
+    Component<Phase2Cmp>& cmp = createComponent<Phase2Cmp>()
+        .addInterface<IPhase2>(IPHASE2_VERSION, props);
+
+    cmp.createServiceDependency<IPhase1>()
+            .setRequired(true)
+            .setCallbacks(&Phase2Cmp::setPhase1);
+
+    cmp.createCServiceDependency<log_service_t>(OSGI_LOGSERVICE_NAME)
+            .setRequired(false)
+            .setCallbacks(&Phase2Cmp::setLogService);
+}
+
+void Phase2Activator::deinit() {
+
+}
\ No newline at end of file
diff --git a/examples/producer_consumer/database/private/include/reader_service_impl.h b/examples/dm_example_cxx/phase2b/src/Phase2bCmp.cc
similarity index 60%
copy from examples/producer_consumer/database/private/include/reader_service_impl.h
copy to examples/dm_example_cxx/phase2b/src/Phase2bCmp.cc
index 6db7195..b6260af 100644
--- a/examples/producer_consumer/database/private/include/reader_service_impl.h
+++ b/examples/dm_example_cxx/phase2b/src/Phase2bCmp.cc
@@ -17,23 +17,23 @@
  * under the License.
  */
 
-/*
- * reader_service_impl.h
- *
- *  \date       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
+#include "Phase2Cmp.h"
+#include <iostream>
+#include <stdlib.h>
+#include <stdio.h>
 
+void Phase2Cmp::setPhase1(IPhase1* phase1) {
+    std::cout << "setting phase1 for phase2\n";
+    this->phase1 = phase1;
+}
 
+void Phase2Cmp::setLogService(const log_service_t* logSrv) {
+    this->logSrv = logSrv;
+}
 
-#ifndef READER_SERVICE_IMPL_H_
-#define READER_SERVICE_IMPL_H_
-
-#include "data.h"
-#include "database.h"
-
-celix_status_t readerService_getFirstData(database_handler_pt, data_pt firstData);
-celix_status_t readerService_getNextData(database_handler_pt, data_pt* nextData);
-
-#endif
+double Phase2Cmp::getData() {
+    if (this->logSrv != NULL) {
+        this->logSrv->log(this->logSrv->logger, OSGI_LOGSERVICE_DEBUG, (char *) "getting data from phase2cmp B\n");
+    }
+    return phase1->getData() * 24.0;
+};
diff --git a/examples/dm_example_cxx/phase3/CMakeLists.txt b/examples/dm_example_cxx/phase3/CMakeLists.txt
new file mode 100644
index 0000000..8877ac2
--- /dev/null
+++ b/examples/dm_example_cxx/phase3/CMakeLists.txt
@@ -0,0 +1,41 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+include_directories(
+        include
+        ../api
+)
+
+add_bundle(phase3_cxx
+    SYMBOLIC_NAME phase3_cxx
+    VERSION 0.0.1
+    SOURCES
+        src/Phase3Activator.cc
+        src/Phase3Cmp.cc
+)
+
+
+IF(APPLE)
+    target_link_libraries(phase3_cxx celix_framework -Wl,-all_load dependency_manager_cxx_static)
+else()
+    if(ENABLE_ADDRESS_SANITIZER)
+        #With asan there can be undefined symbols
+        target_link_libraries(phase3_cxx -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
+    else()
+        target_link_libraries(phase3_cxx -Wl,--no-undefined -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
+    endif()
+endif()
diff --git a/examples/producer_consumer/database/public/include/data.h b/examples/dm_example_cxx/phase3/include/Phase3Activator.h
similarity index 67%
copy from examples/producer_consumer/database/public/include/data.h
copy to examples/dm_example_cxx/phase3/include/Phase3Activator.h
index d5bd059..fc66c28 100644
--- a/examples/producer_consumer/database/public/include/data.h
+++ b/examples/dm_example_cxx/phase3/include/Phase3Activator.h
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0 
- * 
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -17,22 +17,17 @@
  * under the License.
  */
 
-/*
- * data.h
- *
- *  \date       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
+#ifndef CELIX_PHASE3ACTIVATOR_H
+#define CELIX_PHASE3ACTIVATOR_H
 
-#ifndef _DATA_H_
-#define _DATA_H_
+#include "celix/dm/DmActivator.h"
 
-struct data {
-    int id;
-    char description[100];
+using namespace celix::dm;
+
+class Phase3Activator : public DmActivator {
+public:
+    Phase3Activator(DependencyManager& mng) : DmActivator(mng) {}
+    virtual void init();
 };
 
-typedef struct data* data_pt;
-
-#endif
+#endif //CELIX_PHASE2AACTIVATOR_H
diff --git a/examples/dm_example_cxx/phase3/include/Phase3Cmp.h b/examples/dm_example_cxx/phase3/include/Phase3Cmp.h
new file mode 100644
index 0000000..8b7e974
--- /dev/null
+++ b/examples/dm_example_cxx/phase3/include/Phase3Cmp.h
@@ -0,0 +1,50 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef CELIX_PHASE3CMP_H
+#define CELIX_PHASE3CMP_H
+
+#include "IPhase1.h"
+#include "IPhase2.h"
+#include <stdint.h>
+#include <stdio.h>
+#include <thread>
+#include <iostream>
+#include <list>
+#include "celix/dm/Properties.h"
+
+class Phase3Cmp  {
+    std::map<IPhase2*,celix::dm::Properties> phases {};
+    bool running {false};
+    std::thread pollThread {};
+public:
+    Phase3Cmp() { std::cout << "Constructing Phase3Cmp\n"; }
+    virtual ~Phase3Cmp() = default;
+
+    void start();
+    void stop();
+
+    void poll();
+
+    void addPhase2(IPhase2* phase, celix::dm::Properties&& props); //injector used by dependency manager
+    void removePhase2(IPhase2* phase, celix::dm::Properties&& props); //injector used by dependency manager
+    void setPhase2a(IPhase2* phase);
+};
+
+#endif //CELIX_PHASE3CMP_H
diff --git a/examples/dm_example_cxx/phase3/src/Phase3Activator.cc b/examples/dm_example_cxx/phase3/src/Phase3Activator.cc
new file mode 100644
index 0000000..ef8cb86
--- /dev/null
+++ b/examples/dm_example_cxx/phase3/src/Phase3Activator.cc
@@ -0,0 +1,43 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+#include "Phase3Cmp.h"
+#include "Phase3Activator.h"
+
+using namespace celix::dm;
+
+
+DmActivator* DmActivator::create(DependencyManager& mng) {
+    return new Phase3Activator(mng);
+}
+
+void Phase3Activator::init() {
+    Component<Phase3Cmp>& cmp = createComponent<Phase3Cmp>() //NOTE no setInstance -> lazy initialization using the default constructor
+            .setCallbacks(nullptr, &Phase3Cmp::start, &Phase3Cmp::stop, nullptr);
+
+    cmp.createServiceDependency<IPhase2>()
+            .setRequired(true)
+            .setCallbacks(&Phase3Cmp::addPhase2, &Phase3Cmp::removePhase2);
+
+    cmp.createServiceDependency<IPhase2>()
+             .setRequired(false)
+             .setFilter("(&(name=phase2a)(non-existing=*))")
+             .setCallbacks(&Phase3Cmp::setPhase2a);
+}
diff --git a/examples/dm_example_cxx/phase3/src/Phase3Cmp.cc b/examples/dm_example_cxx/phase3/src/Phase3Cmp.cc
new file mode 100644
index 0000000..d128337
--- /dev/null
+++ b/examples/dm_example_cxx/phase3/src/Phase3Cmp.cc
@@ -0,0 +1,65 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "Phase3Cmp.h"
+#include <iostream>
+#include <stdlib.h>
+#include <stdio.h>
+#include <thread>
+#include <chrono>
+#include <sstream>
+
+void Phase3Cmp::start() {
+    std::cout << "start Phase3Cmp\n";
+    running = true;
+    pollThread = std::thread {&Phase3Cmp::poll, this};
+}
+
+void Phase3Cmp::stop() {
+    std::cout << "stop Phase3Cmp\n";
+    running = false;
+    pollThread.join();
+}
+
+void Phase3Cmp::poll() {
+    while (running) {
+        std::cout << "polling Phase3Cmp\n";
+        for (std::pair<IPhase2*, celix::dm::Properties> pair : this->phases) {
+            std::ostringstream oss {};
+            oss << "current data for " << pair.second["name"] << " is " << pair.first->getData() << "\n";
+            std::cout << oss.str();
+        }
+        std::this_thread::sleep_for(std::chrono::milliseconds(1000));
+    }
+}
+
+void Phase3Cmp::addPhase2(IPhase2* phase2, celix::dm::Properties&& props) {
+    std::cout << "adding Iphase2 for Phase3Cmp\n";
+    std::pair<IPhase2*, celix::dm::Properties> pair {phase2, props};
+    this->phases[phase2] = props;
+}
+
+void Phase3Cmp::removePhase2(IPhase2* phase2, celix::dm::Properties&& props) {
+    std::cout << "adding Iphase2 for Phase3Cmp\n";
+    this->phases.erase(phase2);
+}
+
+void Phase3Cmp::setPhase2a(IPhase2* phase) {
+    std::cout << "setting phase2a\n";
+}
diff --git a/examples/dm_example_cxx/phase3_locking/CMakeLists.txt b/examples/dm_example_cxx/phase3_locking/CMakeLists.txt
new file mode 100644
index 0000000..52b0f3a
--- /dev/null
+++ b/examples/dm_example_cxx/phase3_locking/CMakeLists.txt
@@ -0,0 +1,40 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+include_directories(
+        include
+        ../api
+)
+
+add_bundle(phase3_locking_cxx
+    SYMBOLIC_NAME phase3_locking_cxx
+    VERSION 0.0.1
+    SOURCES
+        src/Phase3LockingActivator.cc
+        src/Phase3LockingCmp.cc
+)
+
+IF(APPLE)
+    target_link_libraries(phase3_locking_cxx celix_framework -Wl,-all_load dependency_manager_cxx_static)
+else()
+    if(ENABLE_ADDRESS_SANITIZER)
+        #With asan there can be undefined symbols
+        target_link_libraries(phase3_locking_cxx -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
+    else()
+        target_link_libraries(phase3_locking_cxx -Wl,--no-undefined -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
+    endif()
+endif()
diff --git a/examples/producer_consumer/database/public/include/data.h b/examples/dm_example_cxx/phase3_locking/include/Phase3LockingActivator.h
similarity index 65%
copy from examples/producer_consumer/database/public/include/data.h
copy to examples/dm_example_cxx/phase3_locking/include/Phase3LockingActivator.h
index d5bd059..78d1748 100644
--- a/examples/producer_consumer/database/public/include/data.h
+++ b/examples/dm_example_cxx/phase3_locking/include/Phase3LockingActivator.h
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0 
- * 
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -17,22 +17,17 @@
  * under the License.
  */
 
-/*
- * data.h
- *
- *  \date       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
+#ifndef CELIX_PHASE3LOCKINGACTIVATOR_H
+#define CELIX_PHASE3LOCKINGACTIVATOR_H
 
-#ifndef _DATA_H_
-#define _DATA_H_
+#include "celix/dm/DmActivator.h"
 
-struct data {
-    int id;
-    char description[100];
+using namespace celix::dm;
+
+class Phase3LockingActivator : public DmActivator {
+public:
+    Phase3LockingActivator(DependencyManager& mng) : DmActivator(mng) {}
+    virtual void init();
 };
 
-typedef struct data* data_pt;
-
-#endif
+#endif //CELIX_PHASE3LOCKINGAACTIVATOR_H
diff --git a/examples/dm_example_cxx/phase3_locking/include/Phase3LockingCmp.h b/examples/dm_example_cxx/phase3_locking/include/Phase3LockingCmp.h
new file mode 100644
index 0000000..678fa80
--- /dev/null
+++ b/examples/dm_example_cxx/phase3_locking/include/Phase3LockingCmp.h
@@ -0,0 +1,50 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef CELIX_PHASE3LOCKINGCMP_H
+#define CELIX_PHASE3LOCKINGCMP_H
+
+#include "IPhase2.h"
+#include <stdint.h>
+#include <stdio.h>
+#include <thread>
+#include <iostream>
+#include <mutex>
+#include <map>
+#include "celix/dm/Properties.h"
+
+class Phase3LockingCmp  {
+    std::map<IPhase2*,celix::dm::Properties> phases {};
+    bool running {false};
+    std::thread pollThread {};
+    std::mutex mutex {};
+public:
+    Phase3LockingCmp() = default;
+    virtual ~Phase3LockingCmp() = default;
+
+    void start();
+    void stop();
+
+    void poll();
+
+    void addPhase2(IPhase2* phase, celix::dm::Properties&& props); //injector used by dependency manager
+    void removePhase2(IPhase2* phase, celix::dm::Properties&& props); //injector used by dependency manager
+};
+
+#endif //CELIX_PHASE3LOCKINGCMP_H
diff --git a/examples/dm_example_cxx/phase3_locking/src/Phase3LockingActivator.cc b/examples/dm_example_cxx/phase3_locking/src/Phase3LockingActivator.cc
new file mode 100644
index 0000000..c682371
--- /dev/null
+++ b/examples/dm_example_cxx/phase3_locking/src/Phase3LockingActivator.cc
@@ -0,0 +1,39 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+#include "Phase3LockingCmp.h"
+#include "Phase3LockingActivator.h"
+
+using namespace celix::dm;
+
+
+DmActivator* DmActivator::create(DependencyManager& mng) {
+    return new Phase3LockingActivator(mng);
+}
+
+void Phase3LockingActivator::init() {
+    Component<Phase3LockingCmp>& cmp = createComponent<Phase3LockingCmp>()
+        //NOTE no setInstance -> lazy initialization using the default constructor
+        .setCallbacks(nullptr, &Phase3LockingCmp::start, &Phase3LockingCmp::stop, nullptr);
+
+    cmp.createServiceDependency<IPhase2>()
+            .setStrategy(DependencyUpdateStrategy::locking)
+            .setCallbacks(&Phase3LockingCmp::addPhase2, &Phase3LockingCmp::removePhase2);
+}
\ No newline at end of file
diff --git a/examples/dm_example_cxx/phase3_locking/src/Phase3LockingCmp.cc b/examples/dm_example_cxx/phase3_locking/src/Phase3LockingCmp.cc
new file mode 100644
index 0000000..1d490fd
--- /dev/null
+++ b/examples/dm_example_cxx/phase3_locking/src/Phase3LockingCmp.cc
@@ -0,0 +1,66 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "Phase3LockingCmp.h"
+#include <iostream>
+#include <stdlib.h>
+#include <stdio.h>
+#include <thread>
+#include <chrono>
+#include <sstream>
+
+void Phase3LockingCmp::start() {
+    std::cout << "start Phase3LockingCmp\n";
+    running = true;
+    //pollThread = std::thread {&Phase3LockingCmp::poll, std::ref(*this)};
+    pollThread = std::thread {&Phase3LockingCmp::poll, this};
+}
+
+void Phase3LockingCmp::stop() {
+    std::cout << "stop Phase3LockingCmp\n";
+    running = false;
+    pollThread.join();
+}
+
+void Phase3LockingCmp::poll() {
+    while (running) {
+        std::cout << "polling Phase3LockingCmp\n";
+        mutex.lock();
+        for (std::pair<IPhase2*, celix::dm::Properties> pair : this->phases) {
+            std::ostringstream oss {};
+            oss << "current data for " << pair.second["name"] << " is " << pair.first->getData() << "\n";
+            std::cout << oss.str();
+        }
+        mutex.unlock();
+        std::this_thread::sleep_for(std::chrono::milliseconds(1000));
+    }
+}
+
+void Phase3LockingCmp::addPhase2(IPhase2* phase2, celix::dm::Properties&& props) {
+    std::cout << "adding Iphase2 for Phase3LockingCmp\n";
+    std::lock_guard<std::mutex> lock(mutex);
+    std::pair<IPhase2*, celix::dm::Properties> pair {phase2, props};
+    this->phases[phase2] = props;
+}
+
+void Phase3LockingCmp::removePhase2(IPhase2* phase2, celix::dm::Properties&& props) {
+    std::cout << "adding Iphase2 for Phase3LockingCmp\n";
+    std::lock_guard<std::mutex> lock(mutex);
+    this->phases.erase(phase2);
+}
diff --git a/examples/echo_service/CMakeLists.txt b/examples/echo_service/CMakeLists.txt
deleted file mode 100644
index 0b4682c..0000000
--- a/examples/echo_service/CMakeLists.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-add_subdirectory(server)
-add_subdirectory(client)
diff --git a/examples/echo_service/client/CMakeLists.txt b/examples/echo_service/client/CMakeLists.txt
deleted file mode 100644
index de66952..0000000
--- a/examples/echo_service/client/CMakeLists.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-add_bundle(echo_client
-	SYMBOLIC_NAME  "apache_celix_examples_echo_client"
-	VERSION "0.0.1"
-	NAME "Apache Celix Echo Client"
-	SOURCES
-		private/src/echo_client_activator
-		private/src/echo_client
-
-		private/include/echo_client_private.h
-)
-
-include_directories("private/include")
-include_directories("${PROJECT_SOURCE_DIR}/framework/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("../server/public/include")
-target_link_libraries(echo_client celix_framework)
diff --git a/examples/echo_service/client/private/include/echo_client_private.h b/examples/echo_service/client/private/include/echo_client_private.h
deleted file mode 100644
index e57597a..0000000
--- a/examples/echo_service/client/private/include/echo_client_private.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * echo_client_private.h
- *
- *  \date       Sep 21, 2010
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-#ifndef ECHO_CLIENT_PRIVATE_H_
-#define ECHO_CLIENT_PRIVATE_H_
-
-#include <celixbool.h>
-
-struct echoClient {
-	service_tracker_pt tracker;
-	bool running;
-	pthread_t sender_thread;
-	char *ident;
-};
-
-typedef struct echoClient * echo_client_pt;
-
-echo_client_pt echoClient_create(service_tracker_pt context);
-
-void echoClient_start(echo_client_pt client);
-void echoClient_stop(echo_client_pt client);
-
-void echoClient_destroy(echo_client_pt client);
-
-
-#endif /* ECHO_CLIENT_PRIVATE_H_ */
diff --git a/examples/echo_service/client/private/src/echo_client.c b/examples/echo_service/client/private/src/echo_client.c
deleted file mode 100644
index 6670684..0000000
--- a/examples/echo_service/client/private/src/echo_client.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * echo_client.c
- *
- *  \date       Sep 21, 2010
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include <pthread.h>
-#include <unistd.h>
-
-#include "service_tracker.h"
-
-#include "echo_client_private.h"
-#include "echo_server.h"
-
-static void *trk_send(void *handle) {
-
-	echo_client_pt client = (echo_client_pt) handle;
-
-	while (client->running) {
-		echo_service_pt service = (echo_service_pt) serviceTracker_getService(client->tracker);
-		if (service != NULL) {
-			service->echo(service->server, client->ident);
-		}
-		sleep(1);
-	}
-
-	pthread_exit(NULL);
-
-	return NULL;
-}
-
-echo_client_pt echoClient_create(service_tracker_pt echoServiceTracker) {
-	echo_client_pt client = malloc(sizeof(*client));
-
-	client->tracker = echoServiceTracker;
-	client->running = false;
-	client->ident = "OSX rules";
-
-	return client;
-}
-
-void echoClient_start(echo_client_pt client) {
-	client->running = true;
-	pthread_create(&client->sender_thread, NULL, trk_send, client);
-}
-
-void echoClient_stop(echo_client_pt client) {
-	client->running = false;
-	pthread_join(client->sender_thread, NULL);
-}
-
-void echoClient_destroy(echo_client_pt client) {
-	client->tracker = NULL;
-	client->sender_thread = 0;
-	free(client);
-	client = NULL;
-}
-
diff --git a/examples/echo_service/client/private/src/echo_client_activator.c b/examples/echo_service/client/private/src/echo_client_activator.c
deleted file mode 100644
index f03a741..0000000
--- a/examples/echo_service/client/private/src/echo_client_activator.c
+++ /dev/null
@@ -1,83 +0,0 @@
-#include <sys/cdefs.h>/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * echo_client_activator.c
- *
- *  \date       Sep 21, 2010
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdlib.h>
-
-#include "bundle_activator.h"
-#include "service_tracker.h"
-
-#include "echo_server.h"
-#include "echo_client_private.h"
-
-struct echoActivator {
-	echo_client_pt client;
-	service_tracker_pt tracker;
-};
-
-celix_status_t bundleActivator_create(bundle_context_pt __attribute__((unused)) context, void **userData) {
-	struct echoActivator * act = malloc(sizeof(*act));
-	act->client = NULL;
-	act->tracker = NULL;
-	*userData = act;
-
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
-	struct echoActivator * act = (struct echoActivator *) userData;
-
-	service_tracker_pt tracker = NULL;
-	echo_client_pt client = NULL;
-
-	serviceTracker_create(context, ECHO_SERVICE_NAME, NULL, &tracker);
-
-	act->tracker = tracker;
-
-	client = echoClient_create(tracker);
-	act->client = client;
-
-	echoClient_start(act->client);
-	serviceTracker_open(act->tracker);
-
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt __attribute__((unused)) context) {
-	struct echoActivator * act = (struct echoActivator *) userData;
-	serviceTracker_close(act->tracker);
-	echoClient_stop(act->client);
-
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt  __attribute__((unused)) context) {
-	struct echoActivator * act = (struct echoActivator *) userData;
-	serviceTracker_destroy(act->tracker);
-	echoClient_destroy(act->client);
-
-	free(act);
-
-	return CELIX_SUCCESS;
-}
diff --git a/examples/echo_service/server/CMakeLists.txt b/examples/echo_service/server/CMakeLists.txt
deleted file mode 100644
index fe2b268..0000000
--- a/examples/echo_service/server/CMakeLists.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-add_bundle(echo_server
-	SYMBOLIC_NAME "apache_celix_examples_echo_server"
-	VERSION "0.0.1"
-	NAME "Apache Celix Echo Server"
-	SOURCES
-		private/src/echo_server_activator
-		private/src/echo_server
-
-		private/include/echo_server_private.h
-)
-
-include_directories("private/include")
-include_directories("public/include")
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-target_link_libraries(echo_server celix_framework)
diff --git a/examples/echo_service/server/private/include/echo_server_private.h b/examples/echo_service/server/private/include/echo_server_private.h
deleted file mode 100644
index c93035b..0000000
--- a/examples/echo_service/server/private/include/echo_server_private.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * echo_server_private.h
- *
- *  \date       Sep 21, 2010
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-#ifndef ECHO_SERVER_PRIVATE_H_
-#define ECHO_SERVER_PRIVATE_H_
-
-#include "echo_server.h"
-
-echo_server_pt echoServer_create();
-void echoServer_echo(echo_server_pt server, char * text);
-void echoServer_destroy(echo_server_pt server);
-
-#endif /* ECHO_SERVER_PRIVATE_H_ */
diff --git a/examples/echo_service/server/private/src/echo_server.c b/examples/echo_service/server/private/src/echo_server.c
deleted file mode 100644
index 045b7b7..0000000
--- a/examples/echo_service/server/private/src/echo_server.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * echo_server.c
- *
- *  \date       Sep 21, 2010
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "echo_server_private.h"
-
-struct echoServer {
-	char * name;
-};
-
-echo_server_pt echoServer_create() {
-	echo_server_pt server = malloc(sizeof(*server));
-	server->name = "MacBook Pro";
-	return server;
-}
-
-void echoServer_echo(echo_server_pt server, char * text) {
-	printf("Server %s says %s\n", server->name, text);
-}
-
-void echoServer_destroy(echo_server_pt server) {
-	server->name = NULL;
-	free(server);
-	server = NULL;
-}
diff --git a/examples/echo_service/server/private/src/echo_server_activator.c b/examples/echo_service/server/private/src/echo_server_activator.c
deleted file mode 100644
index e7364f9..0000000
--- a/examples/echo_service/server/private/src/echo_server_activator.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * echo_server_activator.c
- *
- *  \date       Sep 21, 2010
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdlib.h>
-
-#include "bundle_activator.h"
-#include "echo_server_private.h"
-
-struct echoActivator {
-	service_registration_pt reg;
-	echo_service_pt es;
-};
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
-	struct echoActivator * act = malloc(sizeof(*act));
-	act->reg = NULL;
-	*userData = act;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
-	struct echoActivator * act = (struct echoActivator *) userData;
-
-	echo_service_pt es = malloc(sizeof(*es));
-	echo_server_pt server = echoServer_create();
-	es->server = server;
-	es->echo = echoServer_echo;
-
-	act->es = es;
-
-    bundleContext_registerService(context, ECHO_SERVICE_NAME, es, NULL, &act->reg);
-
-    return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
-	struct echoActivator * act = (struct echoActivator *) userData;
-
-	serviceRegistration_unregister(act->reg);
-	act->reg = NULL;
-
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
-	struct echoActivator * act = (struct echoActivator *) userData;
-	act->es->echo = NULL;
-	echoServer_destroy(act->es->server);
-	act->es->server = NULL;
-	free(act->es);
-	act->es = NULL;
-	act->reg = NULL;
-	free(act);
-
-	return CELIX_SUCCESS;
-}
diff --git a/examples/echo_service/server/public/include/echo_server.h b/examples/echo_service/server/public/include/echo_server.h
deleted file mode 100644
index 65acdf3..0000000
--- a/examples/echo_service/server/public/include/echo_server.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * echo_server.h
- *
- *  \date       Sep 21, 2010
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-#ifndef ECHO_SERVER_H_
-#define ECHO_SERVER_H_
-
-#define ECHO_SERVICE_NAME "echo_server"
-
-typedef struct echoServer * echo_server_pt;
-
-struct echoService {
-	echo_server_pt server;
-	void (*echo)(echo_server_pt server, char * text);
-};
-
-typedef struct echoService * echo_service_pt;
-
-#endif /* ECHO_SERVER_H_ */
diff --git a/examples/embedding/private/src/main.c b/examples/embedding/private/src/main.c
index c04099e..b77cb22 100644
--- a/examples/embedding/private/src/main.c
+++ b/examples/embedding/private/src/main.c
@@ -35,59 +35,65 @@
 };
 
 struct fooSrv {
-    struct foo *handle;
-    celix_status_t (*foo)(struct foo *handle);
+	struct foo *handle;
+	celix_status_t (*foo)(struct foo *handle);
 };
 
 celix_status_t embedded_foo();
 
 int main(void) {
 
-    framework_pt framework = NULL;
+	framework_pt framework = NULL;
 
-    properties_pt config = properties_create();
-    int rc = celixLauncher_launchWithProperties(config, &framework);
+	properties_pt config = properties_create();
+	int rc = celixLauncher_launchWithProperties(config, &framework);
 
-    if (rc == 0) {
-        bundle_pt fwBundle = NULL;
-        framework_getFrameworkBundle(framework, &fwBundle);
-        bundle_start(fwBundle);
+	if (rc == 0) {
+		bundle_pt fwBundle = NULL;
+		if(framework_getFrameworkBundle(framework, &fwBundle) == CELIX_SUCCESS){
 
-        bundle_context_pt context = NULL;
-        bundle_getContext(fwBundle, &context);
+			if(bundle_start(fwBundle) == CELIX_SUCCESS){
 
-        struct foo *f = calloc(1, sizeof(*f));
-        struct fooSrv *fs = calloc(1, sizeof(*fs));
+				bundle_context_pt context = NULL;
+				bundle_getContext(fwBundle, &context);
 
-        fs->handle = f;
-        fs->foo = embedded_foo;
+				struct foo *f = calloc(1, sizeof(*f));
+				struct fooSrv *fs = calloc(1, sizeof(*fs));
 
-        service_registration_pt reg = NULL;
-        bundleContext_registerService(context, "foo", fs, NULL, &reg);
+				fs->handle = f;
+				fs->foo = embedded_foo;
 
-        service_reference_pt ref = NULL;
-        bundleContext_getServiceReference(context, "foo", &ref);
+				service_registration_pt reg = NULL;
 
-        void *fs2 = NULL;
-        bundleContext_getService(context, ref, &fs2);
+				if(bundleContext_registerService(context, "foo", fs, NULL, &reg) == CELIX_SUCCESS){
 
-        ((struct fooSrv*) fs2)->foo(((struct fooSrv*) fs2)->handle);
+					service_reference_pt ref = NULL;
+					if(bundleContext_getServiceReference(context, "foo", &ref) == CELIX_SUCCESS){
 
-        bundleContext_ungetServiceReference(context, ref);
-        serviceRegistration_unregister(reg);
+						void *fs2 = NULL;
+						bundleContext_getService(context, ref, &fs2);
 
-        free(f);
-        free(fs);
+						((struct fooSrv*) fs2)->foo(((struct fooSrv*) fs2)->handle);
 
-        celixLauncher_destroy(framework);
-    }
+						bundleContext_ungetService(context, ref, NULL);
+						bundleContext_ungetServiceReference(context, ref);
+						serviceRegistration_unregister(reg);
+					}
+				}
 
-    return rc;
+				free(f);
+				free(fs);
+			}
+		}
+		celixLauncher_destroy(framework);
+	}
+
+	return rc;
 
 }
 
 celix_status_t embedded_foo() {
-    printf("foo\n");
-    return CELIX_SUCCESS;
+	printf("foo\n");
+	return CELIX_SUCCESS;
 }
 
diff --git a/examples/hello_world/CMakeLists.txt b/examples/hello_world/CMakeLists.txt
index 57bbce4..0ed7ed6 100644
--- a/examples/hello_world/CMakeLists.txt
+++ b/examples/hello_world/CMakeLists.txt
@@ -15,32 +15,49 @@
 # specific language governing permissions and limitations
 # under the License.
 
+if(NOT APPLE)
+#Importing and exporting libraries not (yet) work under OSX.
+
 include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
 include_directories("public/include")
 
-
-add_bundle(hello
-    VERSION "1.2"
-    SOURCES
-        private/src/activator.c
-)
-
 add_library(hello_testlib SHARED
     private/src/test
 )
 set_library_version(hello_testlib "4.3.2") # sets target propery VERSION to 4.3.2 and SOVERSION to 4
 
+
+add_library(hello_test2lib SHARED
+        private/src/test2
+)
+set_library_version(hello_test2lib "3.3.3")
+
+add_bundle(hello
+    VERSION "1.2"
+    SOURCES
+        private/src/activator.c
+    IMPORT_LIBRARIES hello_test2lib
+)
+
+add_bundle(hello_export
+    VERSION "1.0"
+    NO_ACTIVATOR
+    EXPORT_LIBRARIES hello_test2lib
+)
+
 bundle_private_libs(hello
     hello_testlib
 )
 
 add_deploy(helloworld_byref
     GROUP hello
-    BUNDLES hello shell shell_tui
+    BUNDLES hello_export hello shell shell_tui
 )
 
 add_deploy(helloworld_withcopy
     GROUP hello
     COPY #Ensures that bundles are copied in the deploy location
-    BUNDLES hello shell shell_tui
+    BUNDLES hello_export hello shell shell_tui
 )
+
+endif()
diff --git a/examples/hello_world/private/src/activator.c b/examples/hello_world/private/src/activator.c
index 709d02b..37cf782 100644
--- a/examples/hello_world/private/src/activator.c
+++ b/examples/hello_world/private/src/activator.c
@@ -29,6 +29,7 @@
 #include "bundle_activator.h"
 
 #include "test.h"
+#include "test2.h"
 
 struct userData {
 	char * word;
@@ -50,6 +51,7 @@
 	printf("Hello %s\n", data->word);
 
 	doo();
+    bar();
 
 	return CELIX_SUCCESS;
 }
diff --git a/scr/scr/private/src/component_registry.c b/examples/hello_world/private/src/test2.c
similarity index 87%
copy from scr/scr/private/src/component_registry.c
copy to examples/hello_world/private/src/test2.c
index b09254f..9beb1bc 100644
--- a/scr/scr/private/src/component_registry.c
+++ b/examples/hello_world/private/src/test2.c
@@ -17,14 +17,16 @@
  *under the License.
  */
 /*
- * component_registry.c
+ * test.c
  *
- *  \date       Nov 15, 2012
+ *  \date       12 Feb 2014
  *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
  *  \copyright  Apache License, Version 2.0
  */
 
+#include <stdio.h>
 
-
-
-
+void bar()
+{
+    printf("Hello from (imported) third lib\n");
+}
diff --git a/scr/scr/private/src/component_registry.c b/examples/hello_world/public/include/test2.h
similarity index 88%
rename from scr/scr/private/src/component_registry.c
rename to examples/hello_world/public/include/test2.h
index b09254f..bff9048 100644
--- a/scr/scr/private/src/component_registry.c
+++ b/examples/hello_world/public/include/test2.h
@@ -17,14 +17,18 @@
  *under the License.
  */
 /*
- * component_registry.c
+ * test.h
  *
- *  \date       Nov 15, 2012
+ *  \date       12 Feb 2014
  *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
  *  \copyright  Apache License, Version 2.0
  */
 
+#ifndef TEST2_H_
+#define TEST2_H_
 
 
+void bar(void);
 
 
+#endif /* TEST2_H_ */
diff --git a/examples/hello_world_test/private/src/activator.c b/examples/hello_world_test/private/src/activator.c
index 8bf9501..2185e16 100644
--- a/examples/hello_world_test/private/src/activator.c
+++ b/examples/hello_world_test/private/src/activator.c
@@ -1,4 +1,4 @@
-#include <sys/cdefs.h>/**
+/**
  *Licensed to the Apache Software Foundation (ASF) under one
  *or more contributor license agreements.  See the NOTICE file
  *distributed with this work for additional information
diff --git a/examples/locking/CMakeLists.txt b/examples/locking/CMakeLists.txt
deleted file mode 100644
index fee34c6..0000000
--- a/examples/locking/CMakeLists.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-	# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-include_directories(services)
-
-add_subdirectory(benchmark)
-add_subdirectory(math_provider)
-
-add_subdirectory(mutex_benchmark)
-#add_subdirectory(reference_benchmark)
-#add_subdirectory(start_stop_benchmark)
-#add_subdirectory(modified_bool_benchmark)
-
-
-#add_deploy("locking_example_reference" BUNDLES benchmark_runner reference_benchmark math_provider shell shell_tui log_service log_writer)
-add_deploy("locking_example_mutex" BUNDLES benchmark_runner mutex_benchmark math_provider shell shell_tui log_service log_writer)
-
-#add_deploy("locking_example_suspend" BUNDLES benchmark_runner start_stop_benchmark math_provider shell shell_tui log_service log_writer)
-#add_deploy("locking_example_rcu" BUNDLES benchmark_runner rcu_benchmark mutex_benchmark math_provider shell shell_tui log_service log_writer)
-
diff --git a/examples/locking/benchmark/CMakeLists.txt b/examples/locking/benchmark/CMakeLists.txt
deleted file mode 100644
index 7992c36..0000000
--- a/examples/locking/benchmark/CMakeLists.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-include_directories(private/include)
-include_directories(public/include)
-include_directories(${PROJECT_SOURCE_DIR}/framework/public/include)
-include_directories(${PROJECT_SOURCE_DIR}/utils/public/include)
-include_directories(${PROJECT_SOURCE_DIR}/shell/public/include)
-
-add_bundle(benchmark_runner
-	VERSION 0.0.1
-	SOURCES
-		private/src/benchmark_runner_activator
-)
-
-target_link_libraries(benchmark_runner celix_framework)
-
diff --git a/examples/locking/benchmark/private/src/benchmark_runner_activator.c b/examples/locking/benchmark/private/src/benchmark_runner_activator.c
deleted file mode 100644
index 99af502..0000000
--- a/examples/locking/benchmark/private/src/benchmark_runner_activator.c
+++ /dev/null
@@ -1,289 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * benchmark_activator.c
- *
- *  \date       Feb 12, 2014
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/time.h>
-
-#include <pthread.h>
-#include <string.h>
-#include <assert.h>
-
-#include "command.h"
-
-#include "bundle_activator.h"
-#include "service_tracker.h"
-
-#include "benchmark_service.h"
-#include "frequency_service.h"
-
-static celix_status_t benchmarkRunner_addingService(void * handle, service_reference_pt reference, void **service);
-static celix_status_t benchmarkRunner_addedService(void * handle, service_reference_pt reference, void * service);
-static celix_status_t benchmarkRunner_modifiedService(void * handle, service_reference_pt reference, void * service);
-static celix_status_t benchmarkRunner_removedService(void * handle, service_reference_pt reference, void * service);
-
-static void benchmarkRunner_runBenchmark(struct activator *activator, FILE *out);
-static void benchmarkRunner_printHeader(char *name, unsigned int nrOfSamples, FILE *out);
-static void benchmarkRunner_printResult(benchmark_result_t result, double updateFreq, unsigned long elapsedTime,
-                                       FILE *out);
-static void benchmarkRunner_printFooter(char *name, FILE *out);
-static celix_status_t benchmarkRunner_execute(void *handle, char * line, FILE *out, FILE *err);
-
-
-struct activator {
-	bundle_context_pt context;
-	service_tracker_customizer_pt customizer;
-	service_tracker_pt tracker;
-
-	pthread_mutex_t mutex;
-	benchmark_service_pt benchmark;
-	frequency_service_pt freqService;
-
-    command_service_pt command;
-    service_registration_pt reg;
-};
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
-	struct activator * activator = malloc(sizeof(*activator));
-	activator->context=context;
-	activator->customizer = NULL;
-	activator->tracker= NULL;
-	activator->benchmark = NULL;
-	activator->freqService = NULL;
-
-	*userData = activator;
-
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
-	celix_status_t status = CELIX_SUCCESS;
-	struct activator * activator = userData;
-
-	pthread_mutex_init(&activator->mutex, NULL);
-
-	serviceTrackerCustomizer_create(activator, benchmarkRunner_addingService, benchmarkRunner_addedService, benchmarkRunner_modifiedService, benchmarkRunner_removedService, &activator->customizer);
-
-	char filter[128];
-	sprintf(filter, "(|(%s=%s)(%s=%s))", "objectClass", BENCHMARK_SERVICE_NAME, "objectClass", FREQUENCY_SERVICE_NAME);
-	serviceTracker_createWithFilter(context, filter, activator->customizer, &activator->tracker);
-	serviceTracker_open(activator->tracker);
-
-
-    activator->reg = NULL;
-    activator->command = calloc(1, sizeof(*activator->command));
-    activator->command->handle = activator;
-    activator->command->executeCommand = benchmarkRunner_execute;
-    properties_pt props = properties_create();
-    properties_set(props, OSGI_SHELL_COMMAND_NAME, "benchmark");
-    properties_set(props, OSGI_SHELL_COMMAND_USAGE, "benchmark run");
-    properties_set(props, OSGI_SHELL_COMMAND_DESCRIPTION, "run the available benchmark");
-
-    bundleContext_registerService(context, (char *)OSGI_SHELL_COMMAND_SERVICE_NAME, activator->command, props, &activator->reg);
-
-	return status;
-}
-
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context __attribute__((unused))) {
-	struct activator * activator = userData;
-
-	serviceTracker_close(activator->tracker);
-
-    serviceRegistration_unregister(activator->reg);
-
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context __attribute__((unused))) {
-	struct activator * activator = userData;
-    free(activator);
-	return CELIX_SUCCESS;
-}
-
-static celix_status_t benchmarkRunner_addingService(void * handle, service_reference_pt reference, void **service) {
-	celix_status_t status;
-	struct activator * activator = handle;
-	status = bundleContext_getService(activator->context, reference, service);
-	return status;
-
-}
-static celix_status_t benchmarkRunner_addedService(void * handle, service_reference_pt reference, void * service) {
-	celix_status_t status = CELIX_SUCCESS;
-	struct activator * activator = handle;
-
-	service_registration_pt registration = NULL;
-	properties_pt properties = NULL;
-	char *serviceName = NULL;
-	serviceReference_getServiceRegistration(reference, &registration);
-	serviceRegistration_getProperties(registration, &properties);
-	serviceName = properties_get(properties, "objectClass");
-	if (strcmp(serviceName, BENCHMARK_SERVICE_NAME) == 0) {
-		pthread_mutex_lock(&activator->mutex);
-		activator->benchmark = service;
-		pthread_mutex_unlock(&activator->mutex);
-	} else if (strcmp(serviceName, FREQUENCY_SERVICE_NAME) == 0 ) {
-		pthread_mutex_lock(&activator->mutex);
-		activator->freqService = service;
-		pthread_mutex_unlock(&activator->mutex);
-	}
-
-	return status;
-}
-static celix_status_t benchmarkRunner_modifiedService(void * handle __attribute__((unused)), service_reference_pt reference __attribute__((unused)), void * service __attribute__((unused))) {
-	celix_status_t status = CELIX_SUCCESS;
-	//ignore
-	return status;
-}
-
-static celix_status_t benchmarkRunner_removedService(void * handle, service_reference_pt reference, void * service) {
-	celix_status_t status = CELIX_SUCCESS;
-	struct activator * activator = handle;
-
-	service_registration_pt registration = NULL;
-		properties_pt properties = NULL;
-		char *serviceName = NULL;
-		serviceReference_getServiceRegistration(reference, &registration);
-		serviceRegistration_getProperties(registration, &properties);
-		serviceName = properties_get(properties, "objectClass");
-		if (strcmp(serviceName, BENCHMARK_SERVICE_NAME) == 0) {
-			pthread_mutex_lock(&activator->mutex);
-			if (activator->benchmark == service) {
-				activator->benchmark = NULL;
-			}
-			pthread_mutex_unlock(&activator->mutex);
-		} else if (strcmp(serviceName, FREQUENCY_SERVICE_NAME) == 0 ) {
-			pthread_mutex_lock(&activator->mutex);
-			if (activator->freqService == service) {
-				activator->freqService = NULL;
-			}
-			pthread_mutex_unlock(&activator->mutex);
-		}
-
-	return status;
-}
-
-static void benchmarkRunner_runBenchmark(struct activator *activator, FILE *out) {
-	int k;
-	double updateFrequency;
-    double measuredFrequency = 0.0;
-	unsigned int measuredUpdateCounter, nrOfUpdateThreads;
-	int nrOfSamples;
-	benchmark_service_pt benchmarkServ;
-	char *name;
-	benchmark_result_t result;
-	struct timeval begin,end;
-	unsigned long elapsedTime;
-	double sampleFactor;
-
-
-	int nrOfThreadRuns = 12;
-	int threads[] = {1,2,3,4,5,6,7,8,16,32,64,128};
-
-	nrOfSamples = 100 * 1000;
-	updateFrequency = 1000;
-	nrOfUpdateThreads = 100;
-
-	pthread_mutex_lock(&activator->mutex);
-	if (activator->freqService != NULL) {
-		activator->freqService->setFrequency(activator->freqService->handle, updateFrequency);
-		activator->freqService->setNrOfThreads(activator->freqService->handle, nrOfUpdateThreads);
-	}
-
-	benchmarkServ = activator->benchmark;
-	name = benchmarkServ->name(benchmarkServ->handler);
-	sampleFactor = benchmarkServ->getSampleFactor(benchmarkServ->handler);
-	activator->freqService->setBenchmarkName(activator->freqService->handle, name);
-	usleep(1000);
-    benchmarkRunner_printHeader(name, nrOfSamples * (int)sampleFactor, out);
-	for (k = 0 ; k < nrOfThreadRuns ; k +=1) {
-		if (activator->freqService != NULL) {
-				activator->freqService->resetCounter(activator->freqService->handle);
-
-		}
-		gettimeofday(&begin, NULL);
-		result = benchmarkServ->run(benchmarkServ->handler, threads[k], nrOfSamples * sampleFactor);
-		gettimeofday(&end, NULL);
-		elapsedTime = ((end.tv_sec - begin.tv_sec) * 1000000) + (end.tv_usec - begin.tv_usec);
-		if (activator->freqService != NULL) {
-			measuredUpdateCounter = activator->freqService->getCounter(activator->freqService->handle);
-			measuredFrequency = ((double)(measuredUpdateCounter) / elapsedTime * 1000000);
-		}
-        benchmarkRunner_printResult(result, measuredFrequency, elapsedTime, out);
-	}
-    benchmarkRunner_printFooter(name, out);
-
-	pthread_mutex_unlock(&activator->mutex);
-}
-
-static void benchmarkRunner_printHeader(char *name, unsigned int nrOfSamples, FILE *out) {
-		fprintf(out, "---%35s---------------------------------------------------------------------------------------\n", name);
-		fprintf(out, "-------samples: %10i---------------------------------------------------------------------------------------------------\n", nrOfSamples);
-}
-
-static void benchmarkRunner_printResult(benchmark_result_t result, double updateFreq, unsigned long elapsedTime,
-                                       FILE *out) {
-	fprintf(out, "| threads %5i | ", result.nrOfThreads);
-	fprintf(out, "average call time: %10.2f nanoseconds | ", result.averageCallTimeInNanoseconds);
-	fprintf(out, "frequency calls is %10.5f MHz | ", result.callFrequencyInMhz);
-	fprintf(out, "update freq ~ %8.2f Hz | ", updateFreq);
-	fprintf(out, "elapsed time is %8.5f seconds | ", ((double)elapsedTime) / 1000000);
-    if (result.skips > 0 ) {
-        fprintf(out, "Warning skipped %i calls", result.skips);
-    }
-	fprintf(out, "\n");
-}
-
-static void benchmarkRunner_printFooter(char *name __attribute__((unused)), FILE *out) {
-	fprintf(out, "-----------------------------------------------------------------------------------------------------------------------------\n\n\n");
-}
-
-static celix_status_t benchmarkRunner_execute(void *handle, char * line, FILE *out, FILE *err) {
-    struct activator * activator = handle;
-    char *savePtr;
-    char *token = NULL;
-    token = strtok_r(line, " ", &savePtr); //command name
-    assert(strcmp(token, "benchmark") == 0);
-    token = strtok_r(NULL, " ", &savePtr); //sub command
-    if (strcmp("run", token) == 0) {
-        token = strtok_r(NULL, " ", &savePtr); //possible nr of time to run
-        int times = 1;
-        int i;
-        if (token != NULL) {
-            times = atoi(token);
-        }
-        for (i = 0; i < times; i += 1) {
-            fprintf(out, "running benchmark %i of %i\n", i+1, times);
-            benchmarkRunner_runBenchmark(activator, out);
-        }
-    } else {
-        fprintf(err, "Unknown subcommand '%s'\n", token);
-    }
-
-    return CELIX_SUCCESS;
-}
diff --git a/examples/locking/benchmark/public/include/benchmark.h b/examples/locking/benchmark/public/include/benchmark.h
deleted file mode 100644
index 788444d..0000000
--- a/examples/locking/benchmark/public/include/benchmark.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-
-#ifndef CONSUMER_H_
-#define CONSUMER_H_
-
-#include "celix_errno.h"
-
-#include "benchmark_result.h"
-#include "math_service.h"
-
-typedef struct benchmark *benchmark_pt; //ADT
-
-celix_status_t benchmark_create(benchmark_pt *benchmark);
-celix_status_t benchmark_destroy(benchmark_pt benchmark);
-
-benchmark_result_t benchmark_run(benchmark_pt benchmark, int nrOfThreads, int nrOfSamples);
-char * benchmark_getName(benchmark_pt benchmark);
-double benchmark_getSampleFactor(benchmark_pt benchmark);
-
-celix_status_t benchmark_addMathService(benchmark_pt benchmark, math_service_pt mathService);
-celix_status_t benchmark_removeMathService(benchmark_pt benchmark, math_service_pt mathService);
-
-
-#endif /* CONSUMER_H_ */
diff --git a/examples/locking/benchmark/public/include/benchmark_result.h b/examples/locking/benchmark/public/include/benchmark_result.h
deleted file mode 100644
index 636b9d1..0000000
--- a/examples/locking/benchmark/public/include/benchmark_result.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-
-#ifndef BENCHMARK_RESULT_H_
-#define BENCHMARK_RESULT_H_
-
-typedef struct benchmark_result {
-		unsigned int nrOfThreads;
-		unsigned int nrOfsamples;
-		unsigned int requestedNrOfSamples;
-		unsigned int result;
-		unsigned int skips;
-		double averageCallTimeInNanoseconds;
-		double callFrequencyInMhz;
-} benchmark_result_t;
-
-#endif /* BENCHMARK_RESULT_H_ */
diff --git a/examples/locking/benchmark/public/src/benchmark_activator.c b/examples/locking/benchmark/public/src/benchmark_activator.c
deleted file mode 100644
index ffd9621..0000000
--- a/examples/locking/benchmark/public/src/benchmark_activator.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * echo_server_activator.c
- *
- *  \date       Sep 21, 2010
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include <unistd.h>
-
-#include "bundle_activator.h"
-#include "bundle_context.h"
-#include "service_registration.h"
-#include "service_tracker.h"
-
-#include "math_service.h"
-#include "benchmark.h"
-#include "benchmark_service.h"
-#include "frequency_service.h"
-
-static celix_status_t addedService(void * handle, service_reference_pt reference, void * service);
-static celix_status_t removedService(void * handle, service_reference_pt reference, void * service);
-
-struct activator {
-	bundle_context_pt context;
-	benchmark_pt benchmark;
-	benchmark_service_pt mathService;
-	service_tracker_customizer_pt customizer;
-	service_tracker_pt tracker;
-	service_registration_pt registration;
-};
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
-	struct activator * activator = malloc(sizeof(*activator));
-	activator->context=context;
-	activator->benchmark=NULL;
-	activator->mathService = NULL;
-	activator->customizer = NULL;
-	activator->tracker=NULL;
-	activator->registration = NULL;
-
-	*userData = activator;
-
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
-	celix_status_t status = CELIX_SUCCESS;
-	struct activator * activator = userData;
-
-	status = benchmark_create(&activator->benchmark);
-	serviceTrackerCustomizer_create(activator, NULL, addedService, NULL, removedService, &activator->customizer);
-
-	char filter[128];
-	sprintf(filter, "(&(objectClass=%s)(benchmark=%s))", MATH_SERVICE_NAME, benchmark_getName(activator->benchmark));
-
-	serviceTracker_createWithFilter(context, filter, activator->customizer, &activator->tracker);
-	serviceTracker_open(activator->tracker);
-
-	activator->mathService = malloc(sizeof(*activator->mathService));
-	activator->mathService->handler = (void *)activator->benchmark;
-	activator->mathService->name=(void *)benchmark_getName;
-	activator->mathService->getSampleFactor=(void *)benchmark_getSampleFactor;
-	activator->mathService->run=(void *)benchmark_run;
-
-	status = bundleContext_registerService(activator->context, BENCHMARK_SERVICE_NAME, activator->mathService, NULL, &activator->registration);
-
-	return status;
-}
-
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
-	struct activator * activator = userData;
-
-	serviceTracker_close(activator->tracker);
-
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
-	struct activator * activator = userData;
-
-	benchmark_destroy(activator->benchmark);
-	activator->benchmark=NULL;
-
-	return CELIX_SUCCESS;
-}
-
-static celix_status_t addedService(void * handle, service_reference_pt reference, void * service) {
-	celix_status_t status = CELIX_SUCCESS;
-	struct activator * activator = handle;
-	benchmark_addMathService(activator->benchmark, service);
-	return status;
-}
-
-static celix_status_t removedService(void * handle, service_reference_pt reference, void * service) {
-	celix_status_t status = CELIX_SUCCESS;
-	struct activator * activator = handle;
-	benchmark_removeMathService(activator->benchmark, service);
-	return status;
-}
diff --git a/examples/locking/consumer.c b/examples/locking/consumer.c
deleted file mode 100644
index b73549e..0000000
--- a/examples/locking/consumer.c
+++ /dev/null
@@ -1,372 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * consumer.c
- *
- *  \date       Feb 3, 2014
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-#include "consumer.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdbool.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <pthread.h>
-
-#include <urcu.h>
-
-#include "math_service.h"
-#include "frequency_service.h"
-
-#define FREELIST_LENGTH 16
-
-typedef union service_counter service_counter_t;
-
-union service_counter {
-	volatile struct {
-		volatile u_int32_t counter; //TODO FIXME assuming little endian!!
-		volatile u_int32_t position;
-		math_service_pt math; // not accesible by raw
-	} info; //TODO rename data
-	volatile u_int64_t data; //TODO rename raw
-};
-
-struct consumer {
-	math_service_pt math;
-	frequency_service_pt frequencyService;
-	locking_type_t currentLockingType;
-	pthread_mutex_t mutex;
-	pthread_rwlock_t rw_lock;
-	service_counter_t *counters[FREELIST_LENGTH];
-	service_counter_t *current;
-};
-
-typedef struct run_info {
-	consumer_pt consumer;
-	volatile locking_type_t type;
-	int nrOfsamples;
-	int result;
-	uint skips;
-	uint updateCounter;
-	struct timeval begin;
-	struct timeval end;
-} run_info_t;
-
-static void * consumer_reference_run(run_info_t *info);
-static void * consumer_no_locking_run(run_info_t *info);
-static void * consumer_mutex_run(run_info_t *info);
-static void * consumer_rcu_run(run_info_t *info);
-static void * consumer_reference_counting_run(run_info_t *info);
-static void * consumer_rw_lock_run(run_info_t *info);
-
-static int consumer_reference_calc(int arg1, int arg2);
-
-celix_status_t consumer_create(consumer_pt *result) {
-	consumer_pt consumer = malloc(sizeof(*consumer));
-	consumer->math = NULL;
-	consumer->frequencyService = NULL;
-	consumer->currentLockingType=LOCKING_TYPE_NO_LOCKING;
-
-
-	service_counter_t *new = malloc(sizeof(service_counter_t));
-	new->info.position = 0;
-	new->info.counter = 0;
-	new->info.math = NULL;
-
-	int i;
-	for (i = 0; i < FREELIST_LENGTH; i+=1) {
-		consumer->counters[i] = NULL;
-	}
-	consumer->current = new;
-	consumer->counters[0] = new;
-
-	pthread_mutex_init(&consumer->mutex, NULL);
-	pthread_rwlock_init(&consumer->rw_lock, NULL);
-
-	rcu_init();
-
-	(*result) = consumer;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t consumer_destroy(consumer_pt consumer) {
-	pthread_mutex_destroy(&consumer->mutex);
-	pthread_rwlock_destroy(&consumer->rw_lock);
-	free(consumer);
-	return CELIX_SUCCESS;
-}
-
-void consumer_setFrequencyService(consumer_pt consumer, frequency_service_pt freqServ) {
-	consumer->frequencyService=freqServ;
-}
-
-void consumer_runBenchmark(consumer_pt consumer, locking_type_t type, int nrOfThreads, int nrOfSamples) {
-	pthread_t threads[nrOfThreads];
-	run_info_t info[nrOfThreads];
-	int elapsedTime, skips, counter;
-	double callTime, callFreq, updateFreq;
-	int i;
-
-	consumer->currentLockingType=type;
-	usleep(1000);
-
-	//init
-	for (i = 0; i< nrOfThreads; i += 1) {
-		info[i].consumer = consumer;
-		info[i].nrOfsamples=nrOfSamples;
-		info[i].result = rand();
-		info[i].skips = 0;
-		info[i].updateCounter = 0;
-	}
-	elapsedTime = 0;
-	skips = 0;
-
-	//start threads
-	info->consumer->frequencyService->resetCounter(info->consumer->frequencyService->handler);
-	for (i = 0; i < nrOfThreads; i += 1) {
-		if (type == LOCKING_TYPE_NO_LOCKING) {
-			pthread_create(&threads[i], NULL, (void *)consumer_no_locking_run, &info[i]);
-		} else if (type == LOCKING_TYPE_MUTEX) {
-			pthread_create(&threads[i], NULL, (void *)consumer_mutex_run, &info[i]);
-		} else if (type == LOCKING_TYPE_REFERENCE) {
-			pthread_create(&threads[i], NULL, (void *)consumer_reference_run, &info[i]);
-		} else if (type == LOCKING_TYPE_RCU) {
-			pthread_create(&threads[i], NULL, (void *)consumer_rcu_run, &info[i]);
-		} else if (type == LOCKING_TYPE_REFERENCE_COUNTER) {
-			pthread_create(&threads[i], NULL, (void *)consumer_reference_counting_run, &info[i]);
-		} else if (type == LOCKING_TYPE_RW_LOCK) {
-			pthread_create(&threads[i], NULL, (void *)consumer_rw_lock_run, &info[i]);
-		} else {
-			printf ("unknown type\n");
-			return;
-		}
-	}
-
-	//join and print result
-
-	for (i = 0; i < nrOfThreads; i +=1 ) {
-		pthread_join(threads[i], NULL);
-		elapsedTime += ((info[i].end.tv_sec - info[i].begin.tv_sec) * 1000000) + (info[i].end.tv_usec - info[i].begin.tv_usec);
-		skips += info[i].skips;
-		counter += info[i].updateCounter;
-	}
-	counter = info->consumer->frequencyService->getCounter(info->consumer->frequencyService->handler);
-	callTime = ((double)elapsedTime * 1000) / (nrOfSamples * nrOfThreads);
-	callFreq = ((double)(nrOfSamples * nrOfThreads) / elapsedTime);
-	updateFreq = ((double)counter * 1000000) / elapsedTime;
-	printf("| threads %5i | ", nrOfThreads);
-	printf("average call time: % 10.2f nanoseconds | ", callTime);
-	printf("frequency calls is % 10.5f MHz | ", callFreq);
-	printf("update freq ~ % 8.2f Hz | ", updateFreq);
-	printf("\n");
-
-	if (skips > 0) {
-		printf("WARNING skips is %i\n", skips);
-	}
-}
-
-celix_status_t consumer_addMathService(consumer_pt consumer, math_service_pt mathService) {
-	if (consumer->currentLockingType == LOCKING_TYPE_MUTEX) {
-		pthread_mutex_lock(&consumer->mutex);
-		consumer->math = mathService;
-		pthread_mutex_unlock(&consumer->mutex);
-	} else if (consumer->currentLockingType == LOCKING_TYPE_RCU) {
-		consumer->math = mathService;
-		synchronize_rcu();
-	} else if (consumer->currentLockingType == LOCKING_TYPE_RW_LOCK) {
-		pthread_rwlock_wrlock(&consumer->rw_lock);
-		consumer->math = mathService;
-		pthread_rwlock_unlock(&consumer->rw_lock);
-	} else { //no locking
-		consumer->math = mathService;
-	}
-
-	//always update for reference counter
-//	service_counter_t *new = malloc(sizeof(service_counter_t));
-//	new->info.position = 0;
-//	new->info.counter = 0;
-//	new->info.math = mathService;
-//	int found = false;
-//	int pos;
-//	for (pos = 0; !found && pos < FREELIST_LENGTH; pos += 1) {
-//		found = __sync_bool_compare_and_swap(&(consumer->counters[pos]), NULL, new);
-//		if (found) {
-//			new->info.position = pos;
-//			break;
-//		}
-//	}
-//
-//	if (!found) {
-//		printf("Cannot find free spot!!!!, will use 0\n");
-//		consumer->counters[0] = new;
-//	}
-//
-//	int changed = false;
-//	service_counter_t *old;
-//	while (!changed) {
-//		old = consumer->current;
-//		changed = __sync_bool_compare_and_swap(&consumer->current, old, new);
-//	}
-//
-//	while (old->info.counter != 0) {usleep(10);}
-//	consumer->counters[old->info.position] = NULL;
-//	free(old);
-
-	return CELIX_SUCCESS;
-}
-
-celix_status_t consumer_removeMathService(consumer_pt consumer, math_service_pt mathService) {
-	if (consumer->currentLockingType == LOCKING_TYPE_NO_LOCKING) {
-		__sync_val_compare_and_swap(&consumer->math, mathService, NULL);
-	} else if (consumer->currentLockingType == LOCKING_TYPE_MUTEX) {
-		pthread_mutex_lock(&consumer->mutex);
-		if (consumer->math == mathService) {
-			consumer->math = NULL;
-		}
-		pthread_mutex_unlock(&consumer->mutex);
-	} else if (consumer->currentLockingType == LOCKING_TYPE_RCU) {
-		uatomic_cmpxchg(&consumer->math, mathService, NULL);
-	} else if (consumer->currentLockingType == LOCKING_TYPE_REFERENCE_COUNTER) {
-		//TODO DONT KNOWN IGNORE FOR NOW
-	}
-	return CELIX_SUCCESS;
-}
-
-static void * consumer_reference_run(run_info_t *info) {
-	int i;
-
-	gettimeofday(&info->begin, NULL);
-	for (i = 0; i < info->nrOfsamples; i += 1) {
-		info->result = consumer_reference_calc(info->result, i);
-	}
-	gettimeofday(&info->end, NULL);
-	return NULL;
-}
-
-static void * consumer_no_locking_run(run_info_t *info) {
-	int i;
-
-	gettimeofday(&info->begin, NULL);
-	for (i = 0; i < info->nrOfsamples; i += 1) {
-		if (info->consumer->math != NULL) {
-				info->result = info->consumer->math->calc(info->result, i);
-		} else {
-				info->skips +=1; //should not happen
-		}
-	}
-	gettimeofday(&info->end, NULL);
-	return NULL;
-}
-
-static void * consumer_mutex_run(run_info_t *info) {
-	int i;
-
-	gettimeofday(&info->begin, NULL);
-	for (i = 0; i < info->nrOfsamples; i += 1) {
-		pthread_mutex_lock(&info->consumer->mutex);
-		if (info->consumer->math != NULL) {
-			info->result = info->consumer->math->calc(info->result, i);
-		} else {
-			info->skips += 1; //should not happen
-		}
-		pthread_mutex_unlock(&info->consumer->mutex);
-	}
-	gettimeofday(&info->end, NULL);
-	return NULL;
-}
-
-static void * consumer_rw_lock_run(run_info_t *info) {
-	int i;
-	consumer_pt cons = info->consumer;
-	int result = info->result;
-	pthread_rwlock_t *lock = &cons->rw_lock;
-	int nrOfsamples = info->nrOfsamples;
-
-	gettimeofday(&info->begin, NULL);
-	for (i = 0; i < nrOfsamples; i += 1) {
-		pthread_rwlock_rdlock(lock);
-		if (cons->math != NULL) {
-			result = cons->math->calc(result, i);
-		} else {
-			info->skips += 1; //should not happen
-		}
-		pthread_rwlock_unlock(lock);
-	}
-	gettimeofday(&info->end, NULL);
-	info->result = result;
-	return NULL;
-}
-
-static void * consumer_rcu_run(run_info_t *info) {
-	rcu_register_thread();
-	int i;
-	math_service_pt service;
-
-	gettimeofday(&info->begin, NULL);
-	for (i = 0; i < info->nrOfsamples; i += 1) {
-		rcu_read_lock();
-		if (info->consumer->math != NULL) {
-			info->result = info->consumer->math->calc(info->result, i);
-		} else {
-			info->skips +=1; //should not happen
-		}
-		rcu_read_unlock();
-	}
-	gettimeofday(&info->end, NULL);
-	rcu_unregister_thread();
-	return NULL;
-}
-
-static void * consumer_reference_counting_run(run_info_t *info) {
-	int i;
-	service_counter_t posAndCount;
-
-	gettimeofday(&info->begin, NULL);
-	for (i = 0; i < info->nrOfsamples; i += 1) {
-		posAndCount.data = __sync_add_and_fetch((u_int64_t *)&info->consumer->current->data, 1);
-		volatile service_counter_t *serv = (volatile void *)info->consumer->counters[posAndCount.info.position];
-		if (serv->info.math != NULL) {
-			info->result = serv->info.math->calc(info->result, i);
-		} else {
-			info->skips += 1;
-		}
-		__sync_sub_and_fetch((u_int64_t *)&serv->data, -1);
-
-		//not service_counter will not be deleted...but can we still find it??? is info->consumer->serviceCounter still te same?
-		//change write to swap compare and then only changing the pointer is the counter is null?? not possible.. can compare counter , but not change pointer
-
-		//IDEA create a list with service_counter based on a id (number) this number is 32bit long and put a counter + id in a 64bit value.
-		//use this value to atomic increment and return value and use the id to retrieve the actual pointer. the value can be stored in the heap.
-		//A list with id is used to retrieve a pointer to the service. If the value is null the slot is available this can be check with
-		//compare_and_swap while looping through the list. The list can be extended when the end is reached and then a next list pointer can
-		//be used. This can also be a linked list and the limitation is the max 32bit uint value (of 16bits for 32bit platforms).
-	}
-
-	gettimeofday(&info->end, NULL);
-	return NULL;
-}
-
-//NOTE: copy implementation of the math_service->calc function, for reference.
-static int consumer_reference_calc(int arg1, int arg2) {
-	return  arg1 * arg2 + arg2;
-}
diff --git a/examples/locking/math_provider/CMakeLists.txt b/examples/locking/math_provider/CMakeLists.txt
deleted file mode 100644
index de83d7e..0000000
--- a/examples/locking/math_provider/CMakeLists.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-include_directories(public/include)
-include_directories(../benchmark/public/include)
-include_directories("${PROJECT_SOURCE_DIR}/framework/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/shell/public/include")
-include_directories(private/include)
-
-add_bundle(math_provider
-	VERSION 0.0.1
-	SOURCES
-		private/src/provider_activator
-		private/src/math_component
-)
-
-target_link_libraries(math_provider celix_framework)
diff --git a/examples/locking/math_provider/private/include/math_component.h b/examples/locking/math_provider/private/include/math_component.h
deleted file mode 100644
index b2b1510..0000000
--- a/examples/locking/math_provider/private/include/math_component.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-#ifndef MATH_COMPONENT_H_
-#define MATH_COMPONENT_H_
-
-#include "celix_errno.h"
-
-typedef struct math_component *math_component_pt;
-
-celix_status_t mathComponent_create(math_component_pt *math);
-celix_status_t mathComponent_destroy(math_component_pt math);
-
-int mathComponent_calc(math_component_pt math, int arg1, int arg2);
-
-
-#endif /* MATH_COMPONENT_H_ */
diff --git a/examples/locking/math_provider/private/src/math_component.c b/examples/locking/math_provider/private/src/math_component.c
deleted file mode 100644
index bc83c8e..0000000
--- a/examples/locking/math_provider/private/src/math_component.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-
-#include <stdlib.h>
-#include "math_component.h"
-
-struct math_component {
-	//emtpy
-};
-
-celix_status_t mathComponent_create(math_component_pt *math) {
-	(*math) = calloc(1, sizeof(struct math_component));
-	return CELIX_SUCCESS;
-}
-
-celix_status_t mathComponent_destroy(math_component_pt math) {
-	free(math);
-	return CELIX_SUCCESS;
-}
-
-int mathComponent_calc(math_component_pt math __attribute__((unused)), int arg1, int arg2) {
-	return arg1 * arg2 + arg2;
-}
-
-
diff --git a/examples/locking/math_provider/private/src/provider_activator.c b/examples/locking/math_provider/private/src/provider_activator.c
deleted file mode 100644
index 58069d0..0000000
--- a/examples/locking/math_provider/private/src/provider_activator.c
+++ /dev/null
@@ -1,228 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * echo_server_activator.c
- *
- *  \date       Sep 21, 2010
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <pthread.h>
-#include <signal.h>
-
-
-
-#include "bundle_activator.h"
-
-#include "math_service.h"
-#include "frequency_service.h"
-#include "math_component.h"
-
-typedef struct activator {
-	bundle_context_pt context;
-	bool isRunning;
-
-	frequency_service_pt freqService;
-	service_registration_pt freqRegistration;
-
-	math_component_pt math;
-	math_service_pt mathService;
-	char *benchmarkName;
-	service_registration_pt registration;
-
-	double updateFrequency;
-	unsigned int nrOfThreads;
-	pthread_t *threads;
-
-
-	unsigned int counter;
-} activator_t;
-
-static int calc(int arg1, int arg2)  __attribute__((unused));
-static void* run(void *data);
-static void setFrequency(activator_t *activator, double freq);
-static void setNrOfThreads(activator_t *activator, unsigned int nrOfThreads);
-static void resetCounter(activator_t *activator);
-static void stopThreads(activator_t *activator);
-static void startThreads(activator_t *activator, unsigned int nrOfThreads);
-static unsigned int getCounter(activator_t *activator);
-static void setBenchmarkName(activator_t *activator, char *benchmark);
-static math_service_pt registerMath(activator_t *activator, service_registration_pt *reg);
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
-	activator_t * activator = malloc(sizeof(*activator));
-	activator->context = context;
-	activator->benchmarkName = NULL;
-	activator->freqService  = NULL;
-	activator->registration = NULL;
-	activator->freqRegistration  = NULL;
-	activator->updateFrequency = 0;
-	activator->nrOfThreads = 0;
-	activator->math = NULL;
-
-	mathComponent_create(&activator->math);
-
-	*userData = activator;
-
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context __attribute__((unused))) {
-	celix_status_t status = CELIX_SUCCESS;
-	struct activator * activator = userData;
-
-    activator->isRunning = true;
-	activator->mathService = malloc(sizeof(*activator->mathService));
-	activator->mathService->handle = activator->math;
-	activator->mathService->calc = (void *)mathComponent_calc;
-	bundleContext_registerService(activator->context, MATH_SERVICE_NAME, activator->mathService, NULL, &activator->registration);
-
-	activator->freqService = malloc(sizeof(*activator->freqService));
-	activator->freqService->handle = (void *)activator;
-	activator->freqService->setFrequency = (void *)setFrequency;
-	activator->freqService->resetCounter = (void *)resetCounter;
-	activator->freqService->getCounter = (void *)getCounter;
-	activator->freqService->setBenchmarkName = (void *)setBenchmarkName;
-	activator->freqService->setNrOfThreads = (void *)setNrOfThreads;
-	bundleContext_registerService(activator->context, FREQUENCY_SERVICE_NAME, activator->freqService, NULL, &activator->freqRegistration);
-
-	startThreads(activator, activator->nrOfThreads);
-
-	return status;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context __attribute__((unused))) {
-	struct activator * activator = userData;
-
-	printf("Stopping service registration thread\n");
-	stopThreads(activator);
-
-	//TODO deregister service & freqService
-
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context __attribute__((unused))) {
-	struct echoActivator * activator = userData;
-
-	//TODO free service & freqService struct
-
-	free(activator);
-
-	return CELIX_SUCCESS;
-}
-
-static int calc(int arg1, int arg2) {
-	return  arg1 * arg2 + arg2;
-}
-
-static void stopThreads(activator_t *activator) {
-	//cancel and join threads
-    activator->isRunning = false;
-	if (activator->threads != NULL) {
-		for (int i = 0 ; i < activator->nrOfThreads ; i += 1) {
-            pthread_kill(activator->threads[i], SIGUSR1);
-			pthread_join(activator->threads[i], NULL);
-		}
-	}
-}
-
-static void startThreads(activator_t *activator, unsigned int nrOfThreads) {
-    activator->isRunning = true;
-	activator->threads = malloc(sizeof(pthread_t) * nrOfThreads);
-	for (int i = 0 ; i < nrOfThreads ; i += 1) {
-		pthread_create(&activator->threads[i], NULL, (void *)run, activator);
-	}
-	activator->nrOfThreads = nrOfThreads;
-}
-
-static void* run(void *data) {
-	activator_t *activator = data;
-
-	service_registration_pt currentReg = NULL;
-	service_registration_pt prevReg = NULL;
-	math_service_pt current = NULL;
-	math_service_pt prev = NULL;
-
-	while (activator->isRunning) {
- 		unsigned int delayInMicroseconds =  activator->updateFrequency == 0 ? 0 : (1000 * 1000) / activator->updateFrequency;
-		if (delayInMicroseconds > 0) {
-			prevReg = currentReg;
-			prev = current;
-
-			currentReg = NULL;
-			current = registerMath(activator, &currentReg);
-
-			if (prevReg != NULL) {
-				serviceRegistration_unregister(prevReg);
-				free(prev);
-			}
-		}
-		usleep(delayInMicroseconds > 0 ? delayInMicroseconds : 1000000);
-	}
-
-    return NULL;
-}
-
-static math_service_pt registerMath(activator_t *activator, service_registration_pt *reg) {
-	math_service_pt serv = NULL;
-	serv = malloc(sizeof(*activator->mathService));
-	serv->handle = activator->math;
-	serv->calc = (void *)mathComponent_calc;
-	properties_pt props = properties_create();
-	if (activator->benchmarkName != NULL) { //TODO FIXME race condition
-		properties_set(props, "benchmark", activator->benchmarkName);
-	}
-	bundleContext_registerService(activator->context, MATH_SERVICE_NAME,
-			serv, props, reg);
-	activator->counter += 1;
-	return serv;
-}
-
-static void setBenchmarkName(activator_t *activator, char *benchmark) {
-	char *old = activator->benchmarkName;
-	activator->benchmarkName = strdup(benchmark);
-	free(old);
-	if (activator->updateFrequency == 0) {
-		service_registration_pt reg = NULL;
-		registerMath(activator, &reg); //TODO service will not be cleaned up !
-	}
-}
-
-static void setFrequency(activator_t *activator, double freq) {
-	printf("Setting frequency to %f\n", freq);
-	activator->updateFrequency = freq;
-}
-
-static void setNrOfThreads(activator_t *activator, unsigned int nrOfThreads) {
-    printf("Setting nr of update Threads to %d\n", nrOfThreads);
-    stopThreads(activator);
-	startThreads(activator, nrOfThreads);
-}
-
-static void resetCounter(activator_t *activator) {
-	activator->counter = 0;
-}
-
-static unsigned int getCounter(activator_t *activator) {
-	return activator->counter;
-}
diff --git a/examples/locking/modified_bool_benchmark/CMakeLists.txt b/examples/locking/modified_bool_benchmark/CMakeLists.txt
deleted file mode 100644
index 4f3d002..0000000
--- a/examples/locking/modified_bool_benchmark/CMakeLists.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-add_bundle(modified_bool_benchmark SOURCES
-	../benchmark/public/src/benchmark_activator
-	private/src/modified_bool_benchmark 
-)
-
-include_directories(public/include)
-include_directories(../benchmark/public/include)
-include_directories("${PROJECT_SOURCE_DIR}/framework/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/shell/public/include")
-target_link_libraries(modified_bool_benchmark celix_framework)
-
diff --git a/examples/locking/modified_bool_benchmark/private/src/modified_bool_benchmark.c b/examples/locking/modified_bool_benchmark/private/src/modified_bool_benchmark.c
deleted file mode 100644
index cdf8815..0000000
--- a/examples/locking/modified_bool_benchmark/private/src/modified_bool_benchmark.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-#include <stdlib.h>
-#include <pthread.h>
-#include <unistd.h>
-#include <sys/time.h>
-#include <pthread.h>
-
-#include "array_list.h"
-
-#include "benchmark.h"
-#include "math_service.h"
-
-static const char * const BENCHMARK_NAME = "MODIFIED_BIT";
-static const double SAMPLE_FACTOR = 1;
-static const useconds_t SLEEP_TIME = 10;
-
-typedef struct thread_info {
-	benchmark_pt benchmark;
-	unsigned int result;
-	struct timeval begin;
-	struct timeval end;
-	int skips;
-	bool isModified;
-    bool isUpdated;
-} thread_info_t;
-
-struct benchmark {
-    pthread_mutex_t mutex;
-    math_service_pt math;
-    int nrOfSamples;
-    int nrOfThreads;
-    thread_info_t *threads;
-};
-
-static void benchmark_thread(thread_info_t *info);
-
-celix_status_t benchmark_create(benchmark_pt *benchmark) {
-	(*benchmark) = malloc(sizeof(struct benchmark));
-	(*benchmark)->math = NULL;
-	pthread_mutex_init(&(*benchmark)->mutex, NULL);
-    return CELIX_SUCCESS;
-}
-
-celix_status_t benchmark_destroy(benchmark_pt benchmark) {
-    //free threads array
-	free(benchmark);
-    return CELIX_SUCCESS;
-}
-
-benchmark_result_t benchmark_run(benchmark_pt benchmark, int nrOfThreads, int nrOfSamples) {
-	int i;
-	pthread_t threads[nrOfThreads];
-	thread_info_t infos[nrOfThreads];
-	benchmark_result_t result;
-	unsigned long elapsedTime = 0;
-
-	benchmark->threads = infos;
-	benchmark->nrOfSamples = nrOfSamples;
-    benchmark->nrOfThreads = nrOfThreads;
-
-	result.skips =0;
-    pthread_mutex_lock(&benchmark->mutex);
-	for (i = 0 ; i < nrOfThreads ; i += 1) {
-		infos[i].benchmark = benchmark;
-		infos[i].skips = 0;
-		infos[i].result = rand();
-		infos[i].isUpdated = false;
-		infos[i].isModified = false;
-		pthread_create(&threads[i], NULL, (void *)benchmark_thread,  &infos[i]);
-	}
-    pthread_mutex_unlock(&benchmark->mutex);
-
-	for (i = 0; i < nrOfThreads ; i += 1) {
-		pthread_join(threads[i], NULL);
-		elapsedTime += ((infos[i].end.tv_sec - infos[i].begin.tv_sec) * 1000000) + (infos[i].end.tv_usec - infos[i].begin.tv_usec);
-		result.skips += infos[i].skips;
-	}
-
-	result.averageCallTimeInNanoseconds = ((double)elapsedTime * 1000) / (nrOfSamples * nrOfThreads);
-	result.callFrequencyInMhz = ((double)(nrOfSamples * nrOfThreads) / elapsedTime);
-	result.nrOfThreads = nrOfThreads;
-	result.nrOfsamples = nrOfSamples;
-
-	return result;
-}
-
-static void benchmark_thread(thread_info_t *info) {
-	int i = 0;
-
-    math_service_pt local = info->benchmark->math;
-	int nrOfSamples = info->benchmark->nrOfSamples;
-	
-	gettimeofday(&info->begin, NULL);
-	while (i < nrOfSamples) {
-		if (!info->isModified) {
-            if (local != NULL) {
-                info->result = local->calc(local->handle, info->result, i);
-            } else {
-                info->skips += 1; //should not happen
-            }
-            i += 1;
-        } else {
-			local = info->benchmark->math;
-			info->isModified = false;
-		}
-	}
-	gettimeofday(&info->end, NULL);
-
-}
-
-char * benchmark_getName(benchmark_pt benchmark) {
-	return (char *)BENCHMARK_NAME;
-}
-
-celix_status_t benchmark_addMathService(benchmark_pt benchmark, math_service_pt mathService) {
-	int i;
-
-	pthread_mutex_lock(&benchmark->mutex);
-	benchmark->math = mathService;
-	pthread_mutex_unlock(&benchmark->mutex);
-
-	//inform threads to update servicd
-	for (i = 0 ; i < benchmark->nrOfSamples ; i += 1) {
-		benchmark->threads[i].isModified = true;
-	}	
-
-	//Wait till al thread are not in a modified state, e.g. update to date mathService and not using the old service
-	for (i = 0; i < benchmark->nrOfThreads ; i += 1) {
-		if (benchmark->threads[i].isModified) {
-			usleep(SLEEP_TIME);
-		}
-	}
-
-	return CELIX_SUCCESS;
-}
-
-celix_status_t benchmark_removeMathService(benchmark_pt benchmark, math_service_pt mathService) {
-	pthread_mutex_lock(&benchmark->mutex);
-	if (benchmark->math == mathService) {
-		benchmark->math = NULL;
-	} 
-	pthread_mutex_unlock(&benchmark->mutex);
-
-	//inform threads to update servicd
-    int i;
-	for (i = 0 ; i < benchmark->nrOfThreads ; i += 1) {
-		benchmark->threads[i].isModified = true;
-	}	
-
-	//Wait till al thread are not in a modified state, e.g. update to date mathService and not using the old service
-	for (i = 0; i < benchmark->nrOfThreads ; i += 1) {
-		if (benchmark->threads[i].isModified) {
-			usleep(SLEEP_TIME);
-		}
-	}
-
-	
-	return CELIX_SUCCESS;
-}
-
-double benchmark_getSampleFactor(benchmark_pt benchmark) {
-	return SAMPLE_FACTOR;
-}
diff --git a/examples/locking/mutex_benchmark/CMakeLists.txt b/examples/locking/mutex_benchmark/CMakeLists.txt
deleted file mode 100644
index 71ab71d..0000000
--- a/examples/locking/mutex_benchmark/CMakeLists.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-include_directories(public/include)
-include_directories(../benchmark/public/include)
-include_directories("${PROJECT_SOURCE_DIR}/framework/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/shell/public/include")
-
-add_bundle(mutex_benchmark
-	VERSION 0.0.1
-	SOURCES
-		../benchmark/public/src/benchmark_activator
-		private/src/mutex_benchmark
-)
-
-target_link_libraries(mutex_benchmark celix_framework)
-
diff --git a/examples/locking/mutex_benchmark/private/src/mutex_benchmark.c b/examples/locking/mutex_benchmark/private/src/mutex_benchmark.c
deleted file mode 100644
index 615b98e..0000000
--- a/examples/locking/mutex_benchmark/private/src/mutex_benchmark.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-#include <stdlib.h>
-#include <pthread.h>
-#include <sys/time.h>
-#include <stdio.h>
-#include <math.h>
-
-#include "benchmark.h"
-
-static const char * const BENCHMARK_NAME = "MUTEX";
-static const double SAMPLE_FACTOR = 1;
-
-struct benchmark {
-	pthread_mutex_t mutex;
-	math_service_pt math;
-};
-
-typedef struct thread_info {
-	benchmark_pt benchmark;
-	int nrOfSamples;
-	unsigned int result;
-	struct timeval begin;
-	struct timeval end;
-	unsigned int skips;
-} thread_info_t;
-
-static void benchmark_thread(thread_info_t *info);
-
-celix_status_t benchmark_create(benchmark_pt *benchmark) {
-	(*benchmark) = malloc(sizeof(struct benchmark));
-	(*benchmark)->math = NULL;
-	pthread_mutex_init(&(*benchmark)->mutex, NULL);
-	return CELIX_SUCCESS;
-}
-
-celix_status_t benchmark_destroy(benchmark_pt benchmark) {
-	free(benchmark);
-	return CELIX_SUCCESS;
-}
-
-benchmark_result_t benchmark_run(benchmark_pt benchmark, int nrOfThreads, int nrOfSamples) {
-	int i;
-	pthread_t threads[nrOfThreads];
-	thread_info_t infos[nrOfThreads];
-	benchmark_result_t result;
-	unsigned long elapsedTime = 0;
-
-	result.skips =0;
-
-	for (i = 0 ; i < nrOfThreads ; i += 1) {
-		infos[i].benchmark = benchmark;
-		infos[i].nrOfSamples = nrOfSamples;
-		infos[i].skips = 0;
-		infos[i].result = rand();
-		pthread_create(&threads[i], NULL, (void *)benchmark_thread,  &infos[i]);
-	}
-
-	for (i = 0; i < nrOfThreads ; i += 1) {
-		pthread_join(threads[i], NULL);
-		elapsedTime += ((infos[i].end.tv_sec - infos[i].begin.tv_sec) * 1000000) + (infos[i].end.tv_usec - infos[i].begin.tv_usec);
-		result.skips += infos[i].skips;
-	}
-
-    unsigned int actualSamples = (nrOfSamples * nrOfThreads) - result.skips;
-	result.averageCallTimeInNanoseconds = actualSamples == 0 ? NAN : ((double)elapsedTime * 1000) / (nrOfSamples * nrOfThreads);
-	result.callFrequencyInMhz = ((double)(actualSamples * nrOfThreads) / elapsedTime);
-	result.nrOfThreads = nrOfThreads;
-	result.nrOfsamples = actualSamples;
-    result.requestedNrOfSamples = (nrOfSamples * nrOfThreads);
-
-	return result;
-}
-
-static void benchmark_thread(thread_info_t *info) {
-	int i;
-
-	gettimeofday(&info->begin, NULL);
-	for (i = 0; i < info->nrOfSamples; i += 1) {
-		pthread_mutex_lock(&info->benchmark->mutex);
-		if (info->benchmark->math != NULL) {
-			info->result = info->benchmark->math->calc(info->benchmark->math->handle, info->result, i);
-		} else {
-			info->skips += 1; //should not happen
-		}
-		pthread_mutex_unlock(&info->benchmark->mutex);
-	}
-	gettimeofday(&info->end, NULL);
-
-}
-
-char * benchmark_getName(benchmark_pt benchmark) {
-	return (char *)BENCHMARK_NAME;
-}
-
-celix_status_t benchmark_addMathService(benchmark_pt benchmark, math_service_pt mathService) {
-	pthread_mutex_lock(&benchmark->mutex);
-	benchmark->math = mathService;
-	pthread_mutex_unlock(&benchmark->mutex);
-	return CELIX_SUCCESS;
-}
-
-celix_status_t benchmark_removeMathService(benchmark_pt benchmark, math_service_pt mathService) {
-	pthread_mutex_lock(&benchmark->mutex);
-	if (benchmark->math == mathService) {
-		benchmark->math = NULL;
-	}
-	pthread_mutex_unlock(&benchmark->mutex);
-	return CELIX_SUCCESS;
-
-}
-
-double benchmark_getSampleFactor(benchmark_pt benchmark) {
-	return SAMPLE_FACTOR;
-}
diff --git a/examples/locking/reference_benchmark/CMakeLists.txt b/examples/locking/reference_benchmark/CMakeLists.txt
deleted file mode 100644
index 017d195..0000000
--- a/examples/locking/reference_benchmark/CMakeLists.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-add_bundle(reference_benchmark SOURCES
-	../benchmark/public/src/benchmark_activator
-	private/src/reference_benchmark 
-)
-
-include_directories(public/include)
-include_directories(../benchmark/public/include)
-include_directories("${PROJECT_SOURCE_DIR}/framework/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/shell/public/include")
-target_link_libraries(reference_benchmark celix_framework)
-
diff --git a/examples/locking/reference_benchmark/private/src/reference_benchmark.c b/examples/locking/reference_benchmark/private/src/reference_benchmark.c
deleted file mode 100644
index 0cc0c33..0000000
--- a/examples/locking/reference_benchmark/private/src/reference_benchmark.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-
-#include <stdlib.h>
-#include <pthread.h>
-#include <unistd.h>
-#include <sys/time.h>
-
-#include "benchmark.h"
-
-static const char * const BENCHMARK_NAME = "REFERENCE";
-static const double SAMPLE_FACTOR = 100;
-
-typedef struct thread_info {
-	benchmark_pt benchmark;
-	int nrOfSamples;
-	unsigned int result;
-	struct timeval begin;
-	struct timeval end;
-	int skips;
-} thread_info_t;
-
-static void benchmark_thread(thread_info_t *info);
-static int benchmark_calc(int arg1, int arg2);
-
-celix_status_t benchmark_create(benchmark_pt *benchmark) {
-	//do nothing
-	return CELIX_SUCCESS;
-}
-
-celix_status_t benchmark_destroy(benchmark_pt benchmark) {
-	//do nothing
-	return CELIX_SUCCESS;
-}
-
-benchmark_result_t benchmark_run(benchmark_pt benchmark, int nrOfThreads, int nrOfSamples) {
-	int i;
-	pthread_t threads[nrOfThreads];
-	thread_info_t infos[nrOfThreads];
-	benchmark_result_t result;
-	unsigned long elapsedTime = 0;
-
-	result.skips =0;
-
-	for (i = 0 ; i < nrOfThreads ; i += 1) {
-		infos[i].benchmark = benchmark;
-		infos[i].nrOfSamples = nrOfSamples;
-		infos[i].skips = 0;
-		infos[i].result = rand();
-		pthread_create(&threads[i], NULL, (void *)benchmark_thread,  &infos[i]);
-	}
-
-	for (i = 0; i < nrOfThreads ; i += 1) {
-		pthread_join(threads[i], NULL);
-		elapsedTime += ((infos[i].end.tv_sec - infos[i].begin.tv_sec) * 1000000) + (infos[i].end.tv_usec - infos[i].begin.tv_usec);
-		result.skips += infos[i].skips;
-	}
-
-	result.averageCallTimeInNanoseconds = elapsedTime;
-	result.averageCallTimeInNanoseconds *= 1000;
-	result.averageCallTimeInNanoseconds /= nrOfSamples;
-	result.averageCallTimeInNanoseconds /= nrOfThreads;
-	result.callFrequencyInMhz = ((double)(nrOfSamples * nrOfThreads) / elapsedTime);
-	result.nrOfThreads = nrOfThreads;
-	result.nrOfsamples = nrOfSamples;
-
-	return result;
-}
-
-static void benchmark_thread(thread_info_t *info) {
-	int i;
-
-	int result = info->result;
-	struct timeval *begin = &info->begin;
-	struct timeval *end = &info->end;
-	int nrOFSamples = info->nrOfSamples;
-
-
-	gettimeofday(begin, NULL);
-	for (i = 0; i < nrOFSamples; i += 1) {
-		result = benchmark_calc(result, i);
-	}
-	gettimeofday(end, NULL);
-
-	info->result = result;
-}
-
-char * benchmark_getName(benchmark_pt benchmark) {
-	return (char *)BENCHMARK_NAME;
-}
-
-celix_status_t benchmark_addMathService(benchmark_pt benchmark, math_service_pt mathService) {
-	//ignore service is not used
-	return CELIX_SUCCESS;
-}
-
-celix_status_t benchmark_removeMathService(benchmark_pt benchmark, math_service_pt mathService) {
-	//ignore service is not used
-	return CELIX_SUCCESS;
-
-}
-
-/*
- * Same implementation as the math_service. This function is used a reference.
- */
-static int benchmark_calc(int arg1, int arg2) {
-	return  arg1 * arg2 + arg2;
-}
-
-double benchmark_getSampleFactor(benchmark_pt benchmark) {
-	return SAMPLE_FACTOR;
-}
diff --git a/examples/locking/services/benchmark_service.h b/examples/locking/services/benchmark_service.h
deleted file mode 100644
index d0a1a9c..0000000
--- a/examples/locking/services/benchmark_service.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-
-#ifndef BENCHMARK_SERVICE_H_
-#define BENCHMARK_SERVICE_H_
-
-#include "benchmark_result.h"
-
-typedef struct benchmark_service *benchmark_service_pt;
-
-typedef struct benchmark_handler *benchmark_handler_pt; //ADT
-
-#define BENCHMARK_SERVICE_NAME "benchmark_service"
-
-struct benchmark_service {
-	benchmark_handler_pt handler;
-
-	benchmark_result_t (*run)(benchmark_handler_pt handler, int nrOfThreads, int nrOfSamples);
-	char * (*name)(benchmark_handler_pt handler);
-	double (*getSampleFactor)(benchmark_handler_pt benchmark);
-};
-
-#endif /* BENCHMARK_SERVICE_H_ */
diff --git a/examples/locking/services/frequency_service.h b/examples/locking/services/frequency_service.h
deleted file mode 100644
index 8f4ad12..0000000
--- a/examples/locking/services/frequency_service.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * frequence_service.h
- *
- *  \date       Feb 4, 2014
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-//TODO change to math provider service ???
-
-#ifndef FREQUENCY_SERVICE_H
-#define FREQUENCY_SERVICE_H
-
-#define FREQUENCY_SERVICE_NAME "frequency_service"
-
-typedef struct frequency_hander frequence_handler_t;
-
-struct frequency_service {
-	frequence_handler_t *handle;
-	void (*setFrequency)(frequence_handler_t *handle, double freq);
-	void (*resetCounter)(frequence_handler_t *handle);
-	unsigned int (*getCounter)(frequence_handler_t *handle);
-	void (*setBenchmarkName)(frequence_handler_t *handle, char *name);
-	void (*setNrOfThreads)(frequence_handler_t *handle, unsigned int nrOfThreads);
-};
-
-typedef struct frequency_service * frequency_service_pt;
-
-#endif /* FREQUENCY_SERVICE_H */
diff --git a/examples/locking/services/math_service.h b/examples/locking/services/math_service.h
deleted file mode 100644
index 23de461..0000000
--- a/examples/locking/services/math_service.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * echo_server.h
- *
- *  \date       Sep 21, 2010
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-#ifndef MATH_SERVICE_H 
-#define MATH_SERVICE_H 
-
-#define MATH_SERVICE_NAME "math_service"
-
-
-struct math_service {
-	void *handle;
-	int (*calc)(void *handle, int arg1, int arg2);
-};
-
-typedef struct math_service *math_service_pt;
-
-#endif /* MATH_SERVICE_H */
diff --git a/examples/locking/start_stop_benchmark/CMakeLists.txt b/examples/locking/start_stop_benchmark/CMakeLists.txt
deleted file mode 100644
index ec88166..0000000
--- a/examples/locking/start_stop_benchmark/CMakeLists.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-add_bundle(start_stop_benchmark SOURCES
-	../benchmark/public/src/benchmark_activator
-	private/src/start_stop_benchmark 
-)
-
-include_directories(public/include)
-include_directories(../benchmark/public/include)
-include_directories("${PROJECT_SOURCE_DIR}/framework/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/shell/public/include")
-target_link_libraries(start_stop_benchmark celix_framework)
-
diff --git a/examples/locking/start_stop_benchmark/private/src/start_stop_benchmark.c b/examples/locking/start_stop_benchmark/private/src/start_stop_benchmark.c
deleted file mode 100644
index b86af52..0000000
--- a/examples/locking/start_stop_benchmark/private/src/start_stop_benchmark.c
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-
-#include <stdlib.h>
-#include <pthread.h>
-#include <unistd.h>
-#include <sys/time.h>
-#include <stdio.h>
-
-#include "benchmark.h"
-
-static const char * const BENCHMARK_NAME = "INTR_CONT";
-static const double SAMPLE_FACTOR = 100;
-static const __useconds_t WAIT_TIME = 1; //100 * 1000;
-
-typedef enum benchmark_state {
-	BENCHMARK_STATE_INTERRUPTED,
-	BENCHMARK_STATE_RUNNING
-} benchmark_state_t;
-
-struct benchmark {
-	int nrOfThreads;
-	pthread_mutex_t mutex; //write protect for state
-	math_service_pt math;
-	benchmark_state_t state;
-	int threadsRunning;
-};
-
-typedef struct thread_info {
-	benchmark_pt benchmark;
-	int nrOfSamples;
-	unsigned int result;
-	struct timeval begin;
-	struct timeval end;
-	int skips;
-} thread_info_t;
-
-static void benchmark_thread(thread_info_t *info);
-static void benchmark_runSamples(thread_info_t *info, int *i, volatile benchmark_state_t *state);
-static void benchmark_interrupt(benchmark_pt benchmark);
-static void benchmark_continue(benchmark_pt benchmark);
-
-celix_status_t benchmark_create(benchmark_pt *benchmark) {
-	(*benchmark) = malloc(sizeof(struct benchmark));
-	(*benchmark)->math = NULL;
-	(*benchmark)->state = BENCHMARK_STATE_INTERRUPTED;
-	(*benchmark)->nrOfThreads = 0;
-	(*benchmark)->threadsRunning = 0;
-
-	pthread_mutex_init(&(*benchmark)->mutex, NULL);
-
-	return CELIX_SUCCESS;
-}
-
-celix_status_t benchmark_destroy(benchmark_pt benchmark) {
-	free(benchmark);
-
-	return CELIX_SUCCESS;
-}
-
-benchmark_result_t benchmark_run(benchmark_pt benchmark, int nrOfThreads, int nrOfSamples) {
-	int i;
-	pthread_t threads[nrOfThreads];
-	thread_info_t infos[nrOfThreads];
-	int isThreadRunning[nrOfThreads];
-	benchmark_result_t result;
-	unsigned long elapsedTime = 0;
-	result.skips =0;
-
-	for (i = 0 ; i < nrOfThreads ; i += 1) {
-		infos[i].benchmark = benchmark;
-		infos[i].nrOfSamples = nrOfSamples;
-		infos[i].skips = 0;
-		infos[i].result = rand();
-		pthread_create(&threads[i], NULL, (void *)benchmark_thread,  &infos[i]);
-	}
-
-	benchmark->nrOfThreads = nrOfThreads;
-
-	for (i = 0; i < nrOfThreads ; i += 1) {
-		pthread_join(threads[i], NULL);
-		elapsedTime += ((infos[i].end.tv_sec - infos[i].begin.tv_sec) * 1000000) + (infos[i].end.tv_usec - infos[i].begin.tv_usec);
-		result.skips += infos[i].skips;
-	}
-
-	benchmark->nrOfThreads = 0;
-
-	result.averageCallTimeInNanoseconds = elapsedTime;
-	result.averageCallTimeInNanoseconds *= 1000;
-	result.averageCallTimeInNanoseconds /= nrOfSamples;
-	result.averageCallTimeInNanoseconds /= nrOfThreads;
-	result.callFrequencyInMhz = ((double)(nrOfSamples * nrOfThreads) / elapsedTime);
-	result.nrOfThreads = nrOfThreads;
-	result.nrOfsamples = nrOfSamples;
-
-	return result;
-}
-
-static void benchmark_thread(thread_info_t *info) {
-	int i = 0;
-
-	gettimeofday(&info->begin, NULL);
-	while (i < info->nrOfSamples) {
-		if (info->benchmark->state == BENCHMARK_STATE_RUNNING ) {
-			//TODO race condition?? or not because of the mutex on changing the state
-			__sync_add_and_fetch(&info->benchmark->threadsRunning, 1);
-			benchmark_runSamples(info, &i, &info->benchmark->state);
-			__sync_sub_and_fetch(&info->benchmark->threadsRunning, 1);
-		} else {
-			usleep(WAIT_TIME);
-		}
-	}
-	gettimeofday(&info->end, NULL);
-
-}
-
-static void benchmark_runSamples(thread_info_t *info, int *i, volatile benchmark_state_t *state) {
-	int nrOfSamples = info->nrOfSamples;
-	unsigned int result = info->result;
-	math_service_pt math = info->benchmark->math;
-
-	for (; *i < nrOfSamples && *state == BENCHMARK_STATE_RUNNING; *i += 1) {
-		result = math->calc(math->handle, result, *i);
-	}
-
-	info->result = result;
-}
-
-char * benchmark_getName(benchmark_pt benchmark) {
-	return (char *)BENCHMARK_NAME;
-}
-
-static void benchmark_continue(benchmark_pt benchmark) {
-	benchmark->state = BENCHMARK_STATE_RUNNING;
-	unsigned long waitTime = 0;
-	while (benchmark->threadsRunning < benchmark->nrOfThreads) {
-		usleep(WAIT_TIME);
-		waitTime += WAIT_TIME;
-		if (waitTime > 1000 * 1000 * 2) {
-			printf("still waiting to stop, running threads are %i\n",
-					benchmark->threadsRunning);
-		}
-	}
-}
-
-static void benchmark_interrupt(benchmark_pt benchmark) {
-	int i = 0;
-	unsigned long waitTime = 0;
-	if (benchmark->state == BENCHMARK_STATE_RUNNING) {
-		benchmark->state = BENCHMARK_STATE_INTERRUPTED;
-		while (benchmark->threadsRunning > 0) {
-			usleep(WAIT_TIME);
-			waitTime += WAIT_TIME;
-			if (waitTime > 1000 * 1000 * 2) {
-				printf("still waiting to stop, running threads are %i\n",
-						benchmark->threadsRunning);
-			}
-		}
-	}
-}
-
-celix_status_t benchmark_addMathService(benchmark_pt benchmark, math_service_pt mathService) {
-	pthread_mutex_lock(&benchmark->mutex);
-	benchmark_interrupt(benchmark);
-	benchmark->math = mathService;
-	benchmark_continue(benchmark);
-	pthread_mutex_unlock(&benchmark->mutex);
-	return CELIX_SUCCESS;
-}
-
-celix_status_t benchmark_removeMathService(benchmark_pt benchmark, math_service_pt mathService) {
-	pthread_mutex_lock(&benchmark->mutex);
-	if (benchmark->math == mathService) {
-		benchmark_interrupt(benchmark);
-		benchmark->math = NULL;
-		benchmark_continue(benchmark);
-	}
-	pthread_mutex_unlock(&benchmark->mutex);
-	return CELIX_SUCCESS;
-
-}
-
-double benchmark_getSampleFactor(benchmark_pt benchmark) {
-	return SAMPLE_FACTOR;
-}
diff --git a/examples/mongoose/CMakeLists.txt b/examples/mongoose/CMakeLists.txt
index 0ef71e3..f4250ef 100644
--- a/examples/mongoose/CMakeLists.txt
+++ b/examples/mongoose/CMakeLists.txt
@@ -35,4 +35,8 @@
         private/include/mongoose.h
 )
 
-target_link_libraries(mongoose celix_framework mongooselib ${LIBS})
\ No newline at end of file
+bundle_files(mongoose ${CMAKE_CURRENT_LIST_DIR}/root)
+
+target_link_libraries(mongoose celix_framework mongooselib ${LIBS})
+
+add_deploy("mongoose_deploy" BUNDLES shell shell_tui log_service mongoose)
diff --git a/examples/mongoose/private/src/activator.c b/examples/mongoose/private/src/activator.c
index 209ecdc..beea9df 100644
--- a/examples/mongoose/private/src/activator.c
+++ b/examples/mongoose/private/src/activator.c
@@ -1,4 +1,4 @@
-#include <sys/cdefs.h>/**
+/**
  *Licensed to the Apache Software Foundation (ASF) under one
  *or more contributor license agreements.  See the NOTICE file
  *distributed with this work for additional information
@@ -31,6 +31,7 @@
 
 struct userData {
 	struct mg_context *ctx;
+    char* entry;
 };
 
 celix_status_t bundleActivator_create(bundle_context_pt  __attribute__((unused)) context, void **userData) {
@@ -44,16 +45,13 @@
 	struct userData * data = (struct userData *) userData;
 
 	if (bundleContext_getBundle(context, &bundle) == CELIX_SUCCESS) {
-		char *entry = NULL;
-		bundle_getEntry(bundle, "root", &entry);
+		bundle_getEntry(bundle, "root", &data->entry);
 		const char *options[] = {
-			"document_root", entry,
+			"document_root", data->entry,
 			"listening_ports", "8081",
 			NULL
 		};
 
-		printf("entry %s\n", entry);
-
 		data->ctx = mg_start(NULL, options);
 
 		if (data->ctx) {
@@ -74,6 +72,8 @@
 }
 
 celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt  __attribute__((unused)) context) {
-	free(userData);
+	struct userData * data = (struct userData *) userData;
+    free(data->entry);
+	free(data);
 	return CELIX_SUCCESS;
 }
diff --git a/examples/mongoose/private/src/mongoose.c b/examples/mongoose/private/src/mongoose.c
index 34eb2c6..1a1f87c 100644
--- a/examples/mongoose/private/src/mongoose.c
+++ b/examples/mongoose/private/src/mongoose.c
@@ -1204,12 +1204,12 @@
 
 #ifndef NO_CGI
 static pid_t spawn_process(struct mg_connection *conn, const char *prog,
-                           char *envblk, char *envp[], int fd_stdin,
+		__attribute__((unused)) char *envblk, char *envp[], int fd_stdin,
                            int fd_stdout, const char *dir) {
   pid_t pid;
   const char *interp;
 
-  envblk = NULL; // Unused
+  // envblk = NULL; // Unused
 
   if ((pid = fork()) == -1) {
     // Parent
@@ -1314,8 +1314,8 @@
   const char *buffered;
 
   assert(conn->content_len >= conn->consumed_content);
-  DEBUG_TRACE(("%p %zu %lld %lld", buf, len,
-               conn->content_len, conn->consumed_content));
+  DEBUG_TRACE(("%p %zu %ld %ld", buf, len,
+               (long)conn->content_len, (long)conn->consumed_content));
   nread = 0;
   if (strcmp(conn->request_info.request_method, "POST") == 0 &&
       conn->consumed_content < conn->content_len) {
@@ -1930,7 +1930,7 @@
   MD5Transform(ctx->buf, (uint32_t *) ctx->in);
   byteReverse((unsigned char *) ctx->buf, 4);
   memcpy(digest, ctx->buf, 16);
-  memset((char *) ctx, 0, sizeof(ctx));
+  memset((char *) ctx, 0, sizeof(*ctx));
 }
 #endif // !HAVE_MD5
 
@@ -2203,6 +2203,7 @@
     return 0;
   } else if ((fp2 = mg_fopen(tmp, "w+")) == NULL) {
     cry(fc(ctx), "Cannot open %s: %s", tmp, strerror(errno));
+    fclose(fp);
     return 0;
   }
 
@@ -2366,6 +2367,7 @@
     if (entries == NULL) {
       send_http_error(conn, 500, "Cannot open directory",
           "%s", "Error: cannot allocate memory");
+      closedir(dirp);
       return;
     }
 
@@ -2404,12 +2406,14 @@
       conn->request_info.uri, "..", "Parent directory", "-", "-");
 
   // Sort and print directory entries
-  qsort(entries, num_entries, sizeof(entries[0]), compare_dir_entries);
-  for (i = 0; i < num_entries; i++) {
-    print_dir_entry(&entries[i]);
-    free(entries[i].file_name);
+  if(entries!=NULL){
+	  qsort(entries, num_entries, sizeof(entries[0]), compare_dir_entries);
+	  for (i = 0; i < num_entries; i++) {
+		  print_dir_entry(&entries[i]);
+		  free(entries[i].file_name);
+	  }
+	  free(entries);
   }
-  free(entries);
 
   conn->num_bytes_sent += mg_printf(conn, "%s", "</table></body></html>");
   conn->request_info.status_code = 200;
@@ -3291,7 +3295,9 @@
 #endif // !_WIN32
                bind(sock, &so.lsa.u.sa, so.lsa.len) != 0 ||
                listen(sock, 20) != 0) {
-      closesocket(sock);
+      if(sock != INVALID_SOCKET ){
+	  closesocket(sock);
+      }
       cry(fc(ctx), "%s: cannot bind to %.*s: %s", __func__,
           vec.len, vec.ptr, strerror(ERRNO));
       success = 0;
@@ -3448,10 +3454,10 @@
 #if !defined(NO_SSL)
 static pthread_mutex_t *ssl_mutexes;
 
-static void ssl_locking_callback(int mode, int mutex_num, const char *file,
-                                 int line) {
-  line = 0;    // Unused
-  file = NULL; // Unused
+static void ssl_locking_callback(int mode, int mutex_num, __attribute__((unused)) const char *file,
+		__attribute__((unused)) int line) {
+  // line = 0;    // Unused
+  // file = NULL; // Unused
 
   if (mode & CRYPTO_LOCK) {
     (void) pthread_mutex_lock(&ssl_mutexes[mutex_num]);
@@ -3476,7 +3482,9 @@
     return 0;
   }
 
-  for (fp = sw; fp->name != NULL; fp++) {
+  int ret = 1;
+
+  for (fp = sw; fp->name != NULL && ret==1; fp++) {
 #ifdef _WIN32
     // GetProcAddress() returns pointer to function
     u.fp = (void (*)(void)) dlsym(dll_handle, fp->name);
@@ -3487,13 +3495,15 @@
 #endif /* _WIN32 */
     if (u.fp == NULL) {
       cry(fc(ctx), "%s: %s: cannot find %s", __func__, dll_name, fp->name);
-      return 0;
+      ret=0;
     } else {
       fp->ptr = u.fp;
     }
   }
 
-  return 1;
+  dlclose(dll_handle);
+
+  return ret;
 }
 #endif // NO_SSL_DL
 
@@ -3804,9 +3814,10 @@
   struct mg_connection *conn;
   int buf_size = atoi(ctx->config[MAX_REQUEST_SIZE]);
 
-  conn = calloc(1, sizeof(*conn) + buf_size);
+  conn = calloc(1, sizeof(*conn));
   conn->buf_size = buf_size;
-  conn->buf = (char *) (conn + 1);
+  //+5 because in some point of the code there are direct accesses to buf with index>=2
+  conn->buf = calloc(buf_size + 5, sizeof(char));
   assert(conn != NULL);
 
   while (ctx->stop_flag == 0 && consume_socket(ctx, &conn->client)) {
@@ -3829,6 +3840,7 @@
 
     close_connection(conn);
   }
+  free(conn->buf);
   free(conn);
 
   // Signal master that we're done with connection and exiting
@@ -3863,7 +3875,8 @@
 static void accept_new_connection(const struct socket *listener,
                                   struct mg_context *ctx) {
   struct socket accepted;
-  int allowed;
+  memset(&accepted,0,sizeof(struct socket));
+  int allowed = 0;
 
   accepted.rsa.len = sizeof(accepted.rsa.u.sin);
   accepted.lsa = listener->lsa;
diff --git a/examples/osgi-in-action/chapter01-greeting-example/CMakeLists.txt b/examples/osgi-in-action/chapter01-greeting-example/CMakeLists.txt
deleted file mode 100644
index 5434968..0000000
--- a/examples/osgi-in-action/chapter01-greeting-example/CMakeLists.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-add_subdirectory(greeting)
-add_subdirectory(client)
diff --git a/examples/osgi-in-action/chapter01-greeting-example/README.TXT b/examples/osgi-in-action/chapter01-greeting-example/README.TXT
deleted file mode 100644
index 1e4f7ef..0000000
--- a/examples/osgi-in-action/chapter01-greeting-example/README.TXT
+++ /dev/null
@@ -1,24 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#  KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
- 
-The example activates the bundles `chapter01-greeting-example` and  `chapter01-greeting-example-client`.
-The activator of the client bundle (client.c) tries to find the greeting service, but may fail at start-up,
-because it is activated before the greeting service is installed.
-
-When the text 'Greetings' does not appear, stop and start the `chapter01-greeting-example-client` bundle.
-Now the `chapter01-greeting-example` is already installed and the text `Greetings` does appear after the 
-restart of the client bundle.
diff --git a/examples/osgi-in-action/chapter01-greeting-example/client/CMakeLists.txt b/examples/osgi-in-action/chapter01-greeting-example/client/CMakeLists.txt
deleted file mode 100644
index 4639292..0000000
--- a/examples/osgi-in-action/chapter01-greeting-example/client/CMakeLists.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-add_bundle(chapter01-greeting-example-client VERSION 0.0.1 SOURCES private/src/client)
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("../greeting/public/include")
-target_link_libraries(chapter01-greeting-example-client celix_framework)
diff --git a/examples/osgi-in-action/chapter01-greeting-example/client/private/src/client.c b/examples/osgi-in-action/chapter01-greeting-example/client/private/src/client.c
deleted file mode 100644
index 41aff7c..0000000
--- a/examples/osgi-in-action/chapter01-greeting-example/client/private/src/client.c
+++ /dev/null
@@ -1,65 +0,0 @@
-#include <sys/cdefs.h>/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * client.c
- *
- *  \date       Sep 29, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "bundle_activator.h"
-#include "greeting_service.h"
-
-
-celix_status_t bundleActivator_create(bundle_context_pt  __attribute__((unused)) context, void **userData) {
-	*userData = NULL;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_start(void __attribute__((unused)) * userData, bundle_context_pt ctx) {
-	service_reference_pt ref = NULL;
-	celix_status_t status = bundleContext_getServiceReference(ctx, (char *) GREETING_SERVICE_NAME, &ref);
-	if (status == CELIX_SUCCESS) {
-		if (ref == NULL) {
-			printf("Greeting service reference not available\n");
-		} else {
-			greeting_service_pt greeting = NULL;
-			bundleContext_getService(ctx, ref, (void *) &greeting);
-			if (greeting == NULL){
-				printf("Greeting service not available\n");
-			} else {
-				bool result;
-				(*greeting->greeting_sayHello)(greeting->instance);
-				bundleContext_ungetService(ctx, ref, &result);
-			}
-		}
-	}
-	return status;
-}
-
-celix_status_t bundleActivator_stop(void __attribute__((unused)) * userData, bundle_context_pt  __attribute__((unused)) context) {
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_destroy(void __attribute__((unused)) * userData, bundle_context_pt  __attribute__((unused)) context) {
-	return CELIX_SUCCESS;
-}
diff --git a/examples/osgi-in-action/chapter01-greeting-example/greeting/CMakeLists.txt b/examples/osgi-in-action/chapter01-greeting-example/greeting/CMakeLists.txt
deleted file mode 100644
index 625cbda..0000000
--- a/examples/osgi-in-action/chapter01-greeting-example/greeting/CMakeLists.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-add_bundle(chapter01-greeting-example VERSION 0.0.1 SOURCES
-    private/src/activator
-    private/src/greeting_impl
-    
-    private/include/greeting_impl.h
-)
-
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("public/include")
-include_directories("private/include")
-target_link_libraries(chapter01-greeting-example celix_framework)
diff --git a/examples/osgi-in-action/chapter01-greeting-example/greeting/private/include/greeting_impl.h b/examples/osgi-in-action/chapter01-greeting-example/greeting/private/include/greeting_impl.h
deleted file mode 100644
index 8ea2091..0000000
--- a/examples/osgi-in-action/chapter01-greeting-example/greeting/private/include/greeting_impl.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * greeting_impl.h
- *
- *  \date       Sep 29, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#ifndef GREETING_IMPL_H_
-#define GREETING_IMPL_H_
-
-#include "greeting_service.h"
-
-struct greeting {
-	char *name;
-};
-
-extern void greeting_sayHello(greeting_pt instance);
-
-
-#endif /* GREETING_IMPL_H_ */
diff --git a/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/activator.c b/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/activator.c
deleted file mode 100644
index 64d324a..0000000
--- a/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/activator.c
+++ /dev/null
@@ -1,91 +0,0 @@
-#include <sys/cdefs.h>/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * activator.c
- *
- *  \date       Sep 29, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdlib.h>
-
-#include "bundle_activator.h"
-#include "greeting_impl.h"
-
-struct greetingActivator {
-	service_registration_pt reg;
-	greeting_service_pt greetingService;
-};
-
-typedef struct greetingActivator *greeting_activator_pt;
-
-celix_status_t bundleActivator_create(bundle_context_pt  __attribute__((unused)) context, void **userData) {
-	celix_status_t status = CELIX_SUCCESS;
-	greeting_activator_pt activator;
-	*userData = calloc(1, sizeof(struct greetingActivator));
-	if (*userData) {
-		activator = *userData;
-		activator->reg = NULL;
-	} else {
-		status = CELIX_ENOMEM;
-	}
-	return status;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
-	celix_status_t status;
-
-	greeting_activator_pt act = (greeting_activator_pt) userData;
-
-	act->greetingService = calloc(1, sizeof(*act->greetingService));
-
-	if (act->greetingService) {
-		act->greetingService->instance = calloc(1, sizeof(*act->greetingService->instance));
-		if (act->greetingService->instance) {
-			act->greetingService->instance->name = GREETING_SERVICE_NAME;
-			act->greetingService->greeting_sayHello = greeting_sayHello;
-
-			status = bundleContext_registerService(context, GREETING_SERVICE_NAME, act->greetingService, NULL, &act->reg);
-		} else {
-			status = CELIX_ENOMEM;
-		}
-	} else {
-		status = CELIX_ENOMEM;
-	}
-	return status;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt  __attribute__((unused)) context) {
-	celix_status_t status = CELIX_SUCCESS;
-
-	greeting_activator_pt act = (greeting_activator_pt) userData;
-
-	serviceRegistration_unregister(act->reg);
-	act->reg = NULL;
-
-	free(act->greetingService->instance);
-	free(act->greetingService);
-
-	return status;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt  __attribute__((unused)) context) {
-	free(userData);
-	return CELIX_SUCCESS;
-}
diff --git a/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/greeting_impl.c b/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/greeting_impl.c
deleted file mode 100644
index abe60cc..0000000
--- a/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/greeting_impl.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * greeting_impl.c
- *
- *  \date       Sep 29, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdio.h>
-#include "greeting_impl.h"
-
-void greeting_sayHello(greeting_pt instance){
-	printf("Greetings from %s\n", instance->name);
-}
-
diff --git a/examples/osgi-in-action/chapter01-greeting-example/greeting/public/include/greeting_service.h b/examples/osgi-in-action/chapter01-greeting-example/greeting/public/include/greeting_service.h
deleted file mode 100644
index 9b528ef..0000000
--- a/examples/osgi-in-action/chapter01-greeting-example/greeting/public/include/greeting_service.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * greeting_service.h
- *
- *  \date       Sep 29, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#ifndef GREETING_H_
-#define GREETING_H_
-
-#define GREETING_SERVICE_NAME "greeting-service"
-
-typedef struct greeting *greeting_pt;
-typedef struct greeting_service *greeting_service_pt;
-
-struct greeting_service {
-	greeting_pt instance;
-	void (*greeting_sayHello)(greeting_pt instance);
-};
-
-#endif /* GREETING_H_ */
diff --git a/examples/osgi-in-action/chapter04-correct-listener/CMakeLists.txt b/examples/osgi-in-action/chapter04-correct-listener/CMakeLists.txt
deleted file mode 100644
index 2e68124..0000000
--- a/examples/osgi-in-action/chapter04-correct-listener/CMakeLists.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-SET(BUNDLE_SYMBOLICNAME "apache_celix_examples_chapter04_correct_listener")
-add_bundle(chapter04-correct-listener VERSION 0.0.1 SOURCES private/src/listener_example)
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/log_service/public/include")
-target_link_libraries(chapter04-correct-listener celix_framework)
diff --git a/examples/osgi-in-action/chapter04-correct-listener/README.TXT b/examples/osgi-in-action/chapter04-correct-listener/README.TXT
deleted file mode 100644
index 355d1ad..0000000
--- a/examples/osgi-in-action/chapter04-correct-listener/README.TXT
+++ /dev/null
@@ -1,23 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#  KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-In the log server a listener registers when the log_service bundle is stopped and 
-started by means of the serviceChanged() routine. This routine maintains the set of log
-services in the variable m_logServiceRefs. The function getLogService() returns the
-current LOG_SERVICE, if it is active or NULL.
-Starting and stopping the log_service bundle shows that the logServiceTest thread 
-correctly recognizes the non-availability of the log_services, when stopped.
diff --git a/examples/osgi-in-action/chapter04-correct-listener/private/src/listener_example.c b/examples/osgi-in-action/chapter04-correct-listener/private/src/listener_example.c
deleted file mode 100644
index a0e118b..0000000
--- a/examples/osgi-in-action/chapter04-correct-listener/private/src/listener_example.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * listener_example.c
- *
- *  \date       Sep 22, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-
-#include "bundle_activator.h"
-#include "log_service.h"
-
-struct listenerActivator {
-    bundle_context_pt context;
-    service_listener_pt listener;
-
-    celix_thread_t logger;
-    celix_thread_mutex_t logServiceReferencesLock;
-
-    array_list_pt logServiceReferences;
-
-    bool running;
-};
-
-void listenerExample_serviceChanged(service_listener_pt listener, service_event_pt event);
-celix_status_t listenerExample_getLogService(struct listenerActivator *activator, log_service_pt *service);
-
-static void* listenerExample_logger(void* data);
-
-celix_status_t listenerExample_alternativeLog(struct listenerActivator *activator, char *message);
-
-celix_status_t ref_equals(void *a, void *b, bool *equals) {
-    return serviceReference_equals(a, b, equals);
-}
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
-    celix_status_t status = CELIX_SUCCESS;
-
-    *userData = calloc(1, sizeof(struct listenerActivator));
-    if (!*userData) {
-        status = CELIX_ENOMEM;
-    } else {
-        struct listenerActivator *activator = (*userData);
-        activator->context = context;
-        activator->listener = NULL;
-        activator->logServiceReferences = NULL;
-        arrayList_createWithEquals(ref_equals, &activator->logServiceReferences);
-        activator->running = false;
-
-        status = celixThreadMutex_create(&activator->logServiceReferencesLock, NULL);
-    }
-
-    return status;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
-    celix_status_t status = CELIX_SUCCESS;
-    struct listenerActivator *activator = userData;
-
-    service_listener_pt listener = calloc(1, sizeof(struct listenerActivator));
-    if (!listener) {
-        status = CELIX_ENOMEM;
-    } else {
-        char filter[30];
-        array_list_pt logServices = NULL;
-        sprintf(filter, "(objectClass=%s)", OSGI_LOGSERVICE_NAME);
-
-        listener->handle = activator;
-        listener->serviceChanged = (void *) listenerExample_serviceChanged;
-        status = bundleContext_addServiceListener(context, listener, filter);
-        if (status == CELIX_SUCCESS) {
-            activator->listener = listener;
-        }
-
-        status = bundleContext_getServiceReferences(context, NULL, filter, &logServices);
-        if (status == CELIX_SUCCESS) {
-            int i;
-            for (i = 0; i < arrayList_size(logServices); i++) {
-                service_reference_pt logService = (service_reference_pt) arrayList_get(logServices, i);
-                service_event_pt event = calloc(1, sizeof(*event));
-                event->reference = logService;
-                event->type = OSGI_FRAMEWORK_SERVICE_EVENT_REGISTERED;
-
-                listenerExample_serviceChanged(listener, event);
-            }
-            arrayList_destroy(logServices);
-        }
-
-        activator->running = true;
-
-        status = celixThread_create(&activator->logger, NULL, listenerExample_logger, activator);
-    }
-
-    return status;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
-    celix_status_t status = CELIX_SUCCESS;
-    struct listenerActivator *activator = userData;
-
-    activator->running = false;
-    celixThread_join(activator->logger, NULL);
-
-    bundleContext_removeServiceListener(context, activator->listener);
-
-    return status;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
-    celix_status_t status = CELIX_SUCCESS;
-    struct listenerActivator *activator = userData;
-    arrayList_destroy(activator->logServiceReferences);
-    return status;
-}
-
-void listenerExample_serviceChanged(service_listener_pt listener, service_event_pt event) {
-    struct listenerActivator *activator = listener->handle;
-    celixThreadMutex_lock(&activator->logServiceReferencesLock);
-
-    switch (event->type) {
-    case OSGI_FRAMEWORK_SERVICE_EVENT_REGISTERED:
-        arrayList_add(activator->logServiceReferences, event->reference);
-        break;
-//	case MODIFIED:
-//		// only the service metadata has changed, so no need to do anything here
-//		break;
-    case OSGI_FRAMEWORK_SERVICE_EVENT_UNREGISTERING:
-        arrayList_remove(activator->logServiceReferences, arrayList_indexOf(activator->logServiceReferences, event->reference));
-        break;
-    default:
-        break;
-    }
-
-    celixThreadMutex_unlock(&activator->logServiceReferencesLock);
-}
-
-celix_status_t listenerExample_getLogService(struct listenerActivator *activator, log_service_pt *service) {
-    celix_status_t status = CELIX_SUCCESS;
-
-    celixThreadMutex_lock(&activator->logServiceReferencesLock);
-
-    if (arrayList_size(activator->logServiceReferences) > 0) {
-        service_reference_pt reference = arrayList_get(activator->logServiceReferences, 0);
-        status = bundleContext_getService(activator->context, reference, (void *) service);
-    }
-    celixThreadMutex_unlock(&activator->logServiceReferencesLock);
-
-    return status;
-}
-
-static void* listenerExample_logger(void* data) {
-    struct listenerActivator *activator = data;
-
-    while (activator->running) {
-        log_service_pt logService = NULL;
-        listenerExample_getLogService(activator, &logService);
-        if (logService != NULL) {
-            (*(logService->log))(logService->logger, OSGI_LOGSERVICE_INFO, "ping");
-        } else {
-            listenerExample_alternativeLog(activator, "No LogService available. Printing to standard out.");
-        }
-
-        sleep(5);
-    }
-
-    return NULL;
-}
-
-celix_status_t listenerExample_alternativeLog(struct listenerActivator *activator, char *message) {
-    celix_status_t status = CELIX_SUCCESS;
-
-    printf("%s\n", message);
-
-    return status;
-}
-
diff --git a/examples/osgi-in-action/chapter04-correct-lookup/CMakeLists.txt b/examples/osgi-in-action/chapter04-correct-lookup/CMakeLists.txt
deleted file mode 100644
index abbb3cf..0000000
--- a/examples/osgi-in-action/chapter04-correct-lookup/CMakeLists.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-add_bundle(chapter04-correct-lookup VERSION 0.0.1 SOURCES private/src/activator)
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/log_service/public/include")
-target_link_libraries(chapter04-correct-lookup celix_framework)
diff --git a/examples/osgi-in-action/chapter04-correct-lookup/private/src/activator.c b/examples/osgi-in-action/chapter04-correct-lookup/private/src/activator.c
deleted file mode 100644
index 2ada02f..0000000
--- a/examples/osgi-in-action/chapter04-correct-lookup/private/src/activator.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * activator.c
- *
- *  \date       Sep 29, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-
-#include "bundle_activator.h"
-#include "log_service.h"
-
-typedef log_service_pt LOG_SERVICE;
-
-struct threadData {
-    char * service;
-    int threadId;
-    bundle_context_pt m_context;
-    bool running;
-};
-
-typedef struct threadData *thread_data_pt;
-
-static celix_thread_t m_logTestThread;
-
-//*******************************************************************************
-// function prototypes
-//*******************************************************************************
-void startTestThread(thread_data_pt data);
-void stopTestThread();
-void pauseTestThread();
-void alternativeLog(char *message, thread_data_pt data);
-//*******************************************************************************
-// global functions
-//*******************************************************************************
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
-    celix_status_t status = CELIX_SUCCESS;
-
-    *userData = calloc(1, sizeof(struct threadData));
-
-    if (!userData) {
-        status = CELIX_ENOMEM;
-    } else {
-        ((thread_data_pt) (*userData))->service = "chapter04-correct-lookup";
-        ((thread_data_pt) (*userData))->threadId = 0;
-        ((thread_data_pt) (*userData))->m_context = context;
-        ((thread_data_pt) (*userData))->running = false;
-    }
-
-    return status;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
-
-    thread_data_pt thread_data = (thread_data_pt) userData;
-
-    thread_data->m_context = context;
-    thread_data->running = true;
-
-    startTestThread(thread_data);
-
-    return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
-
-    thread_data_pt thread_data = (thread_data_pt) userData;
-
-    thread_data->running = false;
-
-    stopTestThread();
-
-    return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
-
-    free(userData);
-
-    return CELIX_SUCCESS;
-}
-
-//------------------------------------------------------------------------------------------
-//  The rest of this is just support code, not meant to show any particular best practices
-//------------------------------------------------------------------------------------------
-
-// Test LogService by periodically sending a message
-
-static void* LogServiceTest(void* argument) {
-    celix_status_t status = CELIX_SUCCESS;
-    thread_data_pt data = (thread_data_pt) argument;
-    bundle_context_pt m_context = data ->m_context;
-
-    while (data->running == true) {
-        service_reference_pt logServiceRef = NULL;
-        // lookup the current "best" LogService each time, just before we need to use it
-        status = bundleContext_getServiceReference(m_context, (char *) OSGI_LOGSERVICE_NAME, &logServiceRef);
-        // if the service reference is null then we know there's no log service available
-        if (status == CELIX_SUCCESS && logServiceRef != NULL) {
-            void *log = NULL;
-            LOG_SERVICE logService = NULL;
-            bundleContext_getService(m_context, logServiceRef, &log);
-            logService = (LOG_SERVICE) log;
-            // if the dereferenced instance is null then we know the service has been removed
-            if (logService != NULL) {
-                (*(logService->log))(logService->logger, OSGI_LOGSERVICE_INFO, "ping");
-            } else {
-                alternativeLog("LogService has gone", data);
-            }
-        } else {
-            alternativeLog("LogService has gone", data);
-        }
-        pauseTestThread();
-    }
-
-    return NULL;
-}
-
-void startTestThread(thread_data_pt data) {
-    // start separate worker thread to run the actual tests, managed by the bundle lifecycle
-    data->threadId++;
-
-    celixThread_create(&m_logTestThread, NULL, LogServiceTest, data);
-}
-
-void stopTestThread() {
-    celixThread_join(m_logTestThread, NULL);
-}
-
-void pauseTestThread() {
-    // sleep for a bit
-    sleep(5);
-}
-
-void alternativeLog(char *message, thread_data_pt data) {
-    // this provides similar style debug logging output for when the LogService disappears
-    celix_status_t status = CELIX_SUCCESS;
-    bundle_pt bundle = NULL;
-    char tid[20], bid[20];
-    long bundleId;
-    if (data->m_context != NULL) {
-        status = bundleContext_getBundle(data->m_context, &bundle);
-        if (status == CELIX_SUCCESS) {
-            status = bundle_getBundleId(bundle, &bundleId);
-            if (status == CELIX_SUCCESS) {
-                sprintf(tid, "thread=%d", data->threadId);
-                sprintf(bid, "bundle=%ld", bundleId);
-                printf("<--> %s, %s : %s\n", tid, bid, message);
-            } else {
-                printf("%s:%s:%d:getBundleId failed:  %s\n", __FILE__, __FUNCTION__, __LINE__, message);
-            }
-        } else {
-            printf("%s:%s:%d:getBundle failed: %s\n", __FILE__, __FUNCTION__, __LINE__, message);
-        }
-    } else {
-        printf("%s:%s:%d:bundle context NULL:  %s\n", __FILE__, __FUNCTION__, __LINE__, message);
-    }
-}
diff --git a/examples/osgi-in-action/chapter04-paint-example/CMakeLists.txt b/examples/osgi-in-action/chapter04-paint-example/CMakeLists.txt
deleted file mode 100644
index 23537c3..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/CMakeLists.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-if(NOT ${WITH_APR})
-	message(FATAL_ERROR "Paint example requires APR, enable WITH_APR option.")
-endif()
-find_package(PkgConfig)
-if(PKG_CONFIG_EXECUTABLE)
-	add_subdirectory(circle)
-	add_subdirectory(paint)
-	add_subdirectory(square)
-	add_subdirectory(triangle)
-
-	add_deploy("chapter04-paint-example" BUNDLES chapter04-paint-example circle square triangle shell shell_tui log_service log_writer)
-else(PKG_CONFIG_EXECUTABLE)
-	MESSAGE("No GTK found, not building the Paint Example")	
-endif(PKG_CONFIG_EXECUTABLE)
\ No newline at end of file
diff --git a/examples/osgi-in-action/chapter04-paint-example/circle/CMakeLists.txt b/examples/osgi-in-action/chapter04-paint-example/circle/CMakeLists.txt
deleted file mode 100644
index 5769ac9..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/circle/CMakeLists.txt
+++ /dev/null
@@ -1,46 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-INCLUDE(FindPkgConfig)
-pkg_search_module (GLIB  REQUIRED glib-2.0)
-pkg_search_module (GTHR  REQUIRED gthread-2.0)
-pkg_search_module (GTK   REQUIRED gtk+-2.0)
-include_directories(
-	private/include
-	../simple/public/include
-)
-include_directories(${GTK_INCLUDE_DIRS})
-include_directories(${GLIB_INCLUDE_DIRS})
-include_directories(${GTHR_INCLUDE_DIRS})
-
-link_directories(${GTK_LIBRARY_DIRS})
-link_directories(${GLIB_LIBRARY_DIRS})
-link_directories(${GTHR_LIBRARY_DIRS})
-
-add_bundle(circle VERSION 0.0.1 SOURCES
- 	private/src/activator
- 	private/src/circle_shape
-    
-    private/include/circle_shape.h
- FILES
- 	private/src/circle.png
-)
-
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/log_service/public/include")
-target_link_libraries(circle celix_framework ${GLIB_LIBRARIES} ${GTK_LIBRARIES} ${GTHR_LIBRARIES})
-
diff --git a/examples/osgi-in-action/chapter04-paint-example/circle/private/include/circle_shape.h b/examples/osgi-in-action/chapter04-paint-example/circle/private/include/circle_shape.h
deleted file mode 100644
index e16c57d..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/circle/private/include/circle_shape.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * circle_shape.h
- *
- *  \date       Aug 22, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#ifndef CIRCLE_SHAPE_H_
-#define CIRCLE_SHAPE_H_
-
-#include "celix_errno.h"
-
-celix_status_t circleShape_create(bundle_context_pt context, simple_shape_pt *shape);
-
-#endif /* CIRCLE_SHAPE_H_ */
diff --git a/examples/osgi-in-action/chapter04-paint-example/circle/private/src/activator.c b/examples/osgi-in-action/chapter04-paint-example/circle/private/src/activator.c
deleted file mode 100644
index a99396f..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/circle/private/src/activator.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * activator.c
- *
- *  \date       Aug 22, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include <stdio.h>
-#include <apr_general.h>
-#include <glib.h>
-#include <gtk/gtk.h>
-#include <gdk/gdk.h>
-
-#include "service_registration.h"
-#include "bundle_activator.h"
-#include "bundle_context.h"
-#include "simple_shape.h"
-#include "circle_shape.h"
-#include "simple_shape.h"
-
-struct activator {
-	service_registration_pt reg;
-	apr_pool_t *pool;
-};
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
-	apr_pool_t *pool;
-	struct activator *activator;
-	celix_status_t status = bundleContext_getMemoryPool(context, &pool);
-	if (status == CELIX_SUCCESS) {
-		*userData = apr_palloc(pool, sizeof(struct activator));
-		activator = *userData;
-		activator->reg = NULL;
-		activator->pool = pool;
-	}
-	return status;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt ctx) {
-	struct activator * act = (struct activator *) userData;
-	celix_status_t status = CELIX_SUCCESS;
-	simple_shape_pt es = NULL;
-	properties_pt props = NULL;
-
-	circleShape_create(ctx, &es);
-	props = properties_create();
-	properties_set(props, "name", "circle");
-    status = bundleContext_registerService(ctx, SIMPLE_SHAPE_SERVICE_NAME, es, props, &act->reg);
-	return status;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
-	celix_status_t status = CELIX_SUCCESS;
-	struct activator * act = (struct activator *) userData;
-
-	status = serviceRegistration_unregister(act->reg);
-
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
-	return CELIX_SUCCESS;
-}
diff --git a/examples/osgi-in-action/chapter04-paint-example/circle/private/src/circle.png b/examples/osgi-in-action/chapter04-paint-example/circle/private/src/circle.png
deleted file mode 100644
index 3d4887e..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/circle/private/src/circle.png
+++ /dev/null
Binary files differ
diff --git a/examples/osgi-in-action/chapter04-paint-example/circle/private/src/circle_shape.c b/examples/osgi-in-action/chapter04-paint-example/circle/private/src/circle_shape.c
deleted file mode 100644
index 5104b5f..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/circle/private/src/circle_shape.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * circle_shape.c
- *
- *  \date       Aug 22, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdio.h>
-#include <string.h>
-#include <celixbool.h>
-#include <stdlib.h>
-#include <glib.h>
-#include <gtk/gtk.h>
-#include <gdk/gdk.h>
-#include "bundle_context.h"
-#include "bundle.h"
-#include "hash_map.h"
-#include "simple_shape.h"
-#include "circle_shape.h"
-
-#define CIRCLE_FILE "circle.png"
-
-void circleShape_draw(simple_shape_pt shape, GdkPixmap *pixMap, GtkWidget *widget, gdouble x, gdouble y);
-
-celix_status_t circleShape_create(bundle_context_pt context, simple_shape_pt *shape) {
-	celix_status_t status = CELIX_SUCCESS;
-
-	bundle_pt bundle;
-	apr_pool_t *pool;
-
-	if (*shape != NULL || context == NULL) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	} else {
-		status = bundleContext_getBundle(context, &bundle);
-		if (status == CELIX_SUCCESS) {
-			status = bundleContext_getMemoryPool(context, &pool);
-			if (status == CELIX_SUCCESS) {
-				*shape = (simple_shape_pt) apr_palloc(pool, sizeof(**shape));
-				if (!*shape) {
-					status = CELIX_ENOMEM;
-				} else {
-					celix_status_t status = CELIX_SUCCESS;
-					(*shape)->name = "Circle";
-					(*shape)->icon_path = NULL;
-					status = bundle_getEntry(bundle, CIRCLE_FILE, pool, &(*shape)->icon_path);
-					if (status == CELIX_SUCCESS) {
-						(*shape)->simpleShape_draw = circleShape_draw;
-					} else {
-						printf("Could not find resource %s\n", CIRCLE_FILE);
-					}
-				}
-			}
-		}
-	}
-	return status;
-}
-
-void circleShape_draw(simple_shape_pt shape, GdkPixmap *pixMap, GtkWidget *widget, gdouble x, gdouble y){
-	GdkRectangle update_rect;
-	GError *gerror = NULL;
-	gsize rd = 0, wr = 0;
-	if (shape->icon_path == NULL) {
-		printf("error message: icon path unknown\n");
-	} else {
-		gchar *gfn = g_locale_to_utf8(shape->icon_path, strlen(shape->icon_path), &rd, &wr, &gerror);
-		GdkPixbuf*curr_pix_buf = gdk_pixbuf_new_from_file(gfn, &gerror);
-		if(!curr_pix_buf) {
-			g_printerr("error message: %s\n", (gchar *) gerror->message);
-		}
-		update_rect.x = x - 5;
-		update_rect.y = y - 5;
-		update_rect.width = gdk_pixbuf_get_width(curr_pix_buf);
-		update_rect.height = gdk_pixbuf_get_height(curr_pix_buf);
-		gdk_pixbuf_render_to_drawable(
-				curr_pix_buf,
-				pixMap,
-				gtk_widget_get_style(widget)->fg_gc[gtk_widget_get_state(widget)],
-				0, 0,
-				update_rect.x, update_rect.y,
-				update_rect.width,
-				update_rect.height,
-				GDK_RGB_DITHER_NONE,
-				0, 0);
-		gtk_widget_queue_draw_area (widget,
-				update_rect.x, update_rect.y,
-				update_rect.width, update_rect.height);
-	}
-}
-
-
-
diff --git a/examples/osgi-in-action/chapter04-paint-example/paint/CMakeLists.txt b/examples/osgi-in-action/chapter04-paint-example/paint/CMakeLists.txt
deleted file mode 100644
index 6caa87f..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/paint/CMakeLists.txt
+++ /dev/null
@@ -1,53 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-INCLUDE(FindPkgConfig)
-pkg_search_module (GLIB  REQUIRED glib-2.0)
-pkg_search_module (GTHR  REQUIRED gthread-2.0)
-pkg_search_module (GTK   REQUIRED gtk+-2.0)
-pkg_search_module (GMODULE   REQUIRED gmodule-2.0)
-include_directories(
-	private/include
-	../simple/public/include
-)
-
-include_directories(${GTK_INCLUDE_DIRS})
-include_directories(${GLIB_INCLUDE_DIRS})
-include_directories(${GTHR_INCLUDE_DIRS})
-include_directories(${GMODULE_INCLUDE_DIRS})
-
-link_directories(${GTK_LIBRARY_DIRS})
-link_directories(${GLIB_LIBRARY_DIRS})
-link_directories(${GTHR_LIBRARY_DIRS})
-link_directories(${GMODULE_LIBRARY_DIRS})
-
-add_bundle(chapter04-paint-example  VERSION 0.0.1 SOURCES
-	private/src/activator
-	private/src/default_shape
-	private/src/shape_component
-	private/src/paint_frame
-    
-    private/include/default_shape.h
-    private/include/paint_frame.h
-    private/include/shape_component.h
-  FILES
-  	private/src/underc.png gtktest.glade
-)
-
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/log_service/public/include")
-target_link_libraries(chapter04-paint-example celix_framework ${MODULE_LIBRARIES} ${GLIB_LIBRARIES} ${GTK_LIBRARIES} ${GTHR_LIBRARIES})
diff --git a/examples/osgi-in-action/chapter04-paint-example/paint/gtktest.glade b/examples/osgi-in-action/chapter04-paint-example/paint/gtktest.glade
deleted file mode 100644
index 9a5e7d5..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/paint/gtktest.glade
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
--->
-<interface>
-  <requires lib="gtk+" version="2.24"/>
-  <!-- interface-naming-policy project-wide -->
-  <object class="GtkWindow" id="window1">
-    <property name="width_request">600</property>
-    <property name="height_request">400</property>
-    <property name="can_focus">False</property>
-    <signal name="destroy" handler="on_window1_destroy" swapped="no"/>
-    <child>
-      <object class="GtkVBox" id="vbox1">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <child>
-          <object class="GtkToolbar" id="toolbar1">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkDrawingArea" id="drawingarea1">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="events">GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_STRUCTURE_MASK</property>
-            <signal name="button-press-event" handler="newFrame_mousePressed" after="yes" swapped="no"/>
-          </object>
-          <packing>
-            <property name="expand">True</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-      </object>
-    </child>
-  </object>
-</interface>
diff --git a/examples/osgi-in-action/chapter04-paint-example/paint/private/include/paint_frame.h b/examples/osgi-in-action/chapter04-paint-example/paint/private/include/paint_frame.h
deleted file mode 100644
index df3c73c..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/paint/private/include/paint_frame.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * paint_frame.h
- *
- *  \date       Aug 22, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-#ifndef PAINT_FRAME_H_
-#define PAINT_FRAME_H_
-
-#define PAINT_FRAME_SERVICE_NAME "paint"
-
-struct paint_frame {
-	apr_pool_t *pool;
-	GtkWidget *window;
-	GtkWidget *drawingArea;
-	GtkWidget *toolbar;
-	GdkPixmap *pixMap;
-	bool showing;
-
-	char *m_selected;
-	hash_map_pt m_shapes;
-	simple_shape_pt m_defaultShape;
-	linked_list_pt m_shapeComponents;
-	bundle_context_pt context;
-	GThread *main;
-	char *file;
-};
-
-
-typedef struct paint_frame *paint_frame_pt;
-celix_status_t paintFrame_create(bundle_context_pt context, apr_pool_t *pool, paint_frame_pt *frame);
-celix_status_t paintFrame_exit(paint_frame_pt frame);
-
-simple_shape_pt paintFrame_getShape(paint_frame_pt frame, char *name);
-celix_status_t paintFrame_addShape(paint_frame_pt frame, bundle_context_pt context, simple_shape_pt shape);
-celix_status_t paintFrame_removeShape(paint_frame_pt frame, simple_shape_pt sshape);
-
-
-#endif /* PAINT_FRAME_H_ */
diff --git a/examples/osgi-in-action/chapter04-paint-example/paint/private/include/shape_component.h b/examples/osgi-in-action/chapter04-paint-example/paint/private/include/shape_component.h
deleted file mode 100644
index 782467d..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/paint/private/include/shape_component.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * shape_component.h
- *
- *  \date       Aug 22, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-#ifndef SHAPE_COMPONENT_H_
-#define SHAPE_COMPONENT_H_
-
-#include "paint_frame.h"
-
-typedef struct shape_component *shape_component_pt;
-
-struct shape_component {
-	char *shapeName;
-	paint_frame_pt m_frame;
-	gdouble x, y, w, h;
-	void (*shapeComponent_paintComponent)(shape_component_pt shapeComponent, paint_frame_pt frame,
-			GdkPixmap *pixMap, GtkWidget *widget);
-};
-
-extern shape_component_pt shapeComponent_create(paint_frame_pt frame, simple_shape_pt sshape,
-		gdouble x, gdouble y);
-
-#endif /* SHAPE_COMPONENT_H_ */
diff --git a/examples/osgi-in-action/chapter04-paint-example/paint/private/src/activator.c b/examples/osgi-in-action/chapter04-paint-example/paint/private/src/activator.c
deleted file mode 100644
index f82b572..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/paint/private/src/activator.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * activator.c
- *
- *  \date       Aug 22, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include <stdio.h>
-#include <apr_general.h>
-#include <glib.h>
-#include <gtk/gtk.h>
-#include <gdk/gdk.h>
-
-#include "bundle_activator.h"
-#include "bundle_context.h"
-#include "simple_shape.h"
-#include "paint_frame.h"
-#include "service_tracker.h"
-#include "service_reference.h"
-#include "service_registration.h"
-
-struct paintFrameActivatorData {
-	service_registration_pt reg;
-	apr_pool_t *pool;
-	service_tracker_pt tracker;
-	bundle_context_pt context;
-	paint_frame_pt paint_frame;
-};
-celix_status_t addingServ(void * handle, service_reference_pt ref, void **service);
-celix_status_t addedServ(void * handle, service_reference_pt reference, void * service);
-celix_status_t modifiedServ(void * handle, service_reference_pt reference, void * service);
-celix_status_t removedServ(void * handle, service_reference_pt reference, void * service);
-
-typedef struct paintFrameActivatorData *greeting_activator_pt;
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
-	celix_status_t status = CELIX_SUCCESS;
-	apr_pool_t *pool;
-	greeting_activator_pt activator;
-	service_tracker_customizer_pt cust = NULL;
-	printf("Paint_frame create\n");
-	status = bundleContext_getMemoryPool(context, &pool);
-	if (status == CELIX_SUCCESS) {
-		*userData = apr_palloc(pool, sizeof(struct paintFrameActivatorData));
-		activator = *userData;
-		activator->reg = NULL;
-		activator->pool = pool;
-		activator->context = context;
-		activator->paint_frame = NULL;
-		activator->tracker = NULL;
-		status = paintFrame_create(context, pool, &activator->paint_frame);
-
-		serviceTrackerCustomizer_create(pool, activator, addingServ,
-				addedServ, modifiedServ, removedServ, &cust);
-
-        serviceTracker_create(pool, context, SIMPLE_SHAPE_SERVICE_NAME, cust, &activator->tracker);
-		serviceTracker_open(activator->tracker);
-
-	}
-	return status;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt ctx) {
-	struct paintFrameActivatorData * act = (struct paintFrameActivatorData *) userData;
-	celix_status_t status = CELIX_SUCCESS;
-	return status;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
-	struct paintFrameActivatorData * act = (struct paintFrameActivatorData *) userData;
-	serviceTracker_close(act->tracker);
-	paintFrame_exit(act->paint_frame);
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
-	struct paintFrameActivatorData * act = (struct paintFrameActivatorData *) userData;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t addingServ(void * handle, service_reference_pt ref, void **service) {
-	struct paintFrameActivatorData * data = (struct paintFrameActivatorData *) handle;
-    bundleContext_getService(data->context, ref, service);
-    return CELIX_SUCCESS;
-}
-
-celix_status_t addedServ(void * handle, service_reference_pt ref, void * service) {
-	struct paintFrameActivatorData * data = (struct paintFrameActivatorData *) handle;
-	service_registration_pt reg = NULL;
-	properties_pt props = NULL;
-	char * serviceName = NULL;
-	serviceReference_getServiceRegistration(ref, &reg);
-	serviceRegistration_getProperties(reg, &props);
-	serviceName = properties_get(props, "name");
-	paintFrame_addShape(data->paint_frame, data->context, service);
-	return CELIX_SUCCESS;
- }
-
-celix_status_t modifiedServ(void * handle, service_reference_pt ref, void * service) {
-	struct paintFrameActivatorData * data = (struct paintFrameActivatorData *) handle;
-	service_registration_pt reg = NULL;
-	properties_pt props = NULL;
-	char * serviceName = NULL;
-	serviceReference_getServiceRegistration(ref, &reg);
-	serviceRegistration_getProperties(reg, &props);
-	serviceName = properties_get(props, "name");
-	return CELIX_SUCCESS;
-}
-
-celix_status_t removedServ(void * handle, service_reference_pt ref, void * service) {
-	struct paintFrameActivatorData * data = (struct paintFrameActivatorData *) handle;
-	service_registration_pt reg = NULL;
-	properties_pt props = NULL;
-	char * serviceName = NULL;
-	serviceReference_getServiceRegistration(ref, &reg);
-	serviceRegistration_getProperties(reg, &props);
-	serviceName = properties_get(props, "name");
-	paintFrame_removeShape(data->paint_frame, service);
-	return CELIX_SUCCESS;
-}
diff --git a/examples/osgi-in-action/chapter04-paint-example/paint/private/src/default_shape.c b/examples/osgi-in-action/chapter04-paint-example/paint/private/src/default_shape.c
deleted file mode 100644
index e3d45b5..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/paint/private/src/default_shape.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * default_shape.c
- *
- *  \date       Aug 22, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-
-#include <stdio.h>
-#include <string.h>
-#include <celixbool.h>
-#include <stdlib.h>
-#include <glib.h>
-#include <gtk/gtk.h>
-#include <gdk/gdk.h>
-#include "bundle_context.h"
-#include "bundle.h"
-#include "hash_map.h"
-#include "simple_shape.h"
-#include "default_shape.h"
-#define DEFAULT_FILE "underc.png"
-
-void defaultShape_draw(simple_shape_pt shape, GdkPixmap *pixMap, GtkWidget *widget, gdouble x, gdouble y);
-
-simple_shape_pt defaultShape_create(bundle_context_pt context) {
-	celix_status_t status = CELIX_SUCCESS;
-	bundle_pt bundle;
-	apr_pool_t *pool;
-	simple_shape_pt shape = (simple_shape_pt) malloc(sizeof(*shape));
-	bundleContext_getBundle(context, &bundle);
-	bundleContext_getMemoryPool(context, &pool);
-	shape->icon_path = NULL;
-	status = bundle_getEntry(bundle, DEFAULT_FILE, pool, &shape->icon_path);
-	shape->simpleShape_draw = defaultShape_draw;
-	if (status == CELIX_SUCCESS){
-		// no error
-	} else {
-		printf("Could not find resource %s\n", DEFAULT_FILE);
-	}
-	return shape;
-}
-
-void defaultShape_draw(simple_shape_pt shape, GdkPixmap *pixMap, GtkWidget *widget, gdouble x, gdouble y){
-	GdkRectangle update_rect;
-	GdkPixbuf *curr_pix_buf;
-	GError *gerror = NULL;
-	gsize rd = 0, wr = 0;
-	if (shape->icon_path == NULL) {
-		printf("error message: icon path unknown\n");
-	} else {
-		gchar *gfn = g_locale_to_utf8(shape->icon_path, strlen(shape->icon_path), &rd, &wr, &gerror);
-		curr_pix_buf = gdk_pixbuf_new_from_file(gfn, &gerror);
-		if(!curr_pix_buf) {
-			g_printerr("error message: %s\n", (gchar *) gerror->message);
-		}
-		update_rect.x = x - 5;
-		update_rect.y = y - 5;
-		update_rect.width = gdk_pixbuf_get_width(curr_pix_buf);
-		update_rect.height = gdk_pixbuf_get_height(curr_pix_buf);
-		gdk_pixbuf_render_to_drawable(
-				curr_pix_buf,
-				pixMap,
-				gtk_widget_get_style(widget)->fg_gc[gtk_widget_get_state(widget)],
-				0, 0,
-				update_rect.x, update_rect.y,
-				update_rect.width,
-				update_rect.height,
-				GDK_RGB_DITHER_NONE,
-				0, 0);
-		gtk_widget_queue_draw_area (widget,
-				update_rect.x, update_rect.y,
-				update_rect.width, update_rect.height);
-	}
-}
-
-
-
diff --git a/examples/osgi-in-action/chapter04-paint-example/paint/private/src/paint_frame.c b/examples/osgi-in-action/chapter04-paint-example/paint/private/src/paint_frame.c
deleted file mode 100644
index 1c56311..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/paint/private/src/paint_frame.c
+++ /dev/null
@@ -1,363 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * paint_frame.c
- *
- *  \date       Aug 22, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-
-/*
- * This class represents the main application class, which is a JFrame subclass
- * that manages a toolbar of shapes and a drawing canvas. This class does not
- * directly interact with the underlying OSGi framework; instead, it is injected
- * with the available <tt>SimpleShape</tt> instances to eliminate any
- * dependencies on the OSGi application programming interfaces.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <gtk/gtk.h>
-#include <string.h>
-#include <celixbool.h>
-#include <glib.h>
-#include <gdk/gdk.h>
-#include "bundle_context.h"
-#include "bundle.h"
-#include "utils.h"
-#include "hash_map.h"
-#include "simple_shape.h"
-#include "linked_list_iterator.h"
-#include "linked_list.h"
-#include "paint_frame.h"
-#include "shape_component.h"
-#include "default_shape.h"
-#include "celix_errno.h"
-
-static paint_frame_pt this = NULL;
-
-struct shape_info {
-	char *name;
-	simple_shape_pt shape;
-	GtkWidget *button;
-};
-
-typedef struct shape_info *shape_info_pt;
-static celix_status_t paintFrame_redraw(paint_frame_pt frame, GdkModifierType state);
-static celix_status_t paintFrame_show(paint_frame_pt frame);
-static void paintFrame_destroy(GtkWidget *widget, gpointer data);
-static void paintFrame_expose(GtkWidget *widget, GdkEventExpose *event, gpointer data);
-static void paintFrame_configure(GtkWidget *widget, GdkEventConfigure *event, gpointer data);
-static void paintFrame_buttonClicked(GtkWidget *button, gpointer data);
-static gboolean paintFrame_mousePressed( GtkWidget *widget, GdkEventButton *event, gpointer data);
-static gpointer paintFrame_gtkmain(gpointer a_data);
-static void paintFrame_destroyWidgets(paint_frame_pt frame);
-
-/**
- * Default constructor that populates the main window.
- **/
-celix_status_t paintFrame_create(bundle_context_pt context, apr_pool_t *pool, paint_frame_pt *frame) {
-	celix_status_t status = CELIX_SUCCESS;
-	apr_pool_t *mypool = NULL;
-	apr_pool_create(&mypool, pool);
-	this = malloc(sizeof(*this));
-	if (!this) {
-		this = NULL;
-		status = CELIX_ENOMEM;
-	} else {
-		char *builderFile;
-		bundle_pt bundle;
-		GError *error = NULL;
-		*frame = this;
-		
-
-		(*frame)->showing = false;
-		(*frame)->pool = mypool;
-		(*frame)->pixMap = NULL;
-		(*frame)->m_selected = NULL;
-		(*frame)->context = context;
-		(*frame)->m_shapes = hashMap_create(utils_stringHash, NULL, utils_stringEquals, NULL);
-		(*frame)->m_defaultShape = defaultShape_create((*frame)->context);
-		linkedList_create((*frame)->pool, &(*frame)->m_shapeComponents);
-
-
-		status = bundleContext_getBundle(context, &bundle);
-		if (status == CELIX_SUCCESS) {
-			status = bundle_getEntry(bundle, "gtktest.glade", mypool, &builderFile);
-			if (status == CELIX_SUCCESS) {
-				(*frame)->file = builderFile;
-
-				gdk_threads_init();
-				gtk_init(NULL, NULL);
-
-				if( g_thread_supported()) {
-					// (*frame)->main = g_thread_new("main", paintFrame_gtkmain, (*frame));
-					(*frame)->main = g_thread_create(paintFrame_gtkmain, (*frame), TRUE, &error);
-					if ((*frame)->main == NULL){
-						g_printerr ("Failed to create thread: %s\n", error->message);
-						status = CELIX_BUNDLE_EXCEPTION;
-					}
-				} else {
-					g_printerr("g_thread NOT supported\n");
-				}
-			}
-		}
-	}
-
-	return status;
-}
-
-celix_status_t paintFrame_exit(paint_frame_pt frame) {
-	frame->showing = false;
-
-	paintFrame_destroyWidgets(frame);
-
-	gdk_threads_enter();
-
-	gtk_main_quit();
-
-	gdk_threads_leave();
-
-	g_thread_join(frame->main);
-
-	return CELIX_SUCCESS;
-}
-
-static celix_status_t shapeInfo_create(paint_frame_pt frame, char* name, GtkWidget *button, simple_shape_pt shape, shape_info_pt *info){
-	*info = malloc(sizeof(**info));
-	(*info)->shape = shape;
-	(*info)->name = name;
-	(*info)->button = button;
-	return CELIX_SUCCESS;
-}
-static celix_status_t paintFrame_show(paint_frame_pt frame) {
-	gtk_widget_show(frame->drawingArea);
-	gtk_widget_show(frame->toolbar);
-	gtk_widget_show(frame->window);
-
-	return CELIX_SUCCESS;
-}
-
-/**
- * Injects an available <tt>SimpleShape</tt> into the drawing frame.
- *
- * @param name The name of the injected <tt>SimpleShape</tt>.
- * @param icon The icon associated with the injected <tt>SimpleShape</tt>.
- * @param shape The injected <tt>SimpleShape</tt> instance.
- **/
-celix_status_t paintFrame_addShape(paint_frame_pt frame, bundle_context_pt context, simple_shape_pt shape) {
-	celix_status_t status = CELIX_SUCCESS;
-	GError *gerror = NULL;
-	GtkWidget *button = NULL;
-	GtkWidget *im = NULL;
-
-	gdk_threads_enter();
-	
-	button = gtk_button_new();
-	gtk_widget_set_name((GtkWidget *) button, shape->name);
-	im = gtk_image_new_from_file(shape->icon_path);
-	gtk_button_set_image((GtkButton *) button, im);
-	gtk_toolbar_append_widget((GtkToolbar *) frame->toolbar, (GtkWidget *) button, "", "");
-	g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (paintFrame_buttonClicked), frame);
-	gtk_widget_show(button);
-	if (hashMap_get(frame->m_shapes, shape->name) == NULL) {
-		shape_info_pt info = NULL;
-		shapeInfo_create(frame, shape->name, button, shape, &info);
-		hashMap_put(frame->m_shapes, shape->name, info);
-	}
-	paintFrame_redraw(frame, 0);
-	paintFrame_show(frame);
-	gdk_threads_leave();
-
-	return status;
-}
-
-/**
- * Removes a no longer available <tt>SimpleShape</tt> from the drawing frame.
- *
- * @param name The name of the <tt>SimpleShape</tt> to remove.
- **/
-celix_status_t paintFrame_removeShape(paint_frame_pt frame, simple_shape_pt sshape) {
-	celix_status_t status = CELIX_SUCCESS;
-	shape_info_pt shape = NULL;
-	gdk_threads_enter();
-	shape = (shape_info_pt) hashMap_remove(this->m_shapes, sshape->name);
-	if (shape != NULL) {
-		this->m_selected = NULL;
-		gtk_widget_destroy(GTK_WIDGET(shape->button));
-		gtk_widget_show_all(this->toolbar);
-		paintFrame_redraw(this, 0);
-		paintFrame_show(this);
-	}
-	gdk_threads_leave();
-
-	return status;
-}
-
-/**
- * Retrieves the available <tt>SimpleShape</tt> associated with the given
- * name.
- *
- * @param name The name of the <tt>SimpleShape</tt> to retrieve.
- * @return The corresponding <tt>SimpleShape</tt> instance if available or
- *         <tt>null</tt>.
- **/
-simple_shape_pt paintFrame_getShape(paint_frame_pt frame, char *name) {
-	shape_info_pt info = (shape_info_pt) hashMap_get(frame->m_shapes, name);
-	if (info == NULL) {
-		return frame->m_defaultShape;
-	} else {
-		return info->shape;
-	}
-}
-
-static void paintFrame_destroy(GtkWidget *widget, gpointer data) {
-	paint_frame_pt frame = data;
-	bundle_pt bundle = NULL;
-
-	frame->showing = false;
-
-//	bundleContext_getBundleById(frame->context, 0, &bundle);
-//	bundle_stop(bundle, 0);
-}
-
-static void paintFrame_destroyWidgets(paint_frame_pt frame) {
-	gdk_threads_enter();
-
-	if (frame->pixMap != NULL) {
-		gdk_pixmap_unref(frame->pixMap);
-	}
-	if (frame->toolbar != NULL) {
-		gtk_widget_destroy(frame->toolbar);
-	}
-	if (frame->drawingArea != NULL) {
-		gtk_widget_destroy(frame->drawingArea);
-	}
-	if (frame->window != NULL) {
-		gtk_widget_destroy(frame->window);
-	}
-
-	frame->pixMap = NULL;
-	frame->toolbar = NULL;
-	frame->window = NULL;
-	frame->drawingArea = NULL;
-
-	gdk_threads_leave();
-}
-
-static void paintFrame_configure(GtkWidget *widget, GdkEventConfigure *event, gpointer data) {
-	paint_frame_pt frame = data;
-	GtkAllocation allocation;
-
-	if (frame->pixMap != NULL) {
-		gdk_pixmap_unref(frame->pixMap);
-	}
-
-	gtk_widget_get_allocation(widget, &allocation);
-	frame->pixMap = gdk_pixmap_new(gtk_widget_get_window(widget), allocation.width, allocation.height, -1);
-	paintFrame_redraw(frame, 0);
-}
-
-static void paintFrame_expose(GtkWidget *widget, GdkEventExpose *event, gpointer data) {
-	paint_frame_pt frame = data;
-	gdk_draw_pixmap(gtk_widget_get_window(widget),
-			gtk_widget_get_style(widget)->fg_gc[gtk_widget_get_state(widget)],
-			frame->pixMap, event->area.x, event->area.y, event->area.x,
-			event->area.y, event->area.width, event->area.height);
-}
-
-static void paintFrame_buttonClicked(GtkWidget *button, gpointer data) {
-	paint_frame_pt frame = data;
-	frame->m_selected = (char *) gtk_widget_get_name(button);
-}
-
-static gboolean paintFrame_mousePressed( GtkWidget *widget, GdkEventButton *event, gpointer data) {
-	paint_frame_pt frame = data;
-	if (event->button == 1 && frame->pixMap != NULL) {
-		if (frame->m_selected == NULL){
-			printf("no button selected yet\n");
-		} else {
-			shape_component_pt sc = shapeComponent_create(frame, paintFrame_getShape(frame, frame->m_selected), event->x, event->y);
-			linkedList_addFirst(frame->m_shapeComponents, sc);
-			(*sc->shapeComponent_paintComponent)(sc, frame, frame->pixMap, widget);
-		}
-	}
-	return TRUE;
-}
-
-static celix_status_t paintFrame_redraw(paint_frame_pt frame, GdkModifierType state) {
-	if (frame->pixMap != NULL && frame->showing) {
-		GdkRectangle update_rect;
-		GtkAllocation allocation;
-		linked_list_iterator_pt it = NULL;
-
-		update_rect.x = 0;
-		update_rect.y = 0;
-		gtk_widget_get_allocation(frame->drawingArea, &allocation);
-		update_rect.width = allocation.width;
-		update_rect.height = allocation.height;
-		gdk_draw_rectangle (this->pixMap,
-				gtk_widget_get_style(frame->drawingArea)->white_gc,
-				TRUE,
-				update_rect.x, update_rect.y,
-				update_rect.width, update_rect.height);
-		gtk_widget_draw(frame->drawingArea, &update_rect);
-		it = linkedListIterator_create(this->m_shapeComponents, 0);
-		while (linkedListIterator_hasNext(it)) {
-			shape_component_pt sc = linkedListIterator_next(it);
-			(*sc->shapeComponent_paintComponent)(sc, this, this->pixMap, frame->drawingArea);
-		}
-	}
-
-	return CELIX_SUCCESS;
-}
-
-static gpointer paintFrame_gtkmain(gpointer a_data) {
-	GtkBuilder *builder;
-	paint_frame_pt frame = (paint_frame_pt) a_data;
-
-	gdk_threads_enter();
-	builder = gtk_builder_new();
-	gtk_builder_add_from_file(builder, frame->file, NULL);
-
-	frame->window = GTK_WIDGET(gtk_builder_get_object (builder, "window1"));
-	frame->toolbar = GTK_WIDGET(gtk_builder_get_object (builder, "toolbar1"));
-	frame->drawingArea = GTK_WIDGET(gtk_builder_get_object (builder, "drawingarea1"));
-	g_object_unref(G_OBJECT(builder));
-
-	gtk_window_set_title(GTK_WINDOW(frame->window), "OSGi in Action, Paint-Example");
-
-	gtk_widget_set_events (frame->drawingArea, GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK);
-
-	g_signal_connect(G_OBJECT(frame->window), "destroy", G_CALLBACK(paintFrame_destroy), frame);
-	g_signal_connect(G_OBJECT(frame->drawingArea), "expose_event", G_CALLBACK(paintFrame_expose), frame);
-	g_signal_connect(G_OBJECT(frame->drawingArea), "configure_event", G_CALLBACK(paintFrame_configure), frame);
-	g_signal_connect(G_OBJECT(frame->drawingArea), "button_press_event", G_CALLBACK(paintFrame_mousePressed), frame);
-
-
-	paintFrame_show(frame);
-	frame->showing = true;
-
-	gtk_main();
-	gdk_threads_leave();
-
-	return NULL;
-}
diff --git a/examples/osgi-in-action/chapter04-paint-example/paint/private/src/shape_component.c b/examples/osgi-in-action/chapter04-paint-example/paint/private/src/shape_component.c
deleted file mode 100644
index db8d274..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/paint/private/src/shape_component.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * shape_component.c
- *
- *  \date       Aug 22, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdio.h>
-#include <stdio.h>
-#include <string.h>
-#include <celixbool.h>
-#include <stdlib.h>
-#include <glib.h>
-#include <gtk/gtk.h>
-#include <gdk/gdk.h>
-#include "bundle_context.h"
-#include "utils.h"
-#include "linked_list.h"
-#include "hash_map.h"
-#include "simple_shape.h"
-#include "shape_component.h"
-
-static const int BOX = 54;
-
-extern void shapeComponent_paintComponent(shape_component_pt shapeComponent, paint_frame_pt frame,
-		GdkPixmap *pixMap, GtkWidget *widget);
-
-shape_component_pt shapeComponent_create(paint_frame_pt frame, simple_shape_pt sshape,
-		gdouble x, gdouble y) {
-	shape_component_pt shape = malloc(sizeof(*shape));
-	shape->m_frame = frame;
-	shape->shapeName = strdup(sshape->name);
-	shape->x = x - BOX /2;
-	shape->y = y - BOX /2;
-	shape->w = BOX;
-	shape->h = BOX;
-	/* methods */
-	shape->shapeComponent_paintComponent = shapeComponent_paintComponent;
-	return shape;
-}
-
-void shapeComponent_paintComponent(shape_component_pt shapeComponent, paint_frame_pt frame,
-		GdkPixmap *pixMap, GtkWidget *widget) {
-	simple_shape_pt shape = paintFrame_getShape(frame, shapeComponent->shapeName);
-	if (shape == NULL) {
-		g_printerr("cannot find shape %s\n", shapeComponent->shapeName);
-	} else {
-		(*shape->simpleShape_draw)(shape, pixMap, widget,
-				shapeComponent->x, shapeComponent->y);
-	}
-}
diff --git a/examples/osgi-in-action/chapter04-paint-example/paint/private/src/underc.png b/examples/osgi-in-action/chapter04-paint-example/paint/private/src/underc.png
deleted file mode 100644
index 425cdb9..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/paint/private/src/underc.png
+++ /dev/null
Binary files differ
diff --git a/examples/osgi-in-action/chapter04-paint-example/simple/public/include/simple_shape.h b/examples/osgi-in-action/chapter04-paint-example/simple/public/include/simple_shape.h
deleted file mode 100644
index 6385b54..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/simple/public/include/simple_shape.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * simple_shape.h
- *
- *  \date       Aug 22, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#ifndef SIMPLE_SHAPE_H_
-#define SIMPLE_SHAPE_H_
-
-#include <gdk/gdk.h>
-
-struct simple_shape {
-	char *icon_path;
-	char *name;
-	void (*simpleShape_draw) (struct simple_shape *shape, GdkPixmap *pixMap, GtkWidget *widget, gdouble x, gdouble y);
-};
-
-typedef struct simple_shape *simple_shape_pt;
-
-#define SIMPLE_SHAPE_SERVICE_NAME "simple_shape"
-
-
-#endif /* SIMPLE_SHAPE_H_ */
diff --git a/examples/osgi-in-action/chapter04-paint-example/square/CMakeLists.txt b/examples/osgi-in-action/chapter04-paint-example/square/CMakeLists.txt
deleted file mode 100644
index df87ee4..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/square/CMakeLists.txt
+++ /dev/null
@@ -1,45 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-INCLUDE(FindPkgConfig)
-pkg_search_module (GLIB  REQUIRED glib-2.0)
-pkg_search_module (GTHR  REQUIRED gthread-2.0)
-pkg_search_module (GTK   REQUIRED gtk+-2.0)
-include_directories(
-	private/include
-	../simple/public/include
-)
-include_directories(${GTK_INCLUDE_DIRS})
-include_directories(${GLIB_INCLUDE_DIRS})
-include_directories(${GTHR_INCLUDE_DIRS})
-
-link_directories(${GTK_LIBRARY_DIRS})
-link_directories(${GLIB_LIBRARY_DIRS})
-link_directories(${GTHR_LIBRARY_DIRS})
-
-add_bundle(square  VERSION 0.0.1  SOURCES
- 	private/src/activator
- 	private/src/square_shape
-    
-    private/include/square_shape.h
- FILES 
- 	private/src/square.png
-)
-
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/log_service/public/include")
-target_link_libraries(square celix_framework ${GLIB_LIBRARIES} ${GTK_LIBRARIES} ${GTHR_LIBRARIES})
diff --git a/examples/osgi-in-action/chapter04-paint-example/square/private/include/square_shape.h b/examples/osgi-in-action/chapter04-paint-example/square/private/include/square_shape.h
deleted file mode 100644
index 35c4be1..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/square/private/include/square_shape.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * square_shape.h
- *
- *  \date       Aug 22, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#ifndef SQUARE_SHAPE_H_
-#define SQUARE_SHAPE_H_
-
-extern simple_shape_pt squareShape_create(bundle_context_pt context);
-
-#endif /* SQUARE_SHAPE_H_ */
diff --git a/examples/osgi-in-action/chapter04-paint-example/square/private/src/activator.c b/examples/osgi-in-action/chapter04-paint-example/square/private/src/activator.c
deleted file mode 100644
index 96ca227..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/square/private/src/activator.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * activator.c
- *
- *  \date       Aug 22, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include <stdio.h>
-#include <apr_general.h>
-#include <glib.h>
-#include <gtk/gtk.h>
-#include <gdk/gdk.h>
-
-#include "bundle_activator.h"
-#include "bundle_context.h"
-#include "simple_shape.h"
-#include "square_shape.h"
-#include "simple_shape.h"
-
-struct squareActivator {
-	service_registration_pt reg;
-	apr_pool_t *pool;
-};
-
-typedef struct squareActivator *greeting_activator_pt;
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
-	apr_pool_t *pool;
-	greeting_activator_pt activator;
-	celix_status_t status = bundleContext_getMemoryPool(context, &pool);
-	if (status == CELIX_SUCCESS) {
-		*userData = apr_palloc(pool, sizeof(struct squareActivator));
-		activator = *userData;
-		activator->reg = NULL;
-		activator->pool = pool;
-		printf("Square created\n");
-	}
-	return status;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt ctx) {
-	struct squareActivator * act = (struct squareActivator *) userData;
-	celix_status_t status = CELIX_SUCCESS;
-	simple_shape_pt es = squareShape_create(ctx);
-	properties_pt props = properties_create();
-	properties_set(props, "name", "square");
-    status = bundleContext_registerService(ctx, SIMPLE_SHAPE_SERVICE_NAME, es, props, &act->reg);
-	printf("Square start\n");
-	return status;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
-	return CELIX_SUCCESS;
-}
diff --git a/examples/osgi-in-action/chapter04-paint-example/square/private/src/square.png b/examples/osgi-in-action/chapter04-paint-example/square/private/src/square.png
deleted file mode 100644
index 3f24cfc..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/square/private/src/square.png
+++ /dev/null
Binary files differ
diff --git a/examples/osgi-in-action/chapter04-paint-example/square/private/src/square_shape.c b/examples/osgi-in-action/chapter04-paint-example/square/private/src/square_shape.c
deleted file mode 100644
index 41c6e83..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/square/private/src/square_shape.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * square_shape.c
- *
- *  \date       Aug 22, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdio.h>
-#include <string.h>
-#include <celixbool.h>
-#include <stdlib.h>
-#include <glib.h>
-#include <gtk/gtk.h>
-#include <gdk/gdk.h>
-#include "bundle_context.h"
-#include "bundle.h"
-#include "hash_map.h"
-#include "simple_shape.h"
-#include "square_shape.h"
-#define SQUARE_FILE "square.png"
-
-void squareShape_draw(simple_shape_pt shape, GdkPixmap *pixMap, GtkWidget *widget, gdouble x, gdouble y);
-
-simple_shape_pt squareShape_create(bundle_context_pt context) {
-	bundle_pt bundle;
-	apr_pool_t *pool;
-	simple_shape_pt shape = (simple_shape_pt) malloc(sizeof(*shape));
-	celix_status_t status = CELIX_SUCCESS;
-	bundleContext_getBundle(context, &bundle);
-	bundleContext_getMemoryPool(context, &pool);
-	shape->name = "Square";
-	shape->icon_path = NULL;
-	status = bundle_getEntry(bundle, SQUARE_FILE, pool, &shape->icon_path);
-	shape->simpleShape_draw = squareShape_draw;
-	if (status == CELIX_SUCCESS) {
-		// no error
-	} else {
-		printf("Could not find resource %s\n", SQUARE_FILE);
-	}
-	return shape;
-}
-
-void squareShape_draw(simple_shape_pt shape, GdkPixmap *pixMap, GtkWidget *widget, gdouble x, gdouble y){
-	GdkRectangle update_rect;
-	GdkPixbuf *curr_pix_buf;
-	GError *gerror = NULL;
-	gsize rd = 0, wr = 0;
-	if (shape->icon_path == NULL){
-		printf("no icon path\n");
-	} else {
-		gchar *gfn = g_locale_to_utf8(shape->icon_path, strlen(shape->icon_path), &rd, &wr, &gerror);
-		curr_pix_buf = gdk_pixbuf_new_from_file(gfn, &gerror);
-		if(!curr_pix_buf) {
-			g_printerr("error message: %s\n", (gchar *) gerror->message);
-		}
-		update_rect.x = x - 5;
-		update_rect.y = y - 5;
-		update_rect.width = gdk_pixbuf_get_width(curr_pix_buf);
-		update_rect.height = gdk_pixbuf_get_height(curr_pix_buf);
-		gdk_pixbuf_render_to_drawable(
-				curr_pix_buf,
-				pixMap,
-				gtk_widget_get_style(widget)->fg_gc[gtk_widget_get_state(widget)],
-				0, 0,
-				update_rect.x, update_rect.y,
-				update_rect.width,
-				update_rect.height,
-				GDK_RGB_DITHER_NONE,
-				0, 0);
-		gtk_widget_queue_draw_area (widget,
-				update_rect.x, update_rect.y,
-				update_rect.width, update_rect.height);
-	}
-}
-
-
-
diff --git a/examples/osgi-in-action/chapter04-paint-example/triangle/CMakeLists.txt b/examples/osgi-in-action/chapter04-paint-example/triangle/CMakeLists.txt
deleted file mode 100644
index ff069b3..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/triangle/CMakeLists.txt
+++ /dev/null
@@ -1,45 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-INCLUDE(FindPkgConfig)
-pkg_search_module (GLIB  REQUIRED glib-2.0)
-pkg_search_module (GTHR  REQUIRED gthread-2.0)
-pkg_search_module (GTK   REQUIRED gtk+-2.0)
-include_directories(
-	private/include
-	../simple/public/include
-)
-include_directories(${GTK_INCLUDE_DIRS})
-include_directories(${GLIB_INCLUDE_DIRS})
-include_directories(${GTHR_INCLUDE_DIRS})
-
-link_directories(${GTK_LIBRARY_DIRS})
-link_directories(${GLIB_LIBRARY_DIRS})
-link_directories(${GTHR_LIBRARY_DIRS})
-
-add_bundle(triangle  VERSION 0.0.1 SOURCES
- 	private/src/activator
- 	private/src/triangle_shape
-    
-    private/include/triangle_shape.h
- FILES 
- 	private/src/triangle.png
-)
-
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/log_service/public/include")
-target_link_libraries(triangle celix_framework ${GLIB_LIBRARIES} ${GTK_LIBRARIES} ${GTHR_LIBRARIES})
diff --git a/examples/osgi-in-action/chapter04-paint-example/triangle/private/include/triangle_shape.h b/examples/osgi-in-action/chapter04-paint-example/triangle/private/include/triangle_shape.h
deleted file mode 100644
index 02b924c..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/triangle/private/include/triangle_shape.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * triangle_shape.h
- *
- *  \date       Aug 22, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-#ifndef TRIANGLE_SHAPE_H_
-#define TRIANGLE_SHAPE_H_
-
-extern simple_shape_pt triangleShape_create(bundle_context_pt ctx);
-
-#endif /* TRIANGLE_SHAPE_H_ */
diff --git a/examples/osgi-in-action/chapter04-paint-example/triangle/private/src/activator.c b/examples/osgi-in-action/chapter04-paint-example/triangle/private/src/activator.c
deleted file mode 100644
index 49875ac..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/triangle/private/src/activator.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * activator.c
- *
- *  \date       Aug 22, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include <stdio.h>
-#include <apr_general.h>
-#include <glib.h>
-#include <gtk/gtk.h>
-#include <gdk/gdk.h>
-
-#include "bundle_activator.h"
-#include "bundle_context.h"
-#include "simple_shape.h"
-#include "triangle_shape.h"
-#include "simple_shape.h"
-
-struct greetingActivator {
-	service_registration_pt reg;
-	apr_pool_t *pool;
-};
-
-typedef struct greetingActivator *greeting_activator_pt;
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
-	apr_pool_t *pool;
-	greeting_activator_pt activator;
-	celix_status_t status = bundleContext_getMemoryPool(context, &pool);
-	if (status == CELIX_SUCCESS) {
-		*userData = apr_palloc(pool, sizeof(struct greetingActivator));
-		activator = *userData;
-		activator->reg = NULL;
-		activator->pool = pool;
-	}
-	printf("Triangle created %d\n", status);
-	return status;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt ctx) {
-	struct greetingActivator * act = (struct greetingActivator *) userData;
-	celix_status_t status = CELIX_SUCCESS;
-	simple_shape_pt es = triangleShape_create(ctx);
-	properties_pt props = properties_create();
-	properties_set(props, "name", "triangle");
-    status = bundleContext_registerService(ctx, SIMPLE_SHAPE_SERVICE_NAME, es, props, &act->reg);
-	printf("Triangle activated %d\n", status);
-	return status;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
-	return CELIX_SUCCESS;
-}
diff --git a/examples/osgi-in-action/chapter04-paint-example/triangle/private/src/triangle.png b/examples/osgi-in-action/chapter04-paint-example/triangle/private/src/triangle.png
deleted file mode 100644
index 46a5288..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/triangle/private/src/triangle.png
+++ /dev/null
Binary files differ
diff --git a/examples/osgi-in-action/chapter04-paint-example/triangle/private/src/triangle_shape.c b/examples/osgi-in-action/chapter04-paint-example/triangle/private/src/triangle_shape.c
deleted file mode 100644
index 71fca10..0000000
--- a/examples/osgi-in-action/chapter04-paint-example/triangle/private/src/triangle_shape.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * triangle_shape.c
- *
- *  \date       Aug 22, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-
-#include <stdio.h>
-#include <string.h>
-#include <celixbool.h>
-#include <stdlib.h>
-#include <glib.h>
-#include <gtk/gtk.h>
-#include <gdk/gdk.h>
-#include "bundle_context.h"
-#include "bundle.h"
-#include "hash_map.h"
-#include "simple_shape.h"
-#include "triangle_shape.h"
-#define TRIANGLE_FILE "triangle.png"
-
-void triangleShape_draw(simple_shape_pt shape, GdkPixmap *pixMap, GtkWidget *widget, gdouble x, gdouble y);
-
-simple_shape_pt triangleShape_create(bundle_context_pt context) {
-	bundle_pt bundle;
-	apr_pool_t *pool;
-	simple_shape_pt shape = (simple_shape_pt) malloc(sizeof(*shape));
-	celix_status_t status = CELIX_SUCCESS;
-	bundleContext_getBundle(context, &bundle);
-	bundleContext_getMemoryPool(context, &pool);
-	shape->name = "Triangle";
-	shape->icon_path = NULL;
-	status = bundle_getEntry(bundle, TRIANGLE_FILE, pool, &shape->icon_path);
-	shape->simpleShape_draw = triangleShape_draw;
-	if (status == CELIX_SUCCESS){
-		// no error
-	} else {
-		printf("Could not find resource %s\n", TRIANGLE_FILE);
-	}
-	return shape;
-}
-
-void triangleShape_draw(simple_shape_pt shape, GdkPixmap *pixMap, GtkWidget *widget, gdouble x, gdouble y){
-	GdkRectangle update_rect;
-	GdkPixbuf *curr_pix_buf;
-	GError *gerror = NULL;
-	gsize rd = 0, wr = 0;
-	if (shape->icon_path == NULL) {
-		printf("error message: icon path unknown\n");
-	} else {
-	gchar *gfn = g_locale_to_utf8(shape->icon_path, strlen(shape->icon_path), &rd, &wr, &gerror);
-	curr_pix_buf = gdk_pixbuf_new_from_file(gfn, &gerror);
-	if(!curr_pix_buf) {
-		g_printerr("error message: %s\n", (gchar *) gerror->message);
-	}
-	update_rect.x = x - 5;
-	update_rect.y = y - 5;
-	update_rect.width = gdk_pixbuf_get_width(curr_pix_buf);
-	update_rect.height = gdk_pixbuf_get_height(curr_pix_buf);
-	gdk_pixbuf_render_to_drawable(
-			curr_pix_buf,
-			pixMap,
-			gtk_widget_get_style(widget)->fg_gc[gtk_widget_get_state(widget)],
-			0, 0,
-			update_rect.x, update_rect.y,
-			update_rect.width,
-			update_rect.height,
-			GDK_RGB_DITHER_NONE,
-			0, 0);
-	gtk_widget_queue_draw_area (widget,
-			update_rect.x, update_rect.y,
-			update_rect.width, update_rect.height);
-	}
-}
-
-
-
diff --git a/examples/producer_consumer/CMakeLists.txt b/examples/producer_consumer/CMakeLists.txt
deleted file mode 100644
index 5e07a12..0000000
--- a/examples/producer_consumer/CMakeLists.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-add_subdirectory(database)
-add_subdirectory(producer)
-add_subdirectory(consumer)
diff --git a/examples/producer_consumer/consumer/CMakeLists.txt b/examples/producer_consumer/consumer/CMakeLists.txt
deleted file mode 100644
index 2803af7..0000000
--- a/examples/producer_consumer/consumer/CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/examples/producer_consumer/database/public/include")
-
-add_bundle(consumer
-	VERSION 1.0.0
-	SOURCES
-	 	private/src/activator.c
-)
-
-target_link_libraries(consumer celix_framework)
diff --git a/examples/producer_consumer/consumer/private/src/activator.c b/examples/producer_consumer/consumer/private/src/activator.c
deleted file mode 100644
index 0e58856..0000000
--- a/examples/producer_consumer/consumer/private/src/activator.c
+++ /dev/null
@@ -1,195 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * activator.c
- *
- *  \date       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
-
-#include <stdlib.h>
-
-#include <unistd.h>
-
-#include <sys/time.h>
-
-#include <bundle_activator.h>
-#include <service_tracker.h>
-#include <constants.h>
-
-#include <array_list.h>
-
-#include "reader_service.h"
-#include "writer_service.h"
-#include "data.h"
-
-struct activator {
-    service_tracker_pt readerTracker;
-    service_tracker_pt writerTracker;
-    array_list_pt readerServices;
-    array_list_pt writerServices;
-    bool running;
-    celix_thread_t worker;
-};
-
-celix_status_t readerServiceAdded(void *handle, service_reference_pt reference, void *service);
-celix_status_t readerServiceRemoved(void *handle, service_reference_pt reference, void *service);
-
-celix_status_t writerServiceAdded(void *handle, service_reference_pt reference, void *service);
-celix_status_t writerServiceRemoved(void *handle, service_reference_pt reference, void *service);
-
-void *retrieveData(void *handle);
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
-    celix_status_t status = CELIX_SUCCESS;
-    *userData = calloc(1, sizeof(struct activator));
-    if (*userData) {
-        ((struct activator *) *userData)->readerTracker = NULL;
-        ((struct activator *) *userData)->writerTracker = NULL;
-        ((struct activator *) *userData)->readerServices = NULL;
-        ((struct activator *) *userData)->writerServices = NULL;
-        ((struct activator *) *userData)->running = false;
-        ((struct activator *) *userData)->worker = celix_thread_default;
-    } else {
-        status = CELIX_ENOMEM;
-    }
-    return status;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
-    celix_status_t status = CELIX_SUCCESS;
-    struct activator *activator = userData;
-
-    // create list for services
-    arrayList_create(&activator->readerServices);
-    arrayList_create(&activator->writerServices);
-
-    // start the thread
-    activator->running = true;
-    status = celixThread_create(&activator->worker, NULL, retrieveData, activator);
-
-    if (status == CELIX_SUCCESS) {
-        service_tracker_customizer_pt readerCustomizer = NULL;
-        service_tracker_customizer_pt writerCustomizer = NULL;
-        serviceTrackerCustomizer_create(userData, NULL, readerServiceAdded, NULL, readerServiceRemoved, &readerCustomizer);
-        serviceTrackerCustomizer_create(userData, NULL, writerServiceAdded, NULL, writerServiceRemoved, &writerCustomizer);
-
-        serviceTracker_create(context, WRITER_SERVICE_NAME, writerCustomizer, &activator->writerTracker);
-        serviceTracker_open(activator->writerTracker);
-
-        serviceTracker_create(context, READER_SERVICE_NAME, readerCustomizer, &activator->readerTracker);
-        serviceTracker_open(activator->readerTracker);
-    }
-
-    return status;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
-    celix_status_t status = CELIX_SUCCESS;
-    struct activator *activator = userData;
-
-    // stop the thread
-    activator->running = false;
-
-    celixThread_join(activator->worker, NULL);
-
-    serviceTracker_close(activator->readerTracker);
-    serviceTracker_close(activator->writerTracker);
-
-    serviceTracker_destroy(activator->readerTracker);
-    serviceTracker_destroy(activator->writerTracker);
-
-    // destroy the list of services
-    arrayList_destroy(activator->readerServices);
-    arrayList_destroy(activator->writerServices);
-
-    return status;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
-    celix_status_t status = CELIX_SUCCESS;
-    struct activator *activator = userData;
-
-    free(activator);
-
-    return status;
-}
-
-celix_status_t readerServiceAdded(void *handle, service_reference_pt reference, void *service) {
-    struct activator *activator = handle;
-    arrayList_add(activator->readerServices, service);
-    printf("Consumer: Reader Service Added.\n");
-
-    return CELIX_SUCCESS;
-}
-
-celix_status_t readerServiceRemoved(void *handle, service_reference_pt reference, void *service) {
-    struct activator *activator = handle;
-    arrayList_removeElement(activator->readerServices, service);
-    printf("Consumer: Reader Service Removed.\n");
-
-    return CELIX_SUCCESS;
-}
-
-celix_status_t writerServiceAdded(void *handle, service_reference_pt reference, void *service) {
-    struct activator *activator = handle;
-    arrayList_add(activator->writerServices, service);
-    printf("Consumer: Writer Service Added.\n");
-
-    return CELIX_SUCCESS;
-}
-
-celix_status_t writerServiceRemoved(void *handle, service_reference_pt reference, void *service) {
-    struct activator *activator = handle;
-    arrayList_removeElement(activator->writerServices, service);
-    printf("Consumer: Writer Service Removed.\n");
-
-    return CELIX_SUCCESS;
-}
-
-void *retrieveData(void *handle) {
-    struct activator *activator = handle;
-
-    while (activator->running) {
-        int i;
-        for (i = 0; i < arrayList_size(activator->readerServices); i++) {
-            reader_service_pt service = arrayList_get(activator->readerServices, i);
-            data_pt retrievedData = NULL;
-
-            if (service->readerService_getNextData(service->handler, &retrievedData) == CELIX_SUCCESS) {
-                printf(" Data #%d received.", retrievedData->id);
-
-                writer_service_pt writerService = arrayList_get(activator->writerServices, 0);
-                if (writerService && writerService->writerService_removeData(writerService->handler, &retrievedData) == CELIX_SUCCESS) {
-                    printf(" and removed\n");
-                }
-
-            } else {
-                printf(" No data available\n");
-                sleep(5);
-            }
-
-        }
-
-    }
-
-    return NULL;
-}
diff --git a/examples/producer_consumer/database/CMakeLists.txt b/examples/producer_consumer/database/CMakeLists.txt
deleted file mode 100644
index 40b8b35..0000000
--- a/examples/producer_consumer/database/CMakeLists.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/examples/producer_consumer/database/private/include")
-include_directories("${PROJECT_SOURCE_DIR}/examples/producer_consumer/database/public/include")
-
-add_bundle(database
-	VERSION 1.0.0
-	SOURCES private/src/activator 
-		private/src/writer 
-		private/src/reader
-)
-
-target_link_libraries(database celix_framework)
-
diff --git a/examples/producer_consumer/database/private/include/writer_service_impl.h b/examples/producer_consumer/database/private/include/writer_service_impl.h
deleted file mode 100644
index 1933892..0000000
--- a/examples/producer_consumer/database/private/include/writer_service_impl.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * writer_service_impl.h
- *
- *  \date       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
-
-
-
-#ifndef WRITER_SERVICE_IMPL_H_
-#define WRITER_SERVICE_IMPL_H_
-
-#include "data.h"
-#include "database.h"
-
-celix_status_t writerService_storeData(database_handler_pt, data_pt data);
-celix_status_t writerService_removeData(database_handler_pt, data_pt* data);
-
-
-#endif
diff --git a/examples/producer_consumer/database/private/src/activator.c b/examples/producer_consumer/database/private/src/activator.c
deleted file mode 100644
index e0f2791..0000000
--- a/examples/producer_consumer/database/private/src/activator.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * activator.c
- *
- *  \date       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
-
-
-#include <stdlib.h>
-#include <unistd.h>
-
-#include <sys/time.h>
-
-#include <bundle_activator.h>
-#include <service_tracker.h>
-#include <constants.h>
-
-#include <array_list.h>
-#include <pthread.h>
-
-#include "reader_service.h"
-#include "reader_service_impl.h"
-#include "writer_service.h"
-#include "writer_service_impl.h"
-
-#include "database.h"
-
-struct activator {
-	database_handler_pt databaseHandler;
-
-	service_registration_pt readerRegistration;
-	service_registration_pt writerRegistration;
-
-	reader_service_pt readerService;
-	writer_service_pt writerService;
-};
-
-
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
-	celix_status_t status = CELIX_SUCCESS;
-
-	*userData = calloc (1, sizeof(struct activator));
-
-	if (*userData) {
-		((struct activator *) *userData)->readerService = NULL;
-		((struct activator *) *userData)->writerService = NULL;
-		((struct activator *) *userData)->databaseHandler = NULL;
-
-	} else {
-		status = CELIX_ENOMEM;
-	}
-	return status;
-}
-
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
-	celix_status_t status = CELIX_SUCCESS;
-	struct activator *activator = userData;
-	reader_service_pt readerService = calloc(1, sizeof(struct reader_service));
-	writer_service_pt writerService = calloc(1, sizeof(struct writer_service));
-	database_handler_pt databaseHandler = calloc(1, sizeof(struct database_handler));
-
-	if (readerService && writerService && databaseHandler)
-	{
-	    status = celixThreadMutex_create(&databaseHandler->lock, NULL);
-
-	    if (status == CELIX_SUCCESS)
-	    {
-            arrayList_create(&databaseHandler->data);
-            databaseHandler->dataIndex = 0;
-
-            readerService->handler = databaseHandler;
-            readerService->readerService_getFirstData = readerService_getFirstData;
-            readerService->readerService_getNextData = readerService_getNextData;
-
-            writerService->handler = databaseHandler;
-            writerService->writerService_storeData = writerService_storeData;
-            writerService->writerService_removeData = writerService_removeData;
-
-            activator->readerService = readerService;
-            activator->writerService = writerService;
-
-            status = bundleContext_registerService(context, READER_SERVICE_NAME, activator->readerService, NULL,  &activator->readerRegistration);
-
-            if (status == CELIX_SUCCESS)
-                status = bundleContext_registerService(context, WRITER_SERVICE_NAME, activator->writerService, NULL,  &activator->writerRegistration);
-	    }
-	}
-	else
-	{
-		status = CELIX_ENOMEM;
-	}
-
-	return status;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
-	celix_status_t status = CELIX_SUCCESS;
-	struct activator *activator = userData;
-
-	serviceRegistration_unregister(activator->readerRegistration);
-	serviceRegistration_unregister(activator->writerRegistration);
-
-	return status;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
-	celix_status_t status = CELIX_SUCCESS;
-	struct activator *activator = userData;
-
-	free(activator->readerService);
-	free(activator->writerService);
-	free(activator);
-
-	return status;
-}
-
diff --git a/examples/producer_consumer/database/private/src/reader.c b/examples/producer_consumer/database/private/src/reader.c
deleted file mode 100644
index de4df77..0000000
--- a/examples/producer_consumer/database/private/src/reader.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * reader.c
- *
- *  \date       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
-
-
-
-#include <pthread.h>
-
-#include "array_list.h"
-#include "celix_errno.h"
-#include "data.h"
-#include "database.h"
-#include "reader_service.h"
-
-
-celix_status_t readerService_getFirstData(database_handler_pt handler, data_pt firstData)
-{
-	celix_status_t status = CELIX_BUNDLE_EXCEPTION;
-
-	celixThreadMutex_lock(&handler->lock);
-
-	if ((firstData = (data_pt) arrayList_remove(handler->data, 0)) != NULL)
-	{
-		handler->dataIndex--;
-		status = CELIX_SUCCESS;
-	}
-
-    celixThreadMutex_unlock(&handler->lock);
-
-	return status;
-}
-
-
-celix_status_t readerService_getNextData(database_handler_pt handler, data_pt* nextData)
-{
-	celix_status_t status = CELIX_BUNDLE_EXCEPTION;
-
-    celixThreadMutex_lock(&handler->lock);
-
-	if (((*nextData) = (data_pt) arrayList_get(handler->data, handler->dataIndex)) != NULL)
-	{
-		handler->dataIndex++;
-		status = CELIX_SUCCESS;
-	}
-
-    celixThreadMutex_unlock(&handler->lock);
-
-	return status;
-}
-
diff --git a/examples/producer_consumer/database/private/src/writer.c b/examples/producer_consumer/database/private/src/writer.c
deleted file mode 100644
index cce12fa..0000000
--- a/examples/producer_consumer/database/private/src/writer.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * writer.c
- *
- *  \date       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
-
-
-
-#include <stdlib.h>
-#include <pthread.h>
-
-#include "array_list.h"
-#include "celix_errno.h"
-#include "data.h"
-#include "database.h"
-
-#include "writer_service.h"
-
-celix_status_t writerService_storeData(database_handler_pt handler, data_pt newData)
-{
-	celix_status_t status = CELIX_BUNDLE_EXCEPTION;
-
-    celixThreadMutex_lock(&handler->lock);
-
-	if ( arrayList_add(handler->data, newData) == true)
-		status = CELIX_SUCCESS;
-
-    celixThreadMutex_unlock(&handler->lock);
-	return status;
-}
-
-
-celix_status_t writerService_removeData(database_handler_pt handler, data_pt* newData)
-{
-	celix_status_t status = CELIX_BUNDLE_EXCEPTION;
-
-    celixThreadMutex_lock(&handler->lock);
-
-	if ( arrayList_removeElement(handler->data, *newData) == true)
-		status = CELIX_SUCCESS;
-
-	free(*newData);
-
-    celixThreadMutex_unlock(&handler->lock);
-	return status;
-}
-
diff --git a/examples/producer_consumer/database/public/include/database.h b/examples/producer_consumer/database/public/include/database.h
deleted file mode 100644
index 054fac0..0000000
--- a/examples/producer_consumer/database/public/include/database.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * database.h
- *
- *  \date       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
-
-
-
-#ifndef _DATABASE_H_
-#define _DATABASE_H_
-
-#include "array_list.h"
-#include  "celix_threads.h"
-
-struct database_handler {
-	celix_thread_mutex_t lock;
-	array_list_pt data;
-	int dataIndex;
-};
-
-typedef struct database_handler* database_handler_pt;
-
-#endif
diff --git a/examples/producer_consumer/database/public/include/reader_service.h b/examples/producer_consumer/database/public/include/reader_service.h
deleted file mode 100644
index e27e843..0000000
--- a/examples/producer_consumer/database/public/include/reader_service.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * reader_service.h
- *
- *  \date       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
-
-
-
-#ifndef READER_SERVICE_H_
-#define READER_SERVICE_H_
-
-#include "celix_errno.h"
-#include "data.h"
-#include "database.h"
-
-#define READER_SERVICE_NAME		"service.database.reader"
-
-
-struct reader_service {
-	database_handler_pt handler;
-	celix_status_t (*readerService_getFirstData)(database_handler_pt handle, data_pt firstData);
-	celix_status_t (*readerService_getNextData)(database_handler_pt handle, data_pt* nextData);
-};
-
-typedef struct reader_service* reader_service_pt;
-
-
-
-#endif
diff --git a/examples/producer_consumer/database/public/include/writer_service.h b/examples/producer_consumer/database/public/include/writer_service.h
deleted file mode 100644
index 936bbbb..0000000
--- a/examples/producer_consumer/database/public/include/writer_service.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * writer_service.h
- *
- *  \date       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
-
-
-
-
-#ifndef WRITER_SERVICE_H_
-#define WRITER_SERVICE_H_
-
-#include "celix_errno.h"
-#include "data.h"
-#include "database.h"
-
-#define WRITER_SERVICE_NAME		"service.database.writer"
-
-struct writer_service {
-	void *handler;
-	celix_status_t (*writerService_storeData)(database_handler_pt handle, data_pt data);
-	celix_status_t (*writerService_removeData)(database_handler_pt handle, data_pt* data);
-};
-
-typedef struct writer_service* writer_service_pt;
-
-#endif
diff --git a/examples/producer_consumer/producer/CMakeLists.txt b/examples/producer_consumer/producer/CMakeLists.txt
deleted file mode 100644
index 83ba7d4..0000000
--- a/examples/producer_consumer/producer/CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/examples/producer_consumer/database/public/include")
-
-add_bundle(producer
-	VERSION 1.0.0
-	SOURCES
-	 	private/src/activator.c
-)
-
-target_link_libraries(producer celix_framework)
\ No newline at end of file
diff --git a/examples/producer_consumer/producer/private/src/activator.c b/examples/producer_consumer/producer/private/src/activator.c
deleted file mode 100644
index 914b982..0000000
--- a/examples/producer_consumer/producer/private/src/activator.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * activator.c
- *
- *  \date       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
-
-#include <stdlib.h>
-
-#include <unistd.h>
-
-#include <sys/time.h>
-#include <stdlib.h>
-#include <bundle_activator.h>
-#include <service_tracker.h>
-#include <constants.h>
-
-#include <array_list.h>
-
-#include "writer_service.h"
-#include "data.h"
-
-struct activator {
-    service_tracker_pt tracker;
-    array_list_pt readerServices;
-    bool running;
-    celix_thread_t worker;
-};
-
-celix_status_t writerServiceAdded(void *handle, service_reference_pt reference, void *service);
-celix_status_t writerServiceRemoved(void *handle, service_reference_pt reference, void *service);
-
-int globalDataId = 0;
-
-void *produceData(void *handle);
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
-    celix_status_t status = CELIX_SUCCESS;
-    *userData = calloc(1, sizeof(struct activator));
-    if (*userData) {
-        ((struct activator *) *userData)->tracker = NULL;
-        ((struct activator *) *userData)->readerServices = NULL;
-        ((struct activator *) *userData)->running = false;
-        ((struct activator *) *userData)->worker = celix_thread_default;
-    } else {
-        status = CELIX_ENOMEM;
-    }
-    return status;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
-    celix_status_t status = CELIX_SUCCESS;
-    struct activator *activator = userData;
-
-    // create list for services
-    arrayList_create(&activator->readerServices);
-
-    // start the thread
-    activator->running = true;
-    status = celixThread_create(&activator->worker, NULL, produceData, activator);
-
-    if (status == CELIX_SUCCESS) {
-        service_tracker_customizer_pt customizer = NULL;
-        serviceTrackerCustomizer_create(userData, NULL, writerServiceAdded, NULL, writerServiceRemoved, &customizer);
-
-        serviceTracker_create(context, WRITER_SERVICE_NAME, customizer, &activator->tracker);
-        serviceTracker_open(activator->tracker);
-    }
-
-    return status;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
-    celix_status_t status = CELIX_SUCCESS;
-    struct activator *activator = userData;
-
-    // stop the thread
-    activator->running = false;
-    celixThread_join(activator->worker, NULL);
-
-    serviceTracker_close(activator->tracker);
-    serviceTracker_destroy(activator->tracker);
-
-    // destroy the list of services
-    arrayList_destroy(activator->readerServices);
-
-    return status;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
-    celix_status_t status = CELIX_SUCCESS;
-    struct activator *activator = userData;
-
-    free(activator);
-
-    return status;
-}
-
-celix_status_t writerServiceAdded(void *handle, service_reference_pt reference, void *service) {
-    struct activator *activator = handle;
-    arrayList_add(activator->readerServices, service);
-    printf("Producer: Writer Service Added.\n");
-
-    return CELIX_SUCCESS;
-}
-
-celix_status_t writerServiceRemoved(void *handle, service_reference_pt reference, void *service) {
-    struct activator *activator = handle;
-    arrayList_removeElement(activator->readerServices, service);
-    printf("Producer: Writer Service Removed.\n");
-
-    return CELIX_SUCCESS;
-}
-
-void *produceData(void *handle) {
-    struct activator *activator = handle;
-
-    while (activator->running) {
-        int i;
-        for (i = 0; i < arrayList_size(activator->readerServices); i++) {
-            writer_service_pt service = arrayList_get(activator->readerServices, i);
-            data_pt newData = calloc(1, sizeof(struct data));
-
-            newData->id = globalDataId++;
-            snprintf(newData->description, 100, "%d : Some Description", newData->id);
-
-            if (service->writerService_storeData(service->handler, newData) == CELIX_SUCCESS) {
-                printf(" Data #%d stored.\n", newData->id);
-            } else {
-                printf(" Could not store data. \n");
-            }
-
-            srand(time(NULL));
-            int r = rand() % 100;
-
-            if (r > 70)
-                sleep(10);
-        }
-    }
-
-    return NULL;
-}
diff --git a/examples/services_example_c/CMakeLists.txt b/examples/services_example_c/CMakeLists.txt
new file mode 100644
index 0000000..f6a5066
--- /dev/null
+++ b/examples/services_example_c/CMakeLists.txt
@@ -0,0 +1,43 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+if (BUILD_DEPENDENCY_MANAGER)
+
+    include_directories(
+            ${PROJECT_SOURCE_DIR}/dependency_manager/public/include
+            ${PROJECT_SOURCE_DIR}/utils/public/include
+            api
+    )
+
+    add_subdirectory(foo1)
+    add_subdirectory(foo2)
+    add_subdirectory(bar)
+
+    add_deploy(services_example_c
+        GROUP services_example
+        COPY
+        BUNDLES
+            shell
+            shell_tui
+            dm_shell
+            bar
+            foo1
+            foo2
+        PROPERTIES
+            example=value
+    )
+
+endif ()
diff --git a/examples/osgi-in-action/chapter04-paint-example/paint/private/include/default_shape.h b/examples/services_example_c/api/example.h
similarity index 69%
rename from examples/osgi-in-action/chapter04-paint-example/paint/private/include/default_shape.h
rename to examples/services_example_c/api/example.h
index b249074..b0e0166 100644
--- a/examples/osgi-in-action/chapter04-paint-example/paint/private/include/default_shape.h
+++ b/examples/services_example_c/api/example.h
@@ -16,16 +16,19 @@
  *specific language governing permissions and limitations
  *under the License.
  */
-/*
- * default_shape.h
- *
- *  \date       Aug 22, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#ifndef DEFAULT_SHAPE_H_
-#define DEFAULT_SHAPE_H_
+#ifndef EXAMPLE_H_
+#define EXAMPLE_H_
 
-extern simple_shape_pt defaultShape_create(bundle_context_pt context);
+#define EXAMPLE_NAME 			"org.example"
+#define EXAMPLE_VERSION 		"1.0.0"
+#define EXAMPLE_CONSUMER_RANGE   "[1.0.0,2.0.0)"
 
-#endif /* DEFAULT_SHAPE_H_ */
+
+struct example_struct {
+	void *handle;
+	int (*method)(void *handle, int arg1, double arg2, double *result);
+} ;
+
+typedef struct example_struct example_t;
+
+#endif /* EXAMPLE_H_ */
diff --git a/examples/services_example_c/bar/CMakeLists.txt b/examples/services_example_c/bar/CMakeLists.txt
new file mode 100644
index 0000000..7ebb45c
--- /dev/null
+++ b/examples/services_example_c/bar/CMakeLists.txt
@@ -0,0 +1,39 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+include_directories(
+        private/include
+)
+
+add_bundle(bar
+    SYMBOLIC_NAME bar
+    VERSION 1.0.0
+    SOURCES
+        private/src/bar_activator
+        private/src/bar.c
+)
+
+IF(APPLE)
+    target_link_libraries(bar celix_framework -Wl,-all_load dependency_manager_static)
+else()
+    if(ENABLE_ADDRESS_SANITIZER)
+        #With asan there can be undefined symbols
+        target_link_libraries(bar -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive celix_framework)
+    else()
+        target_link_libraries(bar -Wl,--no-undefined -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive celix_framework)
+    endif()
+endif()
diff --git a/scr/scr/private/src/component_registry.c b/examples/services_example_c/bar/private/include/bar.h
similarity index 77%
copy from scr/scr/private/src/component_registry.c
copy to examples/services_example_c/bar/private/include/bar.h
index b09254f..5e1da8b 100644
--- a/scr/scr/private/src/component_registry.c
+++ b/examples/services_example_c/bar/private/include/bar.h
@@ -16,15 +16,17 @@
  *specific language governing permissions and limitations
  *under the License.
  */
-/*
- * component_registry.c
- *
- *  \date       Nov 15, 2012
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
 
+#ifndef BAR_H_
+#define BAR_H_
 
+#include "example.h"
 
+typedef struct bar_struct bar_t;
 
+bar_t* bar_create(void);
+void bar_destroy(bar_t *self);
 
+int bar_method(bar_t *self, int arg1, double arg2, double *out);
+
+#endif //BAR_H_
diff --git a/examples/services_example_c/bar/private/src/bar.c b/examples/services_example_c/bar/private/src/bar.c
new file mode 100644
index 0000000..5099201
--- /dev/null
+++ b/examples/services_example_c/bar/private/src/bar.c
@@ -0,0 +1,58 @@
+/**
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements.  See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.  The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+
+#include "bar.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <signal.h>
+#include <stdbool.h>
+#include <pthread.h>
+#include <assert.h>
+
+
+#define OK 0
+#define ERROR 1
+
+struct bar_struct {
+    double prefValue;
+};
+
+bar_t* bar_create(void) {
+    bar_t *self = calloc(1, sizeof(*self));
+    if (self != NULL) {
+        self->prefValue = 42;
+    } else {
+        //log error
+    }
+    return self;
+};
+
+void bar_destroy(bar_t *self) {
+    free(self);
+}
+
+int bar_method(bar_t *self, int arg1, double arg2, double *out) {
+    double update = (self->prefValue + arg1) * arg2;
+    self->prefValue = update;
+    *out = update;
+    return OK;
+}
\ No newline at end of file
diff --git a/examples/services_example_c/bar/private/src/bar_activator.c b/examples/services_example_c/bar/private/src/bar_activator.c
new file mode 100644
index 0000000..0fa7889
--- /dev/null
+++ b/examples/services_example_c/bar/private/src/bar_activator.c
@@ -0,0 +1,70 @@
+/**
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements.  See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.  The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+
+#include "dm_activator.h"
+#include "bar.h"
+
+#include <stdlib.h>
+
+struct activator {
+	bar_t *bar;
+	example_t exampleService;
+};
+
+celix_status_t dm_create(bundle_context_pt context, void **userData) {
+	celix_status_t status = CELIX_SUCCESS;
+	struct activator *act = calloc(1, sizeof(*act));
+	if (act != NULL) {
+
+		act->bar = bar_create();
+		act->exampleService.handle = act->bar;
+		act->exampleService.method = (void*) bar_method;
+
+		if (act->bar != NULL) {
+            *userData = act;
+        } else {
+            free(act);
+        }
+	} else {
+		status = CELIX_ENOMEM;
+	}
+	return status;
+}
+
+celix_status_t dm_init(void *userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
+    celix_status_t status = CELIX_SUCCESS;
+	struct activator *activator = userData;
+
+	dm_component_pt cmp = NULL;
+	component_create(context, "BAR", &cmp);
+	component_setImplementation(cmp, activator->bar);
+	component_addInterface(cmp, EXAMPLE_NAME, EXAMPLE_VERSION, &activator->exampleService, NULL);
+
+	dependencyManager_add(manager, cmp);
+    return status;
+}
+
+celix_status_t dm_destroy(void *userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
+	celix_status_t status = CELIX_SUCCESS;
+	struct activator *activator = userData;
+	bar_destroy(activator->bar);
+	free(activator);
+	return status;
+};
+
diff --git a/examples/services_example_c/foo1/CMakeLists.txt b/examples/services_example_c/foo1/CMakeLists.txt
new file mode 100644
index 0000000..0d1b93c
--- /dev/null
+++ b/examples/services_example_c/foo1/CMakeLists.txt
@@ -0,0 +1,39 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+include_directories(
+        private/include
+)
+
+add_bundle(foo1
+    SYMBOLIC_NAME foo1
+    VERSION 1.0.0
+    SOURCES
+        private/src/foo1_activator
+        private/src/foo1.c
+)
+
+IF(APPLE)
+    target_link_libraries(foo1 celix_framework -Wl,-all_load dependency_manager_static)
+else()
+    if(ENABLE_ADDRESS_SANITIZER)
+        #With asan there can be undefined symbols
+        target_link_libraries(foo1 -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive celix_framework)
+    else()
+        target_link_libraries(foo1 -Wl,--no-undefined -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive celix_framework)
+    endif()
+endif()
diff --git a/scr/scr/private/src/component_registry.c b/examples/services_example_c/foo1/private/include/foo1.h
similarity index 72%
copy from scr/scr/private/src/component_registry.c
copy to examples/services_example_c/foo1/private/include/foo1.h
index b09254f..f556b44 100644
--- a/scr/scr/private/src/component_registry.c
+++ b/examples/services_example_c/foo1/private/include/foo1.h
@@ -16,15 +16,21 @@
  *specific language governing permissions and limitations
  *under the License.
  */
-/*
- * component_registry.c
- *
- *  \date       Nov 15, 2012
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
+
+#ifndef FOO1_H_
+#define FOO1_H_
+
+#include "example.h"
+
+typedef struct foo1_struct foo1_t;
+
+foo1_t* foo1_create(void);
+void foo1_destroy(foo1_t *self);
+
+int foo1_start(foo1_t *self);
+int foo1_stop(foo1_t *self);
+
+int foo1_setExample(foo1_t *self, const example_t *example);
 
 
-
-
-
+#endif //FOO1_H_
diff --git a/examples/services_example_c/foo1/private/src/foo1.c b/examples/services_example_c/foo1/private/src/foo1.c
new file mode 100644
index 0000000..1f1f56f
--- /dev/null
+++ b/examples/services_example_c/foo1/private/src/foo1.c
@@ -0,0 +1,102 @@
+/**
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements.  See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.  The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+
+#include "foo1.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <signal.h>
+#include <stdbool.h>
+#include <pthread.h>
+#include <assert.h>
+
+
+#define OK 0
+#define ERROR 1
+
+static void* foo1_thread(void*);
+
+struct foo1_struct {
+    const example_t *example;
+    pthread_mutex_t mutex; //protecting example
+    pthread_t thread;
+    bool running;
+};
+
+foo1_t* foo1_create(void) {
+    foo1_t *self = calloc(1, sizeof(*self));
+    if (self != NULL) {
+        pthread_mutex_init(&self->mutex, NULL);
+        self->running = false;
+    } else {
+        //log error
+    }
+    return self;
+};
+
+void foo1_destroy(foo1_t *self) {
+    assert(!self->running);
+    pthread_mutex_destroy(&self->mutex);
+    free(self);
+}
+
+int foo1_start(foo1_t *self) {
+    printf("starting foo1\n");
+    self->running = true;
+    pthread_create(&self->thread, NULL, foo1_thread, self);
+    return OK;
+}
+
+int foo1_stop(foo1_t *self) {
+    printf("stopping foo1\n");
+    self->running = false;
+    pthread_kill(self->thread, SIGUSR1);
+    pthread_join(self->thread, NULL);
+    return OK;
+}
+
+int foo1_setExample(foo1_t *self, const example_t *example) {
+    printf("Setting example %p for foo1\n", example);
+    pthread_mutex_lock(&self->mutex);
+    self->example = example; //NOTE could be NULL if req is not mandatory
+    pthread_mutex_unlock(&self->mutex);
+    return OK;
+}
+
+static void* foo1_thread(void *userdata) {
+    foo1_t *self = userdata;
+    double result;
+    int rc;
+    while (self->running) {
+        pthread_mutex_lock(&self->mutex);
+        if (self->example != NULL) {
+            rc = self->example->method(self->example->handle, 1, 2.0, &result);
+            if (rc == 0) {
+                printf("Result is %f\n", result);
+            } else {
+                printf("Error invoking method for example\n");
+            }
+        }
+        pthread_mutex_unlock(&self->mutex);
+        usleep(30000000);
+    }
+    return NULL;
+}
\ No newline at end of file
diff --git a/examples/services_example_c/foo1/private/src/foo1_activator.c b/examples/services_example_c/foo1/private/src/foo1_activator.c
new file mode 100644
index 0000000..f94888b
--- /dev/null
+++ b/examples/services_example_c/foo1/private/src/foo1_activator.c
@@ -0,0 +1,88 @@
+/**
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements.  See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.  The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+
+#include "dm_activator.h"
+#include "foo1.h"
+
+#include <stdlib.h>
+
+struct activator {
+	foo1_t *foo;
+};
+
+celix_status_t dm_create(bundle_context_pt context, void **userData) {
+	celix_status_t status = CELIX_SUCCESS;
+	struct activator *act = calloc(1, sizeof(*act));
+	if (act != NULL) {
+		act->foo = foo1_create();
+        if (act->foo != NULL) {
+            *userData = act;
+        } else {
+            free(act);
+        }
+	} else {
+		status = CELIX_ENOMEM;
+	}
+	return status;
+}
+
+celix_status_t dm_init(void *userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
+    celix_status_t status = CELIX_SUCCESS;
+	struct activator *activator = userData;
+
+	dm_component_pt cmp = NULL;
+	component_create(context, "FOO1", &cmp);
+	component_setImplementation(cmp, activator->foo);
+
+	/*
+	With the component_setCallbacksSafe we register callbacks when a component is started / stopped using a component
+	 with type foo1_t*
+	*/
+    component_setCallbacksSafe(cmp, foo1_t*, NULL, foo1_start, foo1_stop, NULL);
+
+	dm_service_dependency_pt dep = NULL;
+	serviceDependency_create(&dep);
+	serviceDependency_setRequired(dep, true);
+	serviceDependency_setService(dep, EXAMPLE_NAME, EXAMPLE_CONSUMER_RANGE, NULL);
+	serviceDependency_setStrategy(dep, DM_SERVICE_DEPENDENCY_STRATEGY_LOCKING);
+
+	/*
+	With the serviceDependency_setCallbacksSafe we register callbacks when a service
+	is added and about to be removed for the component type foo1_t* and service type example_t*.
+
+	We should protect the usage of the
+ 	service because after removal of the service the memory location of that service
+	could be freed
+	*/
+    serviceDependency_setCallbacksSafe(dep, foo1_t*, const example_t*, foo1_setExample, NULL, NULL, NULL, NULL);
+	component_addServiceDependency(cmp, dep);
+
+	dependencyManager_add(manager, cmp);
+
+    return status;
+}
+
+celix_status_t dm_destroy(void *userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
+	celix_status_t status = CELIX_SUCCESS;
+	struct activator *activator = userData;
+	foo1_destroy(activator->foo);
+	free(activator);
+	return status;
+};
+
diff --git a/examples/services_example_c/foo2/CMakeLists.txt b/examples/services_example_c/foo2/CMakeLists.txt
new file mode 100644
index 0000000..1096c6c
--- /dev/null
+++ b/examples/services_example_c/foo2/CMakeLists.txt
@@ -0,0 +1,39 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+include_directories(
+        private/include
+)
+
+add_bundle(foo2
+    SYMBOLIC_NAME foo2
+    VERSION 1.0.0
+    SOURCES
+        private/src/foo2_activator
+        private/src/foo2.c
+)
+
+IF(APPLE)
+    target_link_libraries(foo2 celix_framework -Wl,-all_load dependency_manager_static)
+else()
+    if(ENABLE_ADDRESS_SANITIZER)
+        #With asan there can be undefined symbols
+        target_link_libraries(foo2 -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive celix_framework)
+    else()
+        target_link_libraries(foo2 -Wl,--no-undefined -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive celix_framework)
+    endif()
+endif()
diff --git a/event_admin/utils/public/include/event.h b/examples/services_example_c/foo2/private/include/foo2.h
similarity index 69%
rename from event_admin/utils/public/include/event.h
rename to examples/services_example_c/foo2/private/include/foo2.h
index 25a792d..9f09276 100644
--- a/event_admin/utils/public/include/event.h
+++ b/examples/services_example_c/foo2/private/include/foo2.h
@@ -16,21 +16,21 @@
  *specific language governing permissions and limitations
  *under the License.
  */
-/*
- * event.h
- *
- *  \Created on: Jul 19, 2013
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
 
+#ifndef FOO2_H_
+#define FOO2_H_
 
-#ifndef EVENT_H_
-#define EVENT_H_
-#include "celix_errno.h"
-#include "properties.h"
-#include "array_list.h"
+#include "example.h"
 
+typedef struct foo2_struct foo2_t;
 
+foo2_t* foo2_create(void);
+void foo2_destroy(foo2_t *self);
 
-#endif /* EVENT_H_ */
+int foo2_start(foo2_t *self);
+int foo2_stop(foo2_t *self);
+
+int foo2_addExample(foo2_t *self, const example_t *example);
+int foo2_removeExample(foo2_t *self, const example_t *example);
+
+#endif //FOO2_H_
\ No newline at end of file
diff --git a/examples/services_example_c/foo2/private/src/foo2.c b/examples/services_example_c/foo2/private/src/foo2.c
new file mode 100644
index 0000000..b98e20b
--- /dev/null
+++ b/examples/services_example_c/foo2/private/src/foo2.c
@@ -0,0 +1,113 @@
+/**
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements.  See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.  The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+
+#include "foo2.h"
+
+#include "array_list.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <signal.h>
+#include <stdbool.h>
+#include <pthread.h>
+#include <assert.h>
+
+
+#define OK 0
+#define ERROR 1
+
+static void* foo2_thread(void*);
+
+struct foo2_struct {
+    array_list_pt examples;
+    pthread_t thread;
+    bool running;
+};
+
+foo2_t* foo2_create(void) {
+    foo2_t *self = calloc(1, sizeof(*self));
+    if (self != NULL) {
+        self->examples = NULL;
+        arrayList_create(&self->examples);
+        self->running = false;
+    } else {
+        //log error
+    }
+    return self;
+};
+
+void foo2_destroy(foo2_t *self) {
+    assert(!self->running);
+    arrayList_destroy(self->examples);
+    free(self);
+}
+
+int foo2_start(foo2_t *self) {
+    printf("starting foo2\n");
+    self->running = true;
+    pthread_create(&self->thread, NULL, foo2_thread, self);
+    return OK;
+}
+
+int foo2_stop(foo2_t *self) {
+    printf("stopping foo2\n");
+    self->running = false;
+    pthread_kill(self->thread, SIGUSR1);
+    pthread_join(self->thread, NULL);
+    return OK;
+}
+
+int foo2_addExample(foo2_t *self, const example_t *example) {
+    //NOTE foo2 is suspended -> thread is not running  -> safe to update
+    int status = OK;
+    printf("Adding example %p for foo2\n", example);
+    status = arrayList_add(self->examples, (void *)example);
+    return status;
+}
+
+int foo2_removeExample(foo2_t *self, const example_t *example) {
+    //NOTE foo2 is suspended -> thread is not running  -> safe to update
+    int status = OK;
+    printf("Removing example %p for foo2\n", example);
+    status = arrayList_removeElement(self->examples, (void*)example);
+    return status;
+}
+
+static void* foo2_thread(void *userdata) {
+    foo2_t *self = userdata;
+    double result;
+    int rc;
+    while (self->running) {
+        unsigned int size = arrayList_size(self->examples);
+        int i;
+        for (i = 0; i < size; i += 1) {
+            const example_t* example = arrayList_get(self->examples, i);
+            rc = example->method(example->handle, 1, 2.0, &result);
+            if (rc == 0) {
+                printf("Result is %f\n", result);
+            } else {
+                printf("Error invoking method for example\n");
+            }
+        }
+        usleep(15000000);
+    }
+    return NULL;
+}
\ No newline at end of file
diff --git a/examples/services_example_c/foo2/private/src/foo2_activator.c b/examples/services_example_c/foo2/private/src/foo2_activator.c
new file mode 100644
index 0000000..5c047da
--- /dev/null
+++ b/examples/services_example_c/foo2/private/src/foo2_activator.c
@@ -0,0 +1,88 @@
+/**
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements.  See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.  The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+
+#include "dm_activator.h"
+#include "foo2.h"
+
+#include <stdlib.h>
+
+struct activator {
+	foo2_t *foo;
+};
+
+celix_status_t dm_create(bundle_context_pt context, void **userData) {
+	celix_status_t status = CELIX_SUCCESS;
+	struct activator *act = calloc(1, sizeof(*act));
+	if (act != NULL) {
+		act->foo = foo2_create();
+        if (act->foo != NULL) {
+            *userData = act;
+        } else {
+            free(act);
+        }
+	} else {
+		status = CELIX_ENOMEM;
+	}
+	return status;
+}
+
+celix_status_t dm_init(void *userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
+    celix_status_t status = CELIX_SUCCESS;
+	struct activator *activator = userData;
+
+	dm_component_pt cmp = NULL;
+	component_create(context, "FOO2", &cmp);
+	component_setImplementation(cmp, activator->foo);
+
+	/*
+	With the component_setCallbacksSafe we register callbacks when a component is started / stopped using a component
+	 with type foo1_t*
+	*/
+    component_setCallbacksSafe(cmp, foo2_t*, NULL, foo2_start, foo2_stop, NULL);
+
+	dm_service_dependency_pt dep = NULL;
+	serviceDependency_create(&dep);
+	serviceDependency_setRequired(dep, false);
+	serviceDependency_setService(dep, EXAMPLE_NAME, EXAMPLE_CONSUMER_RANGE, NULL);
+	serviceDependency_setStrategy(dep, DM_SERVICE_DEPENDENCY_STRATEGY_SUSPEND);
+
+	/*
+	With the serviceDependency_setCallbacksSafe we register callbacks when a service
+	is added and about to be removed for the component type foo1_t* and service type example_t*.
+
+	We should protect the usage of the
+ 	service because after removal of the service the memory location of that service
+	could be freed
+	*/
+    serviceDependency_setCallbacksSafe(dep, foo2_t*, const example_t*, NULL, foo2_addExample, NULL, foo2_removeExample, NULL);
+	component_addServiceDependency(cmp, dep);
+
+	dependencyManager_add(manager, cmp);
+
+    return status;
+}
+
+celix_status_t dm_destroy(void *userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
+	celix_status_t status = CELIX_SUCCESS;
+	struct activator *activator = userData;
+	foo2_destroy(activator->foo);
+	free(activator);
+	return status;
+};
+
diff --git a/examples/services_example_cxx/CMakeLists.txt b/examples/services_example_cxx/CMakeLists.txt
new file mode 100644
index 0000000..b74c454
--- /dev/null
+++ b/examples/services_example_cxx/CMakeLists.txt
@@ -0,0 +1,46 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+if (BUILD_DEPENDENCY_MANAGER_CXX)
+
+    set(CMAKE_CXX_FLAGS "-Wall -Werror -fno-rtti -fno-exceptions ${CMAKE_CXX_FLAGS}")
+
+    include_directories(
+            ${PROJECT_SOURCE_DIR}/dependency_manager/public/include
+            ${PROJECT_SOURCE_DIR}/dependency_manager_cxx/include
+            ${PROJECT_SOURCE_DIR}/utils/public/include
+            api
+    )
+
+    add_subdirectory(bar)
+    add_subdirectory(foo)
+    add_subdirectory(baz)
+
+    add_deploy(services_example_cxx
+        GROUP services_example
+        COPY
+        BUNDLES
+            shell
+            shell_tui
+            dm_shell
+            bar_cxx
+            foo_cxx
+            baz_cxx
+        PROPERTIES
+            example=value
+    )
+
+endif ()
diff --git a/examples/producer_consumer/database/public/include/data.h b/examples/services_example_cxx/api/IAnotherExample.h
similarity index 65%
copy from examples/producer_consumer/database/public/include/data.h
copy to examples/services_example_cxx/api/IAnotherExample.h
index d5bd059..0cd6c22 100644
--- a/examples/producer_consumer/database/public/include/data.h
+++ b/examples/services_example_cxx/api/IAnotherExample.h
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0 
- * 
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -17,22 +17,18 @@
  * under the License.
  */
 
-/*
- * data.h
- *
- *  \date       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
+#ifndef IANOTHER_EXAMPLE_H
+#define IANOTHER_EXAMPLE_H
 
-#ifndef _DATA_H_
-#define _DATA_H_
+#define IANOTHER_EXAMPLE_VERSION "1.0.0"
+#define IANOTHER_EXAMPLE_CONSUMER_RANGE "[1.0.0,2.0.0)"
 
-struct data {
-    int id;
-    char description[100];
+class IAnotherExample {
+protected:
+    IAnotherExample() = default;
+    virtual ~IAnotherExample() = default;
+public:
+    virtual double method(int arg1, double arg2) = 0;
 };
 
-typedef struct data* data_pt;
-
-#endif
+#endif //IANOTHER_EXAMPLE_H
diff --git a/hessian/source/private/test/test_service_proxy.c b/examples/services_example_cxx/api/example.h
similarity index 65%
rename from hessian/source/private/test/test_service_proxy.c
rename to examples/services_example_cxx/api/example.h
index 75a609a..68ce0e3 100644
--- a/hessian/source/private/test/test_service_proxy.c
+++ b/examples/services_example_cxx/api/example.h
@@ -16,20 +16,28 @@
  *specific language governing permissions and limitations
  *under the License.
  */
-/*
- * test_service_proxy.c
- *
- *  \date       Aug 5, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
 
-#include "hessian_2.0_out.h"
+#ifndef EXAMPLE_H_
+#define EXAMPLE_H_
 
-void testServiceProxy_sayHello(char *message) {
-	hessian_out_pt out = malloc(sizeof(*out));
+#ifdef __cplusplus
+extern "C" {
+#endif
 
-	hessian_writeString(out, message);
+#define EXAMPLE_NAME 			"org.example"
+#define EXAMPLE_VERSION 		"1.0.0"
+#define EXAMPLE_CONSUMER_RANGE   "[1.0.0,2.0.0)"
 
-	// tcp send out->buffer;
+
+struct example_struct {
+	void *handle;
+	int (*method)(void *handle, int arg1, double arg2, double *result);
+} ;
+
+typedef struct example_struct example_t;
+
+#ifdef __cplusplus
 }
+#endif
+
+#endif /* EXAMPLE_H_ */
diff --git a/examples/services_example_cxx/bar/CMakeLists.txt b/examples/services_example_cxx/bar/CMakeLists.txt
new file mode 100644
index 0000000..d43b1b5
--- /dev/null
+++ b/examples/services_example_cxx/bar/CMakeLists.txt
@@ -0,0 +1,39 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+include_directories(
+        private/include
+)
+
+add_bundle(bar_cxx
+    SYMBOLIC_NAME Bar
+    VERSION 1.0.0
+    SOURCES
+        private/src/Bar.cc
+        private/src/BarActivator.cc
+)
+
+IF(APPLE)
+    target_link_libraries(bar_cxx celix_framework -Wl,-all_load dependency_manager_cxx_static)
+else()
+    if(ENABLE_ADDRESS_SANITIZER)
+        #With asan there can be undefined symbols
+        target_link_libraries(bar_cxx -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
+    else()
+        target_link_libraries(bar_cxx -Wl,--no-undefined -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
+    endif()
+endif()
\ No newline at end of file
diff --git a/examples/producer_consumer/database/private/include/reader_service_impl.h b/examples/services_example_cxx/bar/private/include/Bar.h
similarity index 63%
copy from examples/producer_consumer/database/private/include/reader_service_impl.h
copy to examples/services_example_cxx/bar/private/include/Bar.h
index 6db7195..c7b0955 100644
--- a/examples/producer_consumer/database/private/include/reader_service_impl.h
+++ b/examples/services_example_cxx/bar/private/include/Bar.h
@@ -17,23 +17,24 @@
  * under the License.
  */
 
-/*
- * reader_service_impl.h
- *
- *  \date       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
+#ifndef BAR_H
+#define BAR_H
 
+#include "IAnotherExample.h"
 
+class Bar : public IAnotherExample {
+    const double seed = 42;
+public:
+    Bar() = default;
+    virtual ~Bar() = default;
 
-#ifndef READER_SERVICE_IMPL_H_
-#define READER_SERVICE_IMPL_H_
+    void init();
+    void start();
+    void stop();
+    void deinit();
 
-#include "data.h"
-#include "database.h"
+    virtual double method(int arg1, double arg2); //implementation of IAnotherExample::method
+    int cMethod(int arg1, double arg2, double *out); //implementation of example_t->method;
+};
 
-celix_status_t readerService_getFirstData(database_handler_pt, data_pt firstData);
-celix_status_t readerService_getNextData(database_handler_pt, data_pt* nextData);
-
-#endif
+#endif //BAR_H
diff --git a/examples/producer_consumer/database/public/include/data.h b/examples/services_example_cxx/bar/private/include/BarActivator.h
similarity index 65%
copy from examples/producer_consumer/database/public/include/data.h
copy to examples/services_example_cxx/bar/private/include/BarActivator.h
index d5bd059..043a9f7 100644
--- a/examples/producer_consumer/database/public/include/data.h
+++ b/examples/services_example_cxx/bar/private/include/BarActivator.h
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0 
- * 
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -17,22 +17,20 @@
  * under the License.
  */
 
-/*
- * data.h
- *
- *  \date       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
+#ifndef BAR_ACTIVATOR_H
+#define BAR_ACTIVATOR_H
 
-#ifndef _DATA_H_
-#define _DATA_H_
+#include "celix/dm/DmActivator.h"
+#include "example.h"
 
-struct data {
-    int id;
-    char description[100];
+using namespace celix::dm;
+
+class BarActivator : public DmActivator {
+private:
+    example_t cExample {nullptr, nullptr};
+public:
+    BarActivator(DependencyManager& mng) : DmActivator(mng) {}
+    virtual void init();
 };
 
-typedef struct data* data_pt;
-
-#endif
+#endif //BAR_ACTIVATOR_H
diff --git a/examples/producer_consumer/database/private/include/reader_service_impl.h b/examples/services_example_cxx/bar/private/src/Bar.cc
similarity index 61%
copy from examples/producer_consumer/database/private/include/reader_service_impl.h
copy to examples/services_example_cxx/bar/private/src/Bar.cc
index 6db7195..7490005 100644
--- a/examples/producer_consumer/database/private/include/reader_service_impl.h
+++ b/examples/services_example_cxx/bar/private/src/Bar.cc
@@ -17,23 +17,32 @@
  * under the License.
  */
 
-/*
- * reader_service_impl.h
- *
- *  \date       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
+#include "Bar.h"
+#include <iostream>
 
+void Bar::init() {
+    std::cout << "init Bar\n";
+}
 
+void Bar::start() {
+    std::cout << "start Bar\n";
+}
 
-#ifndef READER_SERVICE_IMPL_H_
-#define READER_SERVICE_IMPL_H_
+void Bar::stop() {
+    std::cout << "stop Bar\n";
+}
 
-#include "data.h"
-#include "database.h"
+void Bar::deinit() {
+    std::cout << "deinit Bar\n";
+}
 
-celix_status_t readerService_getFirstData(database_handler_pt, data_pt firstData);
-celix_status_t readerService_getNextData(database_handler_pt, data_pt* nextData);
+double Bar::method(int arg1, double arg2) {
+    double update = (this->seed + arg1) * arg2;
+    return update;
+}
 
-#endif
+int Bar::cMethod(int arg1, double arg2, double *out) {
+    double r = this->method(arg1, arg2);
+    *out = r;
+    return 0;
+}
\ No newline at end of file
diff --git a/examples/services_example_cxx/bar/private/src/BarActivator.cc b/examples/services_example_cxx/bar/private/src/BarActivator.cc
new file mode 100644
index 0000000..eeb128d
--- /dev/null
+++ b/examples/services_example_cxx/bar/private/src/BarActivator.cc
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "Bar.h"
+#include "BarActivator.h"
+
+using namespace celix::dm;
+
+DmActivator* DmActivator::create(DependencyManager& mng) {
+    return new BarActivator(mng);
+}
+
+void BarActivator::init() {
+    std::shared_ptr<Bar> bar = std::shared_ptr<Bar>{new Bar{}};
+
+    Properties props;
+    props["meta.info.key"] = "meta.info.value";
+
+    Properties cProps;
+    cProps["also.meta.info.key"] = "also.meta.info.value";
+
+    this->cExample.handle = bar.get();
+    this->cExample.method = [](void *handle, int arg1, double arg2, double *out) {
+        Bar* bar = static_cast<Bar*>(handle);
+        return bar->cMethod(arg1, arg2, out);
+    };
+
+    createComponent(bar)  //using a pointer a instance. Also supported is lazy initialization (default constructor needed) or a rvalue reference (move)
+        .addInterface<IAnotherExample>(IANOTHER_EXAMPLE_VERSION, props)
+        .addCInterface(&this->cExample, EXAMPLE_NAME, EXAMPLE_VERSION, cProps)
+        .setCallbacks(&Bar::init, &Bar::start, &Bar::stop, &Bar::deinit);
+}
\ No newline at end of file
diff --git a/examples/services_example_cxx/baz/CMakeLists.txt b/examples/services_example_cxx/baz/CMakeLists.txt
new file mode 100644
index 0000000..23ae7e4
--- /dev/null
+++ b/examples/services_example_cxx/baz/CMakeLists.txt
@@ -0,0 +1,39 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+include_directories(
+        private/include
+)
+
+add_bundle(baz_cxx
+    SYMBOLIC_NAME Baz
+    VERSION 1.0.0
+    SOURCES
+        private/src/Baz.cc
+        private/src/BazActivator.cc
+)
+
+IF(APPLE)
+    target_link_libraries(baz_cxx celix_framework -Wl,-all_load dependency_manager_cxx_static)
+else()
+    if(ENABLE_ADDRESS_SANITIZER)
+        #With asan there can be undefined symbols
+        target_link_libraries(baz_cxx -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
+    else()
+        target_link_libraries(baz_cxx -Wl,--no-undefined -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
+    endif()
+endif()
diff --git a/examples/services_example_cxx/baz/private/include/Baz.h b/examples/services_example_cxx/baz/private/include/Baz.h
new file mode 100644
index 0000000..d881627
--- /dev/null
+++ b/examples/services_example_cxx/baz/private/include/Baz.h
@@ -0,0 +1,54 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef BAZ_H
+#define BAZ_H
+
+#include "example.h"
+#include "IAnotherExample.h"
+#include <thread>
+#include <list>
+#include <mutex>
+
+class Baz  {
+    std::list<IAnotherExample*> examples {};
+    std::mutex lock_for_examples {};
+
+    std::list<const example_t*> cExamples {};
+    std::mutex lock_for_cExamples {};
+
+    std::thread pollThread {};
+    bool running = false;
+public:
+    Baz() = default;
+    virtual ~Baz() = default;
+
+    void start();
+    void stop();
+
+    void addAnotherExample(IAnotherExample* e);
+    void removeAnotherExample(IAnotherExample* e);
+
+    void addExample(const example_t* e);
+    void removeExample(const example_t* e);
+
+    void poll();
+};
+
+#endif //BAZ_H
diff --git a/examples/producer_consumer/database/public/include/data.h b/examples/services_example_cxx/baz/private/include/BazActivator.h
similarity index 67%
copy from examples/producer_consumer/database/public/include/data.h
copy to examples/services_example_cxx/baz/private/include/BazActivator.h
index d5bd059..eaac934 100644
--- a/examples/producer_consumer/database/public/include/data.h
+++ b/examples/services_example_cxx/baz/private/include/BazActivator.h
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0 
- * 
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -17,22 +17,18 @@
  * under the License.
  */
 
-/*
- * data.h
- *
- *  \date       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
+#ifndef BAZ_ACTIVATOR_H
+#define BAZ_ACTIVATOR_H
 
-#ifndef _DATA_H_
-#define _DATA_H_
+#include "celix/dm/DmActivator.h"
 
-struct data {
-    int id;
-    char description[100];
+using namespace celix::dm;
+
+class BazActivator : public DmActivator {
+private:
+public:
+    BazActivator(DependencyManager& mng) : DmActivator(mng) {}
+    virtual void init();
 };
 
-typedef struct data* data_pt;
-
-#endif
+#endif //BAZ_ACTIVATOR_H
diff --git a/examples/services_example_cxx/baz/private/src/Baz.cc b/examples/services_example_cxx/baz/private/src/Baz.cc
new file mode 100644
index 0000000..bf258fb
--- /dev/null
+++ b/examples/services_example_cxx/baz/private/src/Baz.cc
@@ -0,0 +1,84 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "Baz.h"
+#include <iostream>
+
+void Baz::start() {
+    std::cout << "start Baz\n";
+    this->running = true;
+    pollThread = std::thread {&Baz::poll, this};
+}
+
+void Baz::stop() {
+    std::cout << "stop Baz\n";
+    this->running = false;
+    this->pollThread.join();
+}
+
+void Baz::addAnotherExample(IAnotherExample *e) {
+    std::lock_guard<std::mutex> lock(this->lock_for_examples);
+    this->examples.push_back(e);
+}
+
+void Baz::removeAnotherExample(IAnotherExample *e) {
+    std::lock_guard<std::mutex> lock(this->lock_for_examples);
+    this->examples.remove(e);
+}
+
+void Baz::addExample(const example_t *e) {
+    std::lock_guard<std::mutex> lock(this->lock_for_cExamples);
+    this->cExamples.push_back(e);
+}
+
+void Baz::removeExample(const example_t *e) {
+    std::lock_guard<std::mutex> lock(this->lock_for_cExamples);
+    this->cExamples.remove(e);
+}
+
+void Baz::poll() {
+    double r1 = 1.0;
+    double r2 = 1.0;
+    while (this->running) {
+        //c++ service required -> if component started always available
+
+        {
+            std::lock_guard<std::mutex> lock(this->lock_for_examples);
+            int index = 0;
+            for (IAnotherExample *e : this->examples) {
+                r1 = e->method(3, r1);
+                std::cout << "Result IAnotherExample " << index++ << " is " << r1 << "\n";
+            }
+        }
+
+
+        {
+            std::lock_guard<std::mutex> lock(this->lock_for_cExamples);
+            int index = 0;
+            for (const example_t *e : this->cExamples) {
+                double out;
+                e->method(e->handle, 4, r2, &out);
+                r2 = out;
+                std::cout << "Result example_t " << index++ << " is " << r2 << "\n";
+            }
+        }
+
+        std::this_thread::sleep_for(std::chrono::milliseconds(4000));
+    }
+}
\ No newline at end of file
diff --git a/examples/services_example_cxx/baz/private/src/BazActivator.cc b/examples/services_example_cxx/baz/private/src/BazActivator.cc
new file mode 100644
index 0000000..f4f43c3
--- /dev/null
+++ b/examples/services_example_cxx/baz/private/src/BazActivator.cc
@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "Baz.h"
+#include "BazActivator.h"
+
+using namespace celix::dm;
+
+DmActivator* DmActivator::create(DependencyManager& mng) {
+    return new BazActivator(mng);
+}
+
+void BazActivator::init() {
+
+    Component<Baz>& cmp = createComponent<Baz>()
+        .setCallbacks(nullptr, &Baz::start, &Baz::stop, nullptr);
+
+    cmp.createServiceDependency<IAnotherExample>()
+            .setRequired(true)
+            .setStrategy(DependencyUpdateStrategy::locking)
+            .setVersionRange(IANOTHER_EXAMPLE_CONSUMER_RANGE)
+            .setCallbacks(&Baz::addAnotherExample, &Baz::removeAnotherExample);
+
+    cmp.createCServiceDependency<example_t>(EXAMPLE_NAME)
+            .setRequired(false)
+            .setStrategy(DependencyUpdateStrategy::locking)
+            .setVersionRange(EXAMPLE_CONSUMER_RANGE)
+            .setCallbacks(&Baz::addExample, &Baz::removeExample);
+}
\ No newline at end of file
diff --git a/examples/services_example_cxx/foo/CMakeLists.txt b/examples/services_example_cxx/foo/CMakeLists.txt
new file mode 100644
index 0000000..6c36936
--- /dev/null
+++ b/examples/services_example_cxx/foo/CMakeLists.txt
@@ -0,0 +1,39 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+include_directories(
+        private/include
+)
+
+add_bundle(foo_cxx
+    SYMBOLIC_NAME Foo
+    VERSION 1.0.0
+    SOURCES
+        private/src/Foo.cc
+        private/src/FooActivator.cc
+)
+
+IF(APPLE)
+    target_link_libraries(foo_cxx celix_framework -Wl,-all_load dependency_manager_cxx_static)
+else()
+    if(ENABLE_ADDRESS_SANITIZER)
+        #With asan there can be undefined symbols
+        target_link_libraries(foo_cxx -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
+    else()
+        target_link_libraries(foo_cxx -Wl,--no-undefined -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
+    endif()
+endif()
\ No newline at end of file
diff --git a/examples/producer_consumer/database/private/include/reader_service_impl.h b/examples/services_example_cxx/foo/private/include/Foo.h
similarity index 63%
rename from examples/producer_consumer/database/private/include/reader_service_impl.h
rename to examples/services_example_cxx/foo/private/include/Foo.h
index 6db7195..a07ddba 100644
--- a/examples/producer_consumer/database/private/include/reader_service_impl.h
+++ b/examples/services_example_cxx/foo/private/include/Foo.h
@@ -17,23 +17,29 @@
  * under the License.
  */
 
-/*
- * reader_service_impl.h
- *
- *  \date       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
+#ifndef FOO_H
+#define FOO_H
 
+#include "example.h"
+#include "IAnotherExample.h"
+#include <thread>
 
+class Foo  {
+    IAnotherExample* example {nullptr};
+    const example_t* cExample {nullptr};
+    std::thread pollThread {};
+    bool running = false;
+public:
+    Foo() = default;
+    virtual ~Foo() = default;
 
-#ifndef READER_SERVICE_IMPL_H_
-#define READER_SERVICE_IMPL_H_
+    void start();
+    void stop();
 
-#include "data.h"
-#include "database.h"
+    void setAnotherExample(IAnotherExample* e);
+    void setExample(const example_t* e);
 
-celix_status_t readerService_getFirstData(database_handler_pt, data_pt firstData);
-celix_status_t readerService_getNextData(database_handler_pt, data_pt* nextData);
+    void poll();
+};
 
-#endif
+#endif //FOO_H
diff --git a/examples/producer_consumer/database/public/include/data.h b/examples/services_example_cxx/foo/private/include/FooActivator.h
similarity index 67%
rename from examples/producer_consumer/database/public/include/data.h
rename to examples/services_example_cxx/foo/private/include/FooActivator.h
index d5bd059..5559697 100644
--- a/examples/producer_consumer/database/public/include/data.h
+++ b/examples/services_example_cxx/foo/private/include/FooActivator.h
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0 
- * 
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -17,22 +17,18 @@
  * under the License.
  */
 
-/*
- * data.h
- *
- *  \date       16 Feb 2015
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
+#ifndef FOO_ACTIVATOR_H
+#define FOO_ACTIVATOR_H
 
-#ifndef _DATA_H_
-#define _DATA_H_
+#include "celix/dm/DmActivator.h"
 
-struct data {
-    int id;
-    char description[100];
+using namespace celix::dm;
+
+class FooActivator : public DmActivator {
+private:
+public:
+    FooActivator(DependencyManager& mng) : DmActivator(mng) {}
+    virtual void init();
 };
 
-typedef struct data* data_pt;
-
-#endif
+#endif //FOO_ACTIVATOR_H
diff --git a/examples/services_example_cxx/foo/private/src/Foo.cc b/examples/services_example_cxx/foo/private/src/Foo.cc
new file mode 100644
index 0000000..241513c
--- /dev/null
+++ b/examples/services_example_cxx/foo/private/src/Foo.cc
@@ -0,0 +1,60 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "Foo.h"
+#include <iostream>
+
+void Foo::start() {
+    std::cout << "start Foo\n";
+    this->running = true;
+    pollThread = std::thread {&Foo::poll, this};
+}
+
+void Foo::stop() {
+    std::cout << "stop Foo\n";
+    this->running = false;
+    this->pollThread.join();
+}
+
+void Foo::setAnotherExample(IAnotherExample *e) {
+    this->example = e;
+}
+
+void Foo::setExample(const example_t *e) {
+    this->cExample = e;
+}
+
+void Foo::poll() {
+    double r1 = 1.0;
+    double r2 = 1.0;
+    while (this->running) {
+        //c++ service required -> if component started always available
+        r1 = this->example->method(3, r1);
+        std::cout << "Result IAnotherExample is " << r1 << "\n";
+
+        //c service is optional, can be nullptr
+        if (this->cExample != nullptr) {
+            double out;
+            this->cExample->method(this->cExample->handle, 4, r2, &out);
+            r2 = out;
+            std::cout << "Result example_t is " << r2 << "\n";
+        }
+        std::this_thread::sleep_for(std::chrono::milliseconds(5000));
+    }
+}
\ No newline at end of file
diff --git a/examples/services_example_cxx/foo/private/src/FooActivator.cc b/examples/services_example_cxx/foo/private/src/FooActivator.cc
new file mode 100644
index 0000000..57d702b
--- /dev/null
+++ b/examples/services_example_cxx/foo/private/src/FooActivator.cc
@@ -0,0 +1,43 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "Foo.h"
+#include "FooActivator.h"
+
+using namespace celix::dm;
+
+DmActivator* DmActivator::create(DependencyManager& mng) {
+    return new FooActivator(mng);
+}
+
+void FooActivator::init() {
+
+    Component<Foo>& cmp = createComponent<Foo>()
+        .setCallbacks(nullptr, &Foo::start, &Foo::stop, nullptr);
+
+    cmp.createServiceDependency<IAnotherExample>()
+            .setRequired(true)
+            .setVersionRange(IANOTHER_EXAMPLE_CONSUMER_RANGE)
+            .setCallbacks(&Foo::setAnotherExample);
+
+    cmp.createCServiceDependency<example_t>(EXAMPLE_NAME)
+            .setRequired(false)
+            .setVersionRange(EXAMPLE_CONSUMER_RANGE)
+            .setCallbacks(&Foo::setExample);
+}
\ No newline at end of file
diff --git a/examples/whiteboard/CMakeLists.txt b/examples/whiteboard/CMakeLists.txt
index 5f01b87..b904241 100644
--- a/examples/whiteboard/CMakeLists.txt
+++ b/examples/whiteboard/CMakeLists.txt
@@ -18,4 +18,7 @@
 add_subdirectory(publisherA)
 add_subdirectory(publisherB)
 add_subdirectory(tracker)
-add_subdirectory(tracker_depman)
\ No newline at end of file
+add_subdirectory(tracker_depman)
+
+add_deploy("whiteboard" GROUP whiteboard BUNDLES tracker publisherA publisherB shell shell_tui log_service log_writer)
+add_deploy("whiteboard_dependency_manager" GROUP whiteboard BUNDLES tracker_depman publisherA publisherB shell shell_tui log_service log_writer dm_shell)
\ No newline at end of file
diff --git a/examples/whiteboard/tracker_depman/private/include/tracker.h b/examples/whiteboard/tracker_depman/private/include/tracker.h
index 3b078ca..55438d2 100644
--- a/examples/whiteboard/tracker_depman/private/include/tracker.h
+++ b/examples/whiteboard/tracker_depman/private/include/tracker.h
@@ -44,15 +44,15 @@
 	celix_thread_mutex_t publisher_lock;
 };
 
-celix_status_t tracker_setServ(void * handle, service_reference_pt ref, void * service);
-celix_status_t tracker_addedServ(void * handle, service_reference_pt ref, void * service);
-celix_status_t tracker_modifiedServ(void * handle, service_reference_pt ref, void * service);
-celix_status_t tracker_removedServ(void * handle, service_reference_pt ref, void * service);
+celix_status_t tracker_setServ(void * handle, service_reference_pt ref, const void * service);
+celix_status_t tracker_addedServ(void * handle, service_reference_pt ref, const void * service);
+celix_status_t tracker_modifiedServ(void * handle, service_reference_pt ref, const void * service);
+celix_status_t tracker_removedServ(void * handle, service_reference_pt ref, const void * service);
 
-celix_status_t tracker_setLog(void * handle, service_reference_pt ref, void * service);
-celix_status_t tracker_addLog(void * handle, service_reference_pt ref, void * service);
-celix_status_t tracker_modifiedLog(void * handle, service_reference_pt ref, void * service);
-celix_status_t tracker_removeLog(void * handle, service_reference_pt ref, void * service);
+celix_status_t tracker_setLog(void * handle, service_reference_pt ref, const void * service);
+celix_status_t tracker_addLog(void * handle, service_reference_pt ref, const void * service);
+celix_status_t tracker_modifiedLog(void * handle, service_reference_pt ref, const void * service);
+celix_status_t tracker_removeLog(void * handle, service_reference_pt ref, const void * service);
 
 celix_status_t service_init(void * userData);
 celix_status_t service_start(void * userData);
diff --git a/examples/whiteboard/tracker_depman/private/src/dependency_activator.c b/examples/whiteboard/tracker_depman/private/src/dependency_activator.c
index 1ee279e..9ac295d 100644
--- a/examples/whiteboard/tracker_depman/private/src/dependency_activator.c
+++ b/examples/whiteboard/tracker_depman/private/src/dependency_activator.c
@@ -68,7 +68,7 @@
     serviceDependency_setRequired(dep2, false);
     serviceDependency_setService(dep2, (char *) OSGI_LOGSERVICE_NAME, NULL,  NULL);
     serviceDependency_setCallbacksWithServiceReference(dep2, NULL  /*tracker_setLog*/, tracker_addLog, tracker_modifiedLog, tracker_removeLog, NULL);
-	serviceDependency_setAutoConfigure(dep2, &data->logger_lock, (void **) &data->logger);
+	serviceDependency_setAutoConfigure(dep2, &data->logger_lock, (const void **) &data->logger);
     component_addServiceDependency(service, dep2);
 
 	data->service = service;
diff --git a/examples/whiteboard/tracker_depman/private/src/tracker.c b/examples/whiteboard/tracker_depman/private/src/tracker.c
index 5688810..d38abb9 100644
--- a/examples/whiteboard/tracker_depman/private/src/tracker.c
+++ b/examples/whiteboard/tracker_depman/private/src/tracker.c
@@ -81,60 +81,60 @@
 	return CELIX_SUCCESS;
 }
 
-celix_status_t tracker_setServ(void * handle, service_reference_pt ref, void * service) {
+celix_status_t tracker_setServ(void * handle, service_reference_pt ref, const void * service) {
 	printf("Service Set %p\n", service);
 	return CELIX_SUCCESS;
 }
 
 
-celix_status_t tracker_addedServ(void * handle, service_reference_pt ref, void * service) {
+celix_status_t tracker_addedServ(void * handle, service_reference_pt ref, const void * service) {
 	struct data * data = (struct data *) handle;
-	arrayList_add(data->publishers, service);
+	arrayList_add(data->publishers, (void*)service);
 	printf("Service Added %p\n", service);
 	return CELIX_SUCCESS;
 }
 
-celix_status_t tracker_modifiedServ(void * handle, service_reference_pt ref, void * service) {
+celix_status_t tracker_modifiedServ(void * handle, service_reference_pt ref, const void * service) {
     printf("Service Changed\n");
 	return CELIX_SUCCESS;
 }
 
-celix_status_t tracker_removedServ(void * handle, service_reference_pt ref, void * service) {
+celix_status_t tracker_removedServ(void * handle, service_reference_pt ref, const void * service) {
 	struct data * data = (struct data *) handle;
-	arrayList_removeElement(data->publishers, service);
+	arrayList_removeElement(data->publishers, (void*) service);
 	printf("Service Removed\n");
 	return CELIX_SUCCESS;
 }
 
-celix_status_t tracker_setLog(void *handle, service_reference_pt ref, void *service) {
+celix_status_t tracker_setLog(void *handle, service_reference_pt ref, const void *service) {
 	struct data * data = (struct data *) handle;
 
 	printf("SET log %p\n", service);
 	if(service) {
-		data->logger = service;
+		data->logger = (log_service_pt)service;
 		((log_service_pt) service)->log(((log_service_pt) service)->logger, OSGI_LOGSERVICE_DEBUG, "SET log");
 	}
 	fprintf(stderr, "SET end %p\n", service);
 	return CELIX_SUCCESS;
 }
 
-celix_status_t tracker_addLog(void *handle, service_reference_pt ref, void *service) {
+celix_status_t tracker_addLog(void *handle, service_reference_pt ref, const void *service) {
     struct data * data = (struct data *) handle;
     printf("Add log %p\n", service);
-    data->logger = service;
+    data->logger = (log_service_pt)service;
     ((log_service_pt) service)->log(((log_service_pt) service)->logger, OSGI_LOGSERVICE_DEBUG, "test");
     return CELIX_SUCCESS;
 }
 
-celix_status_t tracker_modifiedLog(void *handle, service_reference_pt ref, void *service) {
+celix_status_t tracker_modifiedLog(void *handle, service_reference_pt ref, const void *service) {
     struct data * data = (struct data *) handle;
     printf("Modify log\n");
-    data->logger = service;
+    data->logger = (void*)service;
     ((log_service_pt) service)->log(((log_service_pt) service)->logger, OSGI_LOGSERVICE_DEBUG, "test");
     return CELIX_SUCCESS;
 }
 
-celix_status_t tracker_removeLog(void *handle, service_reference_pt ref, void *service) {
+celix_status_t tracker_removeLog(void *handle, service_reference_pt ref, const void *service) {
     struct data * data = (struct data *) handle;
     data->logger = NULL;
     printf("Remove log\n");
diff --git a/framework/CMakeLists.txt b/framework/CMakeLists.txt
index c08b27c..06f0c9f 100644
--- a/framework/CMakeLists.txt
+++ b/framework/CMakeLists.txt
@@ -76,7 +76,7 @@
     endif()
     target_link_libraries(celix_framework celix_utils ${UUID} ${ZLIB_LIBRARY} ${CURL_LIBRARIES})
 
-    install(TARGETS celix_framework DESTINATION lib COMPONENT framework)
+    install(TARGETS celix_framework DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT framework)
     FILE(GLOB files "public/include/*.h")
     INSTALL(FILES ${files} DESTINATION include/celix COMPONENT framework)
     INSTALL(DIRECTORY "${PROJECT_SOURCE_DIR}/cmake/" DESTINATION share/celix/cmake/modules COMPONENT framework) 
@@ -304,6 +304,7 @@
             private/mock/service_registration_mock.c
             private/mock/properties_mock.c
             private/src/service_registry.c
+            private/mock/module_mock.c
             private/src/celix_errorcodes.c
             private/mock/celix_log_mock.c)
         target_link_libraries(service_registry_test ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} celix_utils pthread)
diff --git a/framework/private/include/bundle_cache.h b/framework/private/include/bundle_cache.h
index 0deab40..350f33b 100644
--- a/framework/private/include/bundle_cache.h
+++ b/framework/private/include/bundle_cache.h
@@ -95,7 +95,7 @@
  * 		- CELIX_ILLEGAL_ARGUMENT If <code>bundle_archive</code> not is null.
  * 		- CELIX_ENOMEM If allocating memory for <code>bundle_archive</code> failed.
  */
-celix_status_t bundleCache_createArchive(bundle_cache_pt cache, long id, char * location, char *inputFile, bundle_archive_pt *archive);
+celix_status_t bundleCache_createArchive(bundle_cache_pt cache, long id, const char* location, const char* inputFile, bundle_archive_pt *archive);
 
 /**
  * Deletes the entire bundle cache.
diff --git a/framework/private/include/framework_private.h b/framework/private/include/framework_private.h
index b3430f8..124a4b6 100644
--- a/framework/private/include/framework_private.h
+++ b/framework/private/include/framework_private.h
@@ -93,29 +93,29 @@
 celix_status_t framework_start(framework_pt framework);
 void framework_stop(framework_pt framework);
 
-FRAMEWORK_EXPORT celix_status_t fw_getProperty(framework_pt framework, const char *name, char **value);
+FRAMEWORK_EXPORT celix_status_t fw_getProperty(framework_pt framework, const char* name, const char* defaultValue, const char** value);
 
-FRAMEWORK_EXPORT celix_status_t fw_installBundle(framework_pt framework, bundle_pt * bundle, char * location, char *inputFile);
+FRAMEWORK_EXPORT celix_status_t fw_installBundle(framework_pt framework, bundle_pt * bundle, const char * location, const char *inputFile);
 FRAMEWORK_EXPORT celix_status_t fw_uninstallBundle(framework_pt framework, bundle_pt bundle);
 
-FRAMEWORK_EXPORT celix_status_t framework_getBundleEntry(framework_pt framework, bundle_pt bundle, char *name, char **entry);
+FRAMEWORK_EXPORT celix_status_t framework_getBundleEntry(framework_pt framework, bundle_pt bundle, const char* name, char** entry);
 
 FRAMEWORK_EXPORT celix_status_t fw_startBundle(framework_pt framework, bundle_pt bundle, int options);
-FRAMEWORK_EXPORT celix_status_t framework_updateBundle(framework_pt framework, bundle_pt bundle, char *inputFile);
+FRAMEWORK_EXPORT celix_status_t framework_updateBundle(framework_pt framework, bundle_pt bundle, const char* inputFile);
 FRAMEWORK_EXPORT celix_status_t fw_stopBundle(framework_pt framework, bundle_pt bundle, bool record);
 
-FRAMEWORK_EXPORT celix_status_t fw_registerService(framework_pt framework, service_registration_pt * registration, bundle_pt bundle, char * serviceName, void * svcObj, properties_pt properties);
-FRAMEWORK_EXPORT celix_status_t fw_registerServiceFactory(framework_pt framework, service_registration_pt * registration, bundle_pt bundle, char * serviceName, service_factory_pt factory, properties_pt properties);
+FRAMEWORK_EXPORT celix_status_t fw_registerService(framework_pt framework, service_registration_pt * registration, bundle_pt bundle, const char* serviceName, const void* svcObj, properties_pt properties);
+FRAMEWORK_EXPORT celix_status_t fw_registerServiceFactory(framework_pt framework, service_registration_pt * registration, bundle_pt bundle, const char* serviceName, service_factory_pt factory, properties_pt properties);
 FRAMEWORK_EXPORT void fw_unregisterService(service_registration_pt registration);
 
-FRAMEWORK_EXPORT celix_status_t fw_getServiceReferences(framework_pt framework, array_list_pt *references, bundle_pt bundle, const char * serviceName, char * filter);
+FRAMEWORK_EXPORT celix_status_t fw_getServiceReferences(framework_pt framework, array_list_pt *references, bundle_pt bundle, const char* serviceName, const char* filter);
 FRAMEWORK_EXPORT celix_status_t framework_ungetServiceReference(framework_pt framework, bundle_pt bundle, service_reference_pt reference);
-FRAMEWORK_EXPORT celix_status_t fw_getService(framework_pt framework, bundle_pt bundle, service_reference_pt reference, void **service);
+FRAMEWORK_EXPORT celix_status_t fw_getService(framework_pt framework, bundle_pt bundle, service_reference_pt reference, const void** service);
 FRAMEWORK_EXPORT celix_status_t framework_ungetService(framework_pt framework, bundle_pt bundle, service_reference_pt reference, bool *result);
 FRAMEWORK_EXPORT celix_status_t fw_getBundleRegisteredServices(framework_pt framework, bundle_pt bundle, array_list_pt *services);
 FRAMEWORK_EXPORT celix_status_t fw_getBundleServicesInUse(framework_pt framework, bundle_pt bundle, array_list_pt *services);
 
-FRAMEWORK_EXPORT void fw_addServiceListener(framework_pt framework, bundle_pt bundle, service_listener_pt listener, char * filter);
+FRAMEWORK_EXPORT void fw_addServiceListener(framework_pt framework, bundle_pt bundle, service_listener_pt listener, const char* filter);
 FRAMEWORK_EXPORT void fw_removeServiceListener(framework_pt framework, bundle_pt bundle, service_listener_pt listener);
 
 FRAMEWORK_EXPORT celix_status_t fw_addBundleListener(framework_pt framework, bundle_pt bundle, bundle_listener_pt listener);
@@ -126,7 +126,7 @@
 
 FRAMEWORK_EXPORT void fw_serviceChanged(framework_pt framework, service_event_type_e eventType, service_registration_pt registration, properties_pt oldprops);
 
-FRAMEWORK_EXPORT celix_status_t fw_isServiceAssignable(framework_pt fw, bundle_pt requester, service_reference_pt reference, bool *assignable);
+FRAMEWORK_EXPORT celix_status_t fw_isServiceAssignable(framework_pt fw, bundle_pt requester, service_reference_pt reference, bool* assignable);
 
 //bundle_archive_t fw_createArchive(long id, char * location);
 //void revise(bundle_archive_t archive, char * location);
@@ -139,7 +139,7 @@
 FRAMEWORK_EXPORT celix_status_t framework_markResolvedModules(framework_pt framework, linked_list_pt wires);
 
 FRAMEWORK_EXPORT array_list_pt framework_getBundles(framework_pt framework);
-FRAMEWORK_EXPORT bundle_pt framework_getBundle(framework_pt framework, char * location);
+FRAMEWORK_EXPORT bundle_pt framework_getBundle(framework_pt framework, const char* location);
 FRAMEWORK_EXPORT bundle_pt framework_getBundleById(framework_pt framework, long id);
 
 #endif /* FRAMEWORK_PRIVATE_H_ */
diff --git a/framework/private/include/manifest_parser.h b/framework/private/include/manifest_parser.h
index 5cfd133..d6b062b 100644
--- a/framework/private/include/manifest_parser.h
+++ b/framework/private/include/manifest_parser.h
@@ -37,7 +37,7 @@
 celix_status_t manifestParser_create(module_pt owner, manifest_pt manifest, manifest_parser_pt *manifest_parser);
 celix_status_t manifestParser_destroy(manifest_parser_pt mp);
 
-celix_status_t manifestParser_getSymbolicName(manifest_parser_pt parser, char **symbolicName);
+celix_status_t manifestParser_getAndDuplicateSymbolicName(manifest_parser_pt parser, char **symbolicName);
 celix_status_t manifestParser_getBundleVersion(manifest_parser_pt parser, version_pt *version);
 celix_status_t manifestParser_getCapabilities(manifest_parser_pt parser, linked_list_pt *capabilities);
 celix_status_t manifestParser_getRequirements(manifest_parser_pt parser, linked_list_pt *requirements);
diff --git a/framework/private/include/service_reference_private.h b/framework/private/include/service_reference_private.h
index ab3b219..d7fcac1 100644
--- a/framework/private/include/service_reference_private.h
+++ b/framework/private/include/service_reference_private.h
@@ -37,7 +37,7 @@
 	bundle_pt referenceOwner;
 	struct serviceRegistration * registration;
     bundle_pt registrationBundle;
-    void *service;
+    const void* service;
 
 	size_t refCount;
     size_t usageCount;
@@ -59,7 +59,7 @@
 celix_status_t serviceReference_getUsageCount(service_reference_pt reference, size_t *count);
 celix_status_t serviceReference_getReferenceCount(service_reference_pt reference, size_t *count);
 
-celix_status_t serviceReference_setService(service_reference_pt ref, void *service);
+celix_status_t serviceReference_setService(service_reference_pt ref, const void *service);
 celix_status_t serviceReference_getService(service_reference_pt reference, void **service);
 
 celix_status_t serviceReference_getOwner(service_reference_pt reference, bundle_pt *owner);
diff --git a/framework/private/include/service_registration_private.h b/framework/private/include/service_registration_private.h
index 4b48e70..ca0cb67 100644
--- a/framework/private/include/service_registration_private.h
+++ b/framework/private/include/service_registration_private.h
@@ -37,13 +37,13 @@
 	char * className;
 	bundle_pt bundle;
 	properties_pt properties;
-	void * svcObj;
-	long serviceId;
+	const void * svcObj;
+	unsigned long serviceId;
 
 	bool isUnregistering;
 
 	bool isServiceFactory;
-	void *serviceFactory;
+	const void *serviceFactory;
 
 	struct service *services;
 	int nrOfServices;
@@ -53,8 +53,8 @@
 	celix_thread_rwlock_t lock;
 };
 
-service_registration_pt serviceRegistration_create(registry_callback_t callback, bundle_pt bundle, char * serviceName, long serviceId, void * serviceObject, properties_pt dictionary);
-service_registration_pt serviceRegistration_createServiceFactory(registry_callback_t callback, bundle_pt bundle, char * serviceName, long serviceId, void * serviceObject, properties_pt dictionary);
+service_registration_pt serviceRegistration_create(registry_callback_t callback, bundle_pt bundle, const char* serviceName, unsigned long serviceId, const void * serviceObject, properties_pt dictionary);
+service_registration_pt serviceRegistration_createServiceFactory(registry_callback_t callback, bundle_pt bundle, const char* serviceName, unsigned long serviceId, const void * serviceObject, properties_pt dictionary);
 
 void serviceRegistration_retain(service_registration_pt registration);
 void serviceRegistration_release(service_registration_pt registration);
@@ -62,10 +62,10 @@
 bool serviceRegistration_isValid(service_registration_pt registration);
 void serviceRegistration_invalidate(service_registration_pt registration);
 
-celix_status_t serviceRegistration_getService(service_registration_pt registration, bundle_pt bundle, void **service);
-celix_status_t serviceRegistration_ungetService(service_registration_pt registration, bundle_pt bundle, void **service);
+celix_status_t serviceRegistration_getService(service_registration_pt registration, bundle_pt bundle, const void **service);
+celix_status_t serviceRegistration_ungetService(service_registration_pt registration, bundle_pt bundle, const void **service);
 
 celix_status_t serviceRegistration_getBundle(service_registration_pt registration, bundle_pt *bundle);
-celix_status_t serviceRegistration_getServiceName(service_registration_pt registration, char **serviceName);
+celix_status_t serviceRegistration_getServiceName(service_registration_pt registration, const char **serviceName);
 
 #endif /* SERVICE_REGISTRATION_PRIVATE_H_ */
diff --git a/framework/private/include/service_registry_private.h b/framework/private/include/service_registry_private.h
index 8726ff7..d68fe11 100644
--- a/framework/private/include/service_registry_private.h
+++ b/framework/private/include/service_registry_private.h
@@ -36,13 +36,13 @@
 	registry_callback_t callback;
 
 	hash_map_pt serviceRegistrations; //key = bundle (reg owner), value = list ( registration )
-	hash_map_pt serviceReferences; //key = bundle, value = map (key = registration, value = reference)
+	hash_map_pt serviceReferences; //key = bundle, value = map (key = serviceId, value = reference)
 
 	bool checkDeletedReferences; //If enabled. check if provided service references are still valid
 	hash_map_pt deletedServiceReferences; //key = ref pointer, value = bool
 
 	serviceChanged_function_pt serviceChanged;
-	long currentServiceId;
+	unsigned long currentServiceId;
 
 	array_list_pt listenerHooks;
 
diff --git a/framework/private/mock/bundle_archive_mock.c b/framework/private/mock/bundle_archive_mock.c
index 6493c79..b352366 100644
--- a/framework/private/mock/bundle_archive_mock.c
+++ b/framework/private/mock/bundle_archive_mock.c
@@ -27,7 +27,7 @@
 
 #include "bundle_archive.h"
 
-celix_status_t bundleArchive_create(char * archiveRoot, long id, char * location, char *inputFile, bundle_archive_pt *bundle_archive) {
+celix_status_t bundleArchive_create(const char * archiveRoot, long id, const char * location, const char *inputFile, bundle_archive_pt *bundle_archive) {
 	mock_c()->actualCall("bundleArchive_create")
 			->withStringParameters("archiveRoot", archiveRoot)
 			->withIntParameters("id", id)
@@ -43,7 +43,7 @@
 	return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t bundleArchive_recreate(char * archiveRoot, bundle_archive_pt *bundle_archive) {
+celix_status_t bundleArchive_recreate(const char * archiveRoot, bundle_archive_pt *bundle_archive) {
 	mock_c()->actualCall("bundleArchive_recreate")
 			->withStringParameters("archiveRoot", archiveRoot)
 			->withOutputParameter("bundle_archive", (void **) bundle_archive);
@@ -62,21 +62,21 @@
 	return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t bundleArchive_getLocation(bundle_archive_pt archive, char **location) {
+celix_status_t bundleArchive_getLocation(bundle_archive_pt archive, const char **location) {
 	mock_c()->actualCall("bundleArchive_getLocation")
 			->withPointerParameters("archive", archive)
 			->withOutputParameter("location", location);
 	return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t bundleArchive_getArchiveRoot(bundle_archive_pt archive, char **archiveRoot) {
+celix_status_t bundleArchive_getArchiveRoot(bundle_archive_pt archive, const char **archiveRoot) {
 	mock_c()->actualCall("bundleArchive_getArchiveRoot")
 			->withPointerParameters("archive", archive)
 			->withOutputParameter("archiveRoot", archiveRoot);
 	return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t bundleArchive_revise(bundle_archive_pt archive, char * location, char *inputFile) {
+celix_status_t bundleArchive_revise(bundle_archive_pt archive, const char * location, const char *inputFile) {
 	mock_c()->actualCall("bundleArchive_revise")
 			->withPointerParameters("archive", archive)
 			->withStringParameters("location", location)
diff --git a/framework/private/mock/bundle_cache_mock.c b/framework/private/mock/bundle_cache_mock.c
index ac9f61c..169a256 100644
--- a/framework/private/mock/bundle_cache_mock.c
+++ b/framework/private/mock/bundle_cache_mock.c
@@ -46,7 +46,7 @@
 	return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t bundleCache_createArchive(bundle_cache_pt cache, long id, char * location, char *inputFile, bundle_archive_pt *archive) {
+celix_status_t bundleCache_createArchive(bundle_cache_pt cache, long id, const char * location, const char *inputFile, bundle_archive_pt *archive) {
 	mock_c()->actualCall("bundleCache_createArchive")
 			->withPointerParameters("cache", cache)
 			->withLongIntParameters("id", id)
diff --git a/framework/private/mock/bundle_context_mock.c b/framework/private/mock/bundle_context_mock.c
index 2796ae8..6ec5fae 100644
--- a/framework/private/mock/bundle_context_mock.c
+++ b/framework/private/mock/bundle_context_mock.c
@@ -53,7 +53,7 @@
 	return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t bundleContext_installBundle(bundle_context_pt context, char * location, bundle_pt *bundle) {
+celix_status_t bundleContext_installBundle(bundle_context_pt context, const char * location, bundle_pt *bundle) {
 	mock_c()->actualCall("bundleContext_installBundle")
 			->withPointerParameters("context", context)
 			->withStringParameters("location", location)
@@ -61,7 +61,7 @@
 	return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t bundleContext_installBundle2(bundle_context_pt context, char * location, char *inputFile, bundle_pt *bundle) {
+celix_status_t bundleContext_installBundle2(bundle_context_pt context, const char * location, const char *inputFile, bundle_pt *bundle) {
 	mock_c()->actualCall("bundleContext_installBundle2")
 			->withPointerParameters("context", context)
 			->withStringParameters("location", location)
@@ -71,18 +71,18 @@
 }
 
 
-celix_status_t bundleContext_registerService(bundle_context_pt context, char * serviceName, void * svcObj,
+celix_status_t bundleContext_registerService(bundle_context_pt context, const char * serviceName, const void * svcObj,
         properties_pt properties, service_registration_pt *service_registration) {
 	mock_c()->actualCall("bundleContext_registerService")
 			->withPointerParameters("context", context)
 			->withStringParameters("serviceName", serviceName)
-			->withPointerParameters("svcObj", svcObj)
+			->withPointerParameters("svcObj", (void*)svcObj)
 			->withPointerParameters("properties", properties)
 			->withOutputParameter("service_registration", (void **) service_registration);
 	return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t bundleContext_registerServiceFactory(bundle_context_pt context, char * serviceName, service_factory_pt factory,
+celix_status_t bundleContext_registerServiceFactory(bundle_context_pt context, const char * serviceName, service_factory_pt factory,
         properties_pt properties, service_registration_pt *service_registration) {
 	mock_c()->actualCall("bundleContext_registerServiceFactory")
 			->withPointerParameters("context", context)
@@ -94,7 +94,7 @@
 }
 
 
-celix_status_t bundleContext_getServiceReferences(bundle_context_pt context, const char * serviceName, char * filter, array_list_pt *service_references) {
+celix_status_t bundleContext_getServiceReferences(bundle_context_pt context, const char * serviceName, const char * filter, array_list_pt *service_references) {
 	mock_c()->actualCall("bundleContext_getServiceReferences")
 			->withPointerParameters("context", context)
 			->withStringParameters("serviceName", serviceName)
@@ -103,7 +103,7 @@
 	return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t bundleContext_getServiceReference(bundle_context_pt context, char * serviceName, service_reference_pt *service_reference) {
+celix_status_t bundleContext_getServiceReference(bundle_context_pt context, const char * serviceName, service_reference_pt *service_reference) {
 	mock_c()->actualCall("bundleContext_getServiceReference")
 			->withPointerParameters("context", context)
 			->withStringParameters("serviceName", serviceName)
@@ -158,7 +158,7 @@
 }
 
 
-celix_status_t bundleContext_addServiceListener(bundle_context_pt context, service_listener_pt listener, char * filter) {
+celix_status_t bundleContext_addServiceListener(bundle_context_pt context, service_listener_pt listener, const char * filter) {
 	mock_c()->actualCall("bundleContext_addServiceListener")
 		->withPointerParameters("context", context)
 		->withPointerParameters("listener", listener)
@@ -185,7 +185,7 @@
 }
 
 
-celix_status_t bundleContext_getProperty(bundle_context_pt context, const char *name, char **value) {
+celix_status_t bundleContext_getProperty(bundle_context_pt context, const char *name, const char** value) {
 	mock_c()->actualCall("bundleContext_getProperty")
 			->withPointerParameters("context", context)
 			->withStringParameters("name", name)
diff --git a/framework/private/mock/bundle_mock.c b/framework/private/mock/bundle_mock.c
index a394d0f..5203d59 100644
--- a/framework/private/mock/bundle_mock.c
+++ b/framework/private/mock/bundle_mock.c
@@ -102,7 +102,7 @@
 	return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t bundle_getEntry(bundle_pt bundle, char * name, char **entry) {
+celix_status_t bundle_getEntry(bundle_pt bundle, const char * name, char **entry) {
 	mock_c()->actualCall("bundle_getEntry")
 			->withPointerParameters("bundle", bundle)
 			->withStringParameters("name", name)
@@ -120,7 +120,7 @@
 	return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t bundle_update(bundle_pt bundle, char *inputFile) {
+celix_status_t bundle_update(bundle_pt bundle, const char *inputFile) {
 	mock_c()->actualCall("bundle_update");
 	return mock_c()->returnValue().value.intValue;
 }
@@ -162,7 +162,7 @@
 }
 
 
-celix_status_t bundle_revise(bundle_pt bundle, char * location, char *inputFile) {
+celix_status_t bundle_revise(bundle_pt bundle, const char * location, const char *inputFile) {
 	mock_c()->actualCall("bundle_revise");
 	return mock_c()->returnValue().value.intValue;
 }
diff --git a/framework/private/mock/bundle_revision_mock.c b/framework/private/mock/bundle_revision_mock.c
index 0e24be5..d324ceb 100644
--- a/framework/private/mock/bundle_revision_mock.c
+++ b/framework/private/mock/bundle_revision_mock.c
@@ -27,7 +27,7 @@
 
 #include "bundle_revision.h"
 
-celix_status_t bundleRevision_create(char *root, char *location, long revisionNr, char *inputFile, bundle_revision_pt *bundle_revision) {
+celix_status_t bundleRevision_create(const char *root, const char *location, long revisionNr, const char *inputFile, bundle_revision_pt *bundle_revision) {
 	mock_c()->actualCall("bundleRevision_create")
 			->withStringParameters("root", root)
 			->withStringParameters("location", location)
@@ -49,14 +49,14 @@
 	return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t bundleRevision_getLocation(bundle_revision_pt revision, char **location) {
+celix_status_t bundleRevision_getLocation(bundle_revision_pt revision, const char **location) {
 	mock_c()->actualCall("bundleRevision_getLocation")
 			->withPointerParameters("revision", revision)
 			->withOutputParameter("location", location);
 	return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t bundleRevision_getRoot(bundle_revision_pt revision, char **root) {
+celix_status_t bundleRevision_getRoot(bundle_revision_pt revision, const char **root) {
 	mock_c()->actualCall("bundleRevision_getRoot")
 			->withPointerParameters("revision", revision)
 			->withOutputParameter("root", root);
diff --git a/framework/private/mock/capability_mock.c b/framework/private/mock/capability_mock.c
index 324e8d0..a908ea2 100644
--- a/framework/private/mock/capability_mock.c
+++ b/framework/private/mock/capability_mock.c
@@ -42,7 +42,7 @@
 	return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t capability_getServiceName(capability_pt capability, char **serviceName) {
+celix_status_t capability_getServiceName(capability_pt capability, const char **serviceName) {
 	mock_c()->actualCall("capability_getServiceName")
 			->withPointerParameters("capability", capability)
 			->withOutputParameter("serviceName", serviceName);
diff --git a/framework/private/mock/celix_log_mock.c b/framework/private/mock/celix_log_mock.c
index 7904553..26ebb7e 100644
--- a/framework/private/mock/celix_log_mock.c
+++ b/framework/private/mock/celix_log_mock.c
@@ -30,16 +30,16 @@
 #include "celix_errno.h"
 #include "celix_log.h"
 
-static void test_logger_log(framework_logger_pt logger, framework_log_level_t level, const char *func, const char *file, int line, char *fmsg, ...);
-static void test_logger_print(framework_log_level_t level, const char *func, const char *file, int line, char *msg);
+static void test_logger_log(framework_logger_pt logger, framework_log_level_t level, const char *func, const char *file, int line, const char *fmsg, ...);
+static void test_logger_print(framework_log_level_t level, const char *func, const char *file, int line, const char *msg);
 
-void framework_log(framework_logger_pt logger, framework_log_level_t level, const char *func, const char *file, int line, char *fmsg, ...) {
+void framework_log(framework_logger_pt logger, framework_log_level_t level, const char *func, const char *file, int line, const char *fmsg, ...) {
 	mock_c()->actualCall("framework_log");
 
     test_logger_log(logger, level, func, file, line, "%s", fmsg);
 }
 
-void framework_logCode(framework_logger_pt logger, framework_log_level_t level, const char *func, const char *file, int line, celix_status_t code, char *fmsg, ...) {
+void framework_logCode(framework_logger_pt logger, framework_log_level_t level, const char *func, const char *file, int line, celix_status_t code, const char *fmsg, ...) {
 	mock_c()->actualCall("framework_logCode")->withIntParameters("code", code);
     char message[256];
     celix_strerror(code, message, 256);
@@ -49,9 +49,11 @@
     vsprintf(msg, fmsg, listPointer);
 
     test_logger_log(logger, level, func, file, line, "%s [%d]: %s", message, code, msg);
+
+    va_end(listPointer);
 }
 
-celix_status_t frameworkLogger_log(framework_log_level_t level, const char *func, const char *file, int line, char *msg) {
+celix_status_t frameworkLogger_log(framework_log_level_t level, const char *func, const char *file, int line, const char *msg) {
 	mock_c()->actualCall("frameworkLogger_log");
 
 	test_logger_print(level, func, file, line, msg);
@@ -60,16 +62,18 @@
 }
 
 //test logger functions, let you read the logged errors
-static void test_logger_log(framework_logger_pt logger, framework_log_level_t level, const char *func, const char *file, int line, char *fmsg, ...) {
+static void test_logger_log(framework_logger_pt logger, framework_log_level_t level, const char *func, const char *file, int line, const char *fmsg, ...) {
     char msg[512];
     va_list listPointer;
     va_start(listPointer, fmsg);
     vsprintf(msg, fmsg, listPointer);
 
     test_logger_print(level, func, file, line, msg);
+
+    va_end(listPointer);
 }
 
-static void test_logger_print(framework_log_level_t level, const char *func, const char *file, int line, char *msg) {
+static void test_logger_print(framework_log_level_t level, const char *func, const char *file, int line, const char *msg) {
     char *levelStr = NULL;
     switch (level) {
         case OSGI_FRAMEWORK_LOG_ERROR:
diff --git a/framework/private/mock/filter_mock.c b/framework/private/mock/filter_mock.c
index ba2b9c1..d2fc75c 100644
--- a/framework/private/mock/filter_mock.c
+++ b/framework/private/mock/filter_mock.c
@@ -27,7 +27,7 @@
 
 #include "filter.h"
 
-filter_pt filter_create(char * filterString) {
+filter_pt filter_create(const char * filterString) {
 	mock_c()->actualCall("filter_create")
 			->withStringParameters("filterString", filterString);
 	return mock_c()->returnValue().value.pointerValue;
@@ -46,7 +46,7 @@
 	return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t filter_getString(filter_pt filter, char **filterStr) {
+celix_status_t filter_getString(filter_pt filter, const char **filterStr) {
 	mock_c()->actualCall("filter_getString")
 			->withPointerParameters("filter", filter)
 			->withOutputParameter("filterStr", filterStr);
diff --git a/framework/private/mock/framework_mock.c b/framework/private/mock/framework_mock.c
index cf941d4..399935f 100644
--- a/framework/private/mock/framework_mock.c
+++ b/framework/private/mock/framework_mock.c
@@ -51,15 +51,16 @@
 	mock_c()->actualCall("framework_stop");
 }
 
-celix_status_t fw_getProperty(framework_pt framework, const char *name, char **value) {
+celix_status_t fw_getProperty(framework_pt framework, const char* name, const char* defaultValue, const char** value) {
 	mock_c()->actualCall("fw_getProperty")
 			->withPointerParameters("framework", framework)
 			->withStringParameters("name", name)
+			->withStringParameters("defaultValue", defaultValue)
 			->withOutputParameter("value", (const char **) value);
 		return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t fw_installBundle(framework_pt framework, bundle_pt * bundle, char * location, char *inputFile) {
+celix_status_t fw_installBundle(framework_pt framework, bundle_pt * bundle, const char * location, const char *inputFile) {
 	mock_c()->actualCall("fw_installBundle")
 			->withPointerParameters("framework", framework)
 			->withStringParameters("location", location)
@@ -75,7 +76,7 @@
 		return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t framework_getBundleEntry(framework_pt framework, bundle_pt bundle, char *name, char **entry) {
+celix_status_t framework_getBundleEntry(framework_pt framework, bundle_pt bundle, const char *name, char **entry) {
 	mock_c()->actualCall("framework_getBundleEntry")
 			->withPointerParameters("framework", framework)
 			->withPointerParameters("bundle", bundle)
@@ -93,7 +94,7 @@
 	return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t framework_updateBundle(framework_pt framework, bundle_pt bundle, char *inputFile) {
+celix_status_t framework_updateBundle(framework_pt framework, bundle_pt bundle, const char *inputFile) {
 	mock_c()->actualCall("framework_updateBundle")
 		->withPointerParameters("framework", framework)
 		->withPointerParameters("bundle", bundle)
@@ -110,18 +111,18 @@
 }
 
 
-celix_status_t fw_registerService(framework_pt framework, service_registration_pt * registration, bundle_pt bundle, char * serviceName, void * svcObj, properties_pt properties) {
+celix_status_t fw_registerService(framework_pt framework, service_registration_pt * registration, bundle_pt bundle, const char* serviceName, const void* svcObj, properties_pt properties) {
 	mock_c()->actualCall("fw_registerService")
 		->withPointerParameters("framework", framework)
 		->withPointerParameters("bundle", bundle)
 		->withStringParameters("serviceName", serviceName)
-		->withPointerParameters("service", svcObj)
+		->withPointerParameters("service", (void*) svcObj)
 		->withPointerParameters("properties", properties)
 		->withOutputParameter("registration", (void **) registration);
 		return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t fw_registerServiceFactory(framework_pt framework, service_registration_pt * registration, bundle_pt bundle, char * serviceName, service_factory_pt factory, properties_pt properties) {
+celix_status_t fw_registerServiceFactory(framework_pt framework, service_registration_pt * registration, bundle_pt bundle, const char* serviceName, service_factory_pt factory, properties_pt properties) {
 	mock_c()->actualCall("fw_registerServiceFactory")
 		->withPointerParameters("framework", framework)
 		->withPointerParameters("bundle", bundle)
@@ -137,7 +138,7 @@
 }
 
 
-celix_status_t fw_getServiceReferences(framework_pt framework, array_list_pt *references, bundle_pt bundle, const char * serviceName, char * filter) {
+celix_status_t fw_getServiceReferences(framework_pt framework, array_list_pt *references, bundle_pt bundle, const char * serviceName, const char * filter) {
 	mock_c()->actualCall("fw_getServiceReferences")
 		->withPointerParameters("framework", framework)
 		->withPointerParameters("bundle", bundle)
@@ -155,7 +156,7 @@
     return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t fw_getService(framework_pt framework, bundle_pt bundle, service_reference_pt reference, void **service) {
+celix_status_t fw_getService(framework_pt framework, bundle_pt bundle, service_reference_pt reference, const void **service) {
 	mock_c()->actualCall("fw_getService")
 		->withPointerParameters("framework", framework)
 		->withPointerParameters("bundle", bundle)
@@ -190,7 +191,7 @@
 }
 
 
-void fw_addServiceListener(framework_pt framework, bundle_pt bundle, service_listener_pt listener, char * filter) {
+void fw_addServiceListener(framework_pt framework, bundle_pt bundle, service_listener_pt listener, const char* filter) {
 	mock_c()->actualCall("fw_addServiceListener")
 		->withPointerParameters("framework", framework)
 		->withPointerParameters("bundle", bundle)
@@ -296,7 +297,7 @@
 		return mock_c()->returnValue().value.pointerValue;
 }
 
-bundle_pt framework_getBundle(framework_pt framework, char * location) {
+bundle_pt framework_getBundle(framework_pt framework, const char* location) {
 	mock_c()->actualCall("framework_getBundle")
 			->withPointerParameters("framework", framework)
 			->withStringParameters("location", location);
diff --git a/framework/private/mock/manifest_mock.c b/framework/private/mock/manifest_mock.c
index b5d1fc7..b0f514a 100644
--- a/framework/private/mock/manifest_mock.c
+++ b/framework/private/mock/manifest_mock.c
@@ -33,7 +33,7 @@
 	return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t manifest_createFromFile(char *filename, manifest_pt *manifest) {
+celix_status_t manifest_createFromFile(const char *filename, manifest_pt *manifest) {
     mock_c()->actualCall("manifest_createFromFile")
         ->withStringParameters("filename", filename)
         ->withOutputParameter("manifest", (void **) manifest);
@@ -61,16 +61,16 @@
 	return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t manifest_read(manifest_pt manifest, char *filename) {
+celix_status_t manifest_read(manifest_pt manifest, const char *filename) {
 	mock_c()->actualCall("manifest_read");
 	return mock_c()->returnValue().value.intValue;
 }
 
-void manifest_write(manifest_pt manifest, char * filename) {
+void manifest_write(manifest_pt manifest, const char * filename) {
 	mock_c()->actualCall("manifest_write");
 }
 
-char * manifest_getValue(manifest_pt manifest, const char * name) {
+const char * manifest_getValue(manifest_pt manifest, const char * name) {
 	mock_c()->actualCall("manifest_getValue")
 			->withStringParameters("name", name);
 	return (char *) mock_c()->returnValue().value.stringValue;
diff --git a/framework/private/mock/manifest_parser_mock.c b/framework/private/mock/manifest_parser_mock.c
index 34b02fa..c9ba693 100644
--- a/framework/private/mock/manifest_parser_mock.c
+++ b/framework/private/mock/manifest_parser_mock.c
@@ -41,7 +41,7 @@
     return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t manifestParser_getSymbolicName(manifest_parser_pt parser, char **symbolicName) {
+celix_status_t manifestParser_getAndDuplicateSymbolicName(manifest_parser_pt parser, char **symbolicName) {
 	mock_c()->actualCall("manifestParser_getSymbolicName")
 			->withPointerParameters("parser", parser)
 			->withOutputParameter("symbolicName", (void**) symbolicName);
diff --git a/framework/private/mock/miniunz_mock.c b/framework/private/mock/miniunz_mock.c
index be5dba2..357bf31 100644
--- a/framework/private/mock/miniunz_mock.c
+++ b/framework/private/mock/miniunz_mock.c
@@ -27,7 +27,7 @@
 
 #include "archive.h"
 
-celix_status_t extractBundle(char * bundleName, char * revisionRoot) {
+celix_status_t extractBundle(const char * bundleName, const char * revisionRoot) {
 	mock_c()->actualCall("extractBundle")
 			->withStringParameters("bundleName", bundleName)
 			->withStringParameters("revisionRoot", revisionRoot);
diff --git a/framework/private/mock/module_mock.c b/framework/private/mock/module_mock.c
index 36c70ca..989dd05 100644
--- a/framework/private/mock/module_mock.c
+++ b/framework/private/mock/module_mock.c
@@ -27,7 +27,7 @@
 
 #include "module.h"
 
-module_pt module_create(manifest_pt headerMap, char * moduleId, bundle_pt bundle) {
+module_pt module_create(manifest_pt headerMap, const char * moduleId, bundle_pt bundle) {
 	mock_c()->actualCall("module_create")
 			->withPointerParameters("headerMap", headerMap)
 			->withStringParameters("moduleId", moduleId)
@@ -55,7 +55,7 @@
 	return mock_c()->returnValue().value.intValue;
 }
 
-wire_pt module_getWire(module_pt module, char * serviceName) {
+wire_pt module_getWire(module_pt module, const char * serviceName) {
 	mock_c()->actualCall("module_getwire");
 	return mock_c()->returnValue().value.pointerValue;
 }
@@ -66,7 +66,7 @@
 	return mock_c()->returnValue().value.pointerValue;
 }
 
-celix_status_t module_getSymbolicName(module_pt module, char **symbolicName) {
+celix_status_t module_getSymbolicName(module_pt module, const char **symbolicName) {
 	mock_c()->actualCall("module_getSymbolicName")
 		->withPointerParameters("module", module)
 		->withOutputParameter("symbolicName", (const char **) symbolicName);
diff --git a/framework/private/mock/properties_mock.c b/framework/private/mock/properties_mock.c
index 562a145..cf873a9 100644
--- a/framework/private/mock/properties_mock.c
+++ b/framework/private/mock/properties_mock.c
@@ -37,33 +37,32 @@
 			->withPointerParameters("properties", properties);
 }
 
-properties_pt properties_load(char * filename) {
+properties_pt properties_load(const char * filename) {
 	mock_c()->actualCall("properties_load");
 	return mock_c()->returnValue().value.pointerValue;
 }
 
-void properties_store(properties_pt properties, char * file, char * header) {
+void properties_store(properties_pt properties, const char * file, const char * header) {
 	mock_c()->actualCall("properties_store");
 }
 
-char * properties_get(properties_pt properties, char * key) {
+const char * properties_get(properties_pt properties, const char * key) {
 	mock_c()->actualCall("properties_get")
 			->withPointerParameters("properties", properties)
 			->withStringParameters("key", key);
 	return (char *) mock_c()->returnValue().value.stringValue;
 }
 
-char * properties_getWithDefault(properties_pt properties, char * key, char * defaultValue) {
+const char * properties_getWithDefault(properties_pt properties, const char * key, const char * defaultValue) {
 	mock_c()->actualCall("properties_getWithDefault");
 	return mock_c()->returnValue().value.pointerValue;
 }
 
-char * properties_set(properties_pt properties, char * key, char * value) {
+void properties_set(properties_pt properties, const char * key, const char * value) {
 	mock_c()->actualCall("properties_set")
 		->withPointerParameters("properties", properties)
 		->withStringParameters("key", key)
 		->withStringParameters("value", value);
-	return mock_c()->returnValue().value.pointerValue;
 }
 
 
diff --git a/framework/private/mock/requirement_mock.c b/framework/private/mock/requirement_mock.c
index 6282e7d..101bdce 100644
--- a/framework/private/mock/requirement_mock.c
+++ b/framework/private/mock/requirement_mock.c
@@ -48,7 +48,7 @@
 	return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t requirement_getTargetName(requirement_pt requirement, char **targetName) {
+celix_status_t requirement_getTargetName(requirement_pt requirement, const char **targetName) {
 	mock_c()->actualCall("requirement_getTargetName")
 			->withPointerParameters("requirement", requirement)
 			->withOutputParameter("targetName", targetName);
diff --git a/framework/private/mock/service_reference_mock.c b/framework/private/mock/service_reference_mock.c
index 25335f7..96ed005 100644
--- a/framework/private/mock/service_reference_mock.c
+++ b/framework/private/mock/service_reference_mock.c
@@ -77,10 +77,10 @@
 	return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t serviceReference_setService(service_reference_pt ref, void *service){
+celix_status_t serviceReference_setService(service_reference_pt ref, const void *service){
 	mock_c()->actualCall("serviceReference_setService")
 			->withPointerParameters("ref", ref)
-			->withPointerParameters("service", service);
+			->withPointerParameters("service", (void *)service);
 	return mock_c()->returnValue().value.intValue;
 }
 celix_status_t serviceReference_getService(service_reference_pt reference, void **service){
@@ -112,7 +112,7 @@
 	return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t serviceReference_getProperty(service_reference_pt reference, char *key, char **value){
+celix_status_t serviceReference_getProperty(service_reference_pt reference, const char *key, const char** value){
 	mock_c()->actualCall("serviceReference_getProperty")
 			->withPointerParameters("reference", reference)
 			->withStringParameters("key", key)
@@ -141,7 +141,7 @@
 	return mock_c()->returnValue().value.intValue;
 }
 
-bool serviceReference_isAssignableTo(service_reference_pt reference, bundle_pt requester, char * serviceName) {
+bool serviceReference_isAssignableTo(service_reference_pt reference, bundle_pt requester, const char * serviceName) {
 	mock_c()->actualCall("serviceReference_isAssignableTo")
 			->withPointerParameters("reference", reference)
 			->withPointerParameters("requester", requester)
@@ -164,10 +164,10 @@
 	return mock_c()->returnValue().value.intValue;
 }
 
-int serviceReference_equals2(void *reference1, void *reference2) {
+int serviceReference_equals2(const void *reference1, const void *reference2) {
 	mock_c()->actualCall("serviceReference_equals2")
-			->withPointerParameters("reference1", reference1)
-			->withPointerParameters("reference2", reference2);
+			->withPointerParameters("reference1", (void*)reference1)
+			->withPointerParameters("reference2", (void*)reference2);
 	return mock_c()->returnValue().value.intValue;
 }
 
@@ -179,7 +179,7 @@
 	return mock_c()->returnValue().value.intValue;
 }
 
-unsigned int serviceReference_hashCode(void *referenceP) {
+unsigned int serviceReference_hashCode(const void *referenceP) {
 	mock_c()->actualCall("serviceReference_hashCode");
 	return mock_c()->returnValue().value.intValue;
 }
diff --git a/framework/private/mock/service_registration_mock.c b/framework/private/mock/service_registration_mock.c
index 23fb8a4..934e11b 100644
--- a/framework/private/mock/service_registration_mock.c
+++ b/framework/private/mock/service_registration_mock.c
@@ -28,24 +28,24 @@
 #include "service_registration.h"
 #include "service_registration_private.h"
 
-service_registration_pt serviceRegistration_create(registry_callback_t callback, bundle_pt bundle, char * serviceName, long serviceId, void * serviceObject, properties_pt dictionary) {
+service_registration_pt serviceRegistration_create(registry_callback_t callback, bundle_pt bundle, const char* serviceName, unsigned long serviceId, const void* serviceObject, properties_pt dictionary) {
 	mock_c()->actualCall("serviceRegistration_create")
 		->withParameterOfType("registry_callback_t", "callback", &callback)
 		->withPointerParameters("bundle", bundle)
 		->withStringParameters("serviceName", serviceName)
-		->withIntParameters("serviceId", serviceId)
-		->withPointerParameters("serviceObject", serviceObject)
+		->withUnsignedLongIntParameters("serviceId", serviceId)
+		->withPointerParameters("serviceObject", (void*)serviceObject)
 		->withPointerParameters("dictionary", dictionary);
 	return mock_c()->returnValue().value.pointerValue;
 }
 
-service_registration_pt serviceRegistration_createServiceFactory(registry_callback_t callback, bundle_pt bundle, char * serviceName, long serviceId, void * serviceObject, properties_pt dictionary) {
+service_registration_pt serviceRegistration_createServiceFactory(registry_callback_t callback, bundle_pt bundle, const char* serviceName, unsigned long serviceId, const void* serviceObject, properties_pt dictionary) {
 	mock_c()->actualCall("serviceRegistration_createServiceFactory")
 		->withParameterOfType("registry_callback_t", "callback", &callback)
 		->withPointerParameters("bundle", bundle)
 		->withStringParameters("serviceName", serviceName)
-		->withIntParameters("serviceId", serviceId)
-		->withPointerParameters("serviceObject", serviceObject)
+		->withUnsignedLongIntParameters("serviceId", serviceId)
+		->withPointerParameters("serviceObject", (void*) serviceObject)
 		->withPointerParameters("dictionary", dictionary);
 	return mock_c()->returnValue().value.pointerValue;
 }
@@ -75,7 +75,7 @@
 }
 
 
-celix_status_t serviceRegistration_getService(service_registration_pt registration, bundle_pt bundle, void **service) {
+celix_status_t serviceRegistration_getService(service_registration_pt registration, bundle_pt bundle, const void **service) {
 	mock_c()->actualCall("serviceRegistration_getService")
 		->withPointerParameters("registration", registration)
 		->withPointerParameters("bundle", bundle)
@@ -83,7 +83,7 @@
 	return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t serviceRegistration_ungetService(service_registration_pt registration, bundle_pt bundle, void **service) {
+celix_status_t serviceRegistration_ungetService(service_registration_pt registration, bundle_pt bundle, const void **service) {
 	mock_c()->actualCall("serviceRegistration_ungetService")
 			->withPointerParameters("registration", registration)
 			->withPointerParameters("bundle", bundle)
@@ -120,7 +120,7 @@
 	return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t serviceRegistration_getServiceName(service_registration_pt registration, char **serviceName) {
+celix_status_t serviceRegistration_getServiceName(service_registration_pt registration, const char **serviceName) {
 	mock_c()->actualCall("serviceRegistration_getServiceName")
 			->withPointerParameters("registration", registration)
 			->withOutputParameter("serviceName", (const char **) serviceName);
diff --git a/framework/private/mock/service_registry_mock.c b/framework/private/mock/service_registry_mock.c
index 81be4c5..60b8032 100644
--- a/framework/private/mock/service_registry_mock.c
+++ b/framework/private/mock/service_registry_mock.c
@@ -56,18 +56,18 @@
 	return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t serviceRegistry_registerService(service_registry_pt registry, bundle_pt bundle, char * serviceName, void * serviceObject, properties_pt dictionary, service_registration_pt *registration) {
+celix_status_t serviceRegistry_registerService(service_registry_pt registry, bundle_pt bundle, const char* serviceName, const void * serviceObject, properties_pt dictionary, service_registration_pt *registration) {
 	mock_c()->actualCall("serviceRegistry_registerService")
 			->withPointerParameters("registry", registry)
 			->withPointerParameters("bundle", bundle)
 			->withStringParameters("serviceName", serviceName)
-			->withPointerParameters("serviceObject", serviceObject)
+			->withPointerParameters("serviceObject", (void*)serviceObject)
 			->withPointerParameters("dictionary", dictionary)
 			->withOutputParameter("registration", registration);
 	return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t serviceRegistry_registerServiceFactory(service_registry_pt registry, bundle_pt bundle, char * serviceName, service_factory_pt factory, properties_pt dictionary, service_registration_pt *registration) {
+celix_status_t serviceRegistry_registerServiceFactory(service_registry_pt registry, bundle_pt bundle, const char* serviceName, service_factory_pt factory, properties_pt dictionary, service_registration_pt *registration) {
 	mock_c()->actualCall("serviceRegistry_registerServiceFactory")
 		->withPointerParameters("registry", registry)
 		->withPointerParameters("bundle", bundle)
@@ -109,7 +109,7 @@
 	return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t serviceRegistry_getService(service_registry_pt registry, bundle_pt bundle, service_reference_pt reference, void **service) {
+celix_status_t serviceRegistry_getService(service_registry_pt registry, bundle_pt bundle, service_reference_pt reference, const void **service) {
 	mock_c()->actualCall("serviceRegistry_getService")
 		->withPointerParameters("registry", registry)
 		->withPointerParameters("bundle", bundle)
diff --git a/framework/private/mock/version_mock.c b/framework/private/mock/version_mock.c
index c965d4f..79517aa 100644
--- a/framework/private/mock/version_mock.c
+++ b/framework/private/mock/version_mock.c
@@ -50,7 +50,7 @@
 	return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t version_createVersionFromString(char * versionStr, version_pt *version) {
+celix_status_t version_createVersionFromString(const char * versionStr, version_pt *version) {
 	mock_c()->actualCall("version_createVersionFromString")
 			->withStringParameters("versionStr", versionStr)
 	      ->withOutputParameter("version", (void **) version);
@@ -84,7 +84,7 @@
 	return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t version_getQualifier(version_pt version, char **qualifier) {
+celix_status_t version_getQualifier(version_pt version, const char **qualifier) {
 	mock_c()->actualCall("version_getQualifier")
 			->withPointerParameters("version", version)
 			->withOutputParameter("qualifier", qualifier);
diff --git a/framework/private/mock/version_range_mock.c b/framework/private/mock/version_range_mock.c
index 14788d4..36826a7 100644
--- a/framework/private/mock/version_range_mock.c
+++ b/framework/private/mock/version_range_mock.c
@@ -57,7 +57,7 @@
 	return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t versionRange_parse(char * rangeStr, version_range_pt *range) {
+celix_status_t versionRange_parse(const char * rangeStr, version_range_pt *range) {
 	mock_c()->actualCall("versionRange_parse")
         ->withStringParameters("rangeStr", rangeStr)
         ->withOutputParameter("range", (void **) range);
diff --git a/framework/private/src/bundle.c b/framework/private/src/bundle.c
index 2cdb3fc..a0e6b3d 100644
--- a/framework/private/src/bundle.c
+++ b/framework/private/src/bundle.c
@@ -67,7 +67,6 @@
 			(*bundle)->lockThread = celix_thread_default;
         }
 	}
-
 	framework_logIfError(logger, status, NULL, "Failed to create bundle");
 
 	return status;
@@ -143,13 +142,12 @@
 celix_status_t bundle_getCurrentModule(bundle_pt bundle, module_pt *module) {
 	celix_status_t status = CELIX_SUCCESS;
 
-	if (bundle == NULL || *module != NULL || arrayList_size(bundle->modules)==0 ) {
+	if (bundle == NULL || arrayList_size(bundle->modules)==0 ) {
 		status = CELIX_ILLEGAL_ARGUMENT;
 	} else {
 		*module = arrayList_get(bundle->modules, arrayList_size(bundle->modules) - 1);
 	}
 
-
 	return status;
 }
 
@@ -184,7 +182,7 @@
 	return CELIX_SUCCESS;
 }
 
-celix_status_t bundle_getEntry(bundle_pt bundle, char * name, char **entry) {
+celix_status_t bundle_getEntry(bundle_pt bundle, const char* name, char** entry) {
 	return framework_getBundleEntry(bundle->framework, bundle, name, entry);
 }
 
@@ -223,7 +221,7 @@
 
 			if (*module != NULL) {
 				version_pt bundleVersion = module_getVersion(*module);
-				char * symName = NULL;
+				const char * symName = NULL;
 				status = module_getSymbolicName(*module, &symName);
 				if (status == CELIX_SUCCESS) {
 					array_list_pt bundles = framework_getBundles(bundle->framework);
@@ -235,7 +233,7 @@
 						if (bundleArchive_getId(check->archive, &id) == CELIX_SUCCESS) {
 							if (id != bundleId) {
 								module_pt mod = NULL;
-								char * sym = NULL;
+								const char * sym = NULL;
 								version_pt version;
 								int cmp;
 								status = bundle_getCurrentModule(check, &mod);
@@ -289,7 +287,7 @@
     return status;
 }
 
-celix_status_t bundle_update(bundle_pt bundle, char *inputFile) {
+celix_status_t bundle_update(bundle_pt bundle, const char *inputFile) {
 	celix_status_t status = CELIX_SUCCESS;
 	if (bundle != NULL) {
 		bool systemBundle = false;
@@ -383,7 +381,7 @@
     return status;
 }
 
-celix_status_t bundle_revise(bundle_pt bundle, char * location, char *inputFile) {
+celix_status_t bundle_revise(bundle_pt bundle, const char * location, const char *inputFile) {
 	celix_status_t status;
 
 	bundle_archive_pt archive = NULL;
@@ -675,7 +673,7 @@
 	return status;
 }
 
-celix_status_t bundle_getBundleLocation(bundle_pt bundle, char **location){
+celix_status_t bundle_getBundleLocation(bundle_pt bundle, const char **location){
 
 	celix_status_t status;
 
diff --git a/framework/private/src/bundle_archive.c b/framework/private/src/bundle_archive.c
index c229697..3d0513d 100644
--- a/framework/private/src/bundle_archive.c
+++ b/framework/private/src/bundle_archive.c
@@ -50,179 +50,194 @@
 };
 
 static celix_status_t bundleArchive_getRevisionLocation(bundle_archive_pt archive, long revNr, char **revision_location);
-static celix_status_t bundleArchive_setRevisionLocation(bundle_archive_pt archive, char * location, long revNr);
+static celix_status_t bundleArchive_setRevisionLocation(bundle_archive_pt archive, const char * location, long revNr);
 
 static celix_status_t bundleArchive_initialize(bundle_archive_pt archive);
 
-static celix_status_t bundleArchive_deleteTree(bundle_archive_pt archive, char * directory);
+static celix_status_t bundleArchive_deleteTree(bundle_archive_pt archive, const char * directory);
 
-static celix_status_t bundleArchive_createRevisionFromLocation(bundle_archive_pt archive, char *location, char *inputFile, long revNr, bundle_revision_pt *bundle_revision);
-static celix_status_t bundleArchive_reviseInternal(bundle_archive_pt archive, bool isReload, long revNr, char * location, char *inputFile);
+static celix_status_t bundleArchive_createRevisionFromLocation(bundle_archive_pt archive, const char *location, const char *inputFile, long revNr, bundle_revision_pt *bundle_revision);
+static celix_status_t bundleArchive_reviseInternal(bundle_archive_pt archive, bool isReload, long revNr, const char * location, const char *inputFile);
 
 static celix_status_t bundleArchive_readLastModified(bundle_archive_pt archive, time_t *time);
 static celix_status_t bundleArchive_writeLastModified(bundle_archive_pt archive);
 
 celix_status_t bundleArchive_createSystemBundleArchive(bundle_archive_pt *bundle_archive) {
-    celix_status_t status = CELIX_SUCCESS;
-    char *error = NULL;
-	bundle_archive_pt archive;
+	celix_status_t status = CELIX_SUCCESS;
+	char *error = NULL;
+	bundle_archive_pt archive = NULL;
 
 	if (*bundle_archive != NULL) {
-	    status = CELIX_ILLEGAL_ARGUMENT;
-	    error = "Missing required arguments and/or incorrect values";
+		status = CELIX_ILLEGAL_ARGUMENT;
+		error = "Missing required arguments and/or incorrect values";
 	} else {
-        archive = (bundle_archive_pt) malloc(sizeof(*archive));
-        if (archive == NULL) {
-            status = CELIX_ENOMEM;
-        } else {
-        	status = linkedList_create(&archive->revisions);
-        	if (status == CELIX_SUCCESS) {
-                archive->id = 0l;
-                archive->location = strdup("System Bundle");
-                archive->archiveRoot = NULL;
-                archive->archiveRootDir = NULL;
-                archive->refreshCount = -1;
-                archive->persistentState = OSGI_FRAMEWORK_BUNDLE_UNKNOWN;
-                time(&archive->lastModified);
+		archive = (bundle_archive_pt) calloc(1,sizeof(*archive));
+		if (archive == NULL) {
+			status = CELIX_ENOMEM;
+		} else {
+			status = linkedList_create(&archive->revisions);
+			if (status == CELIX_SUCCESS) {
+				archive->id = 0l;
+				archive->location = strdup("System Bundle");
+				archive->archiveRoot = NULL;
+				archive->archiveRootDir = NULL;
+				archive->refreshCount = -1;
+				archive->persistentState = OSGI_FRAMEWORK_BUNDLE_UNKNOWN;
+				time(&archive->lastModified);
 
-                *bundle_archive = archive;
-            }
-        }
+				*bundle_archive = archive;
+			}
+		}
+	}
+
+	if(status != CELIX_SUCCESS && archive != NULL){
+		bundleArchive_destroy(archive);
 	}
 
 	framework_logIfError(logger, status, error, "Could not create archive");
 
-    return status;
+	return status;
 }
 
-celix_status_t bundleArchive_create(char * archiveRoot, long id, char * location, char *inputFile, bundle_archive_pt *bundle_archive) {
-    celix_status_t status = CELIX_SUCCESS;
-    char *error = NULL;
-    bundle_archive_pt archive;
+celix_status_t bundleArchive_create(const char *archiveRoot, long id, const char * location, const char *inputFile, bundle_archive_pt *bundle_archive) {
+	celix_status_t status = CELIX_SUCCESS;
+	char *error = NULL;
+	bundle_archive_pt archive = NULL;
 
-    if (*bundle_archive != NULL) {
-    	status = CELIX_ILLEGAL_ARGUMENT;
-    	error = "bundle_archive_pt must be NULL";
-    } else {
-		archive = (bundle_archive_pt) malloc(sizeof(*archive));
+	if (*bundle_archive != NULL) {
+		status = CELIX_ILLEGAL_ARGUMENT;
+		error = "bundle_archive_pt must be NULL";
+	} else {
+		archive = (bundle_archive_pt) calloc(1,sizeof(*archive));
 		if (archive == NULL) {
-		    status = CELIX_ENOMEM;
+			status = CELIX_ENOMEM;
 		} else {
 			status = linkedList_create(&archive->revisions);
 			if (status == CELIX_SUCCESS) {
-                archive->id = id;
-                archive->location = strdup(location);
-                archive->archiveRootDir = NULL;
+				archive->id = id;
+				archive->location = strdup(location);
+				archive->archiveRootDir = NULL;
 				archive->archiveRoot = strdup(archiveRoot);
-                archive->refreshCount = -1;
-                time(&archive->lastModified);
+				archive->refreshCount = -1;
+				time(&archive->lastModified);
 
-                status = bundleArchive_initialize(archive);
-                if (status == CELIX_SUCCESS) {
-                    status = bundleArchive_revise(archive, location, inputFile);
+				status = bundleArchive_initialize(archive);
+				if (status == CELIX_SUCCESS) {
+					status = bundleArchive_revise(archive, location, inputFile);
 
-                    if (status != CELIX_SUCCESS) {
-                        bundleArchive_closeAndDelete(archive);
-                    }
-                }
-
-                *bundle_archive = archive;
-            }
+					if (status == CELIX_SUCCESS) {
+						*bundle_archive = archive;
+					}
+					else{
+						bundleArchive_closeAndDelete(archive);
+					}
+				}
+			}
 		}
-    }
+	}
 
-    framework_logIfError(logger, status, error, "Could not create archive");
+	if(status != CELIX_SUCCESS && archive != NULL){
+		bundleArchive_destroy(archive);
+	}
+
+	framework_logIfError(logger, status, error, "Could not create archive");
 
 	return status;
 }
 
 celix_status_t bundleArchive_destroy(bundle_archive_pt archive) {
-    celix_status_t status = CELIX_SUCCESS;
+	celix_status_t status = CELIX_SUCCESS;
 
-	if (archive->revisions != NULL) {
-	    linked_list_iterator_pt iter = linkedListIterator_create(archive->revisions, 0);
-	    while(linkedListIterator_hasNext(iter)) {
-            bundle_revision_pt rev = linkedListIterator_next(iter);
-            bundleRevision_destroy(rev);
-	    }
-	    linkedListIterator_destroy(iter);
-		linkedList_destroy(archive->revisions);
-	}
-	if (archive->archiveRoot != NULL) {
-	    free(archive->archiveRoot);
-	}
-	if (archive->location != NULL) {
-        free(archive->location);
-    }
+	if(archive != NULL){
+		if (archive->revisions != NULL) {
+			linked_list_iterator_pt iter = linkedListIterator_create(archive->revisions, 0);
+			while(linkedListIterator_hasNext(iter)) {
+				bundle_revision_pt rev = linkedListIterator_next(iter);
+				bundleRevision_destroy(rev);
+			}
+			linkedListIterator_destroy(iter);
+			linkedList_destroy(archive->revisions);
+		}
+		if (archive->archiveRoot != NULL) {
+			free(archive->archiveRoot);
+		}
+		if (archive->location != NULL) {
+			free(archive->location);
+		}
 
-	free(archive);
-	archive = NULL;
+		free(archive);
+		archive = NULL;
+	}
 
 	framework_logIfError(logger, status, NULL, "Could not create archive");
 
 	return status;
 }
 
-celix_status_t bundleArchive_recreate(char * archiveRoot, bundle_archive_pt *bundle_archive) {
-    celix_status_t status = CELIX_SUCCESS;
+celix_status_t bundleArchive_recreate(const char * archiveRoot, bundle_archive_pt *bundle_archive) {
+	celix_status_t status = CELIX_SUCCESS;
 
-    bundle_archive_pt archive;
+	bundle_archive_pt archive = NULL;
 
-	archive = (bundle_archive_pt) malloc(sizeof(*archive));
+	archive = (bundle_archive_pt) calloc(1,sizeof(*archive));
 	if (archive == NULL) {
-	    status = CELIX_ENOMEM;
- 	} else {
+		status = CELIX_ENOMEM;
+	} else {
 		status = linkedList_create(&archive->revisions);
 		if (status == CELIX_SUCCESS) {
 			archive->archiveRoot = strdup(archiveRoot);
-            archive->archiveRootDir = NULL;
-            archive->id = -1;
-            archive->persistentState = -1;
-            archive->location = NULL;
-            archive->refreshCount = -1;
-            archive->lastModified = (time_t) NULL;
-		}
+			archive->archiveRootDir = NULL;
+			archive->id = -1;
+			archive->persistentState = -1;
+			archive->location = NULL;
+			archive->refreshCount = -1;
+			archive->lastModified = (time_t) NULL;
 
-        archive->archiveRootDir = opendir(archiveRoot);
-		if (archive->archiveRootDir == NULL) {
-		    status = CELIX_FRAMEWORK_EXCEPTION;
-		} else {
+			archive->archiveRootDir = opendir(archiveRoot);
+			if (archive->archiveRootDir == NULL) {
+				status = CELIX_FRAMEWORK_EXCEPTION;
+			} else {
 
-            long idx = 0;
-            long highestId = -1;
-            char *location = NULL;
+				long idx = 0;
+				long highestId = -1;
+				char *location = NULL;
 
-			struct dirent dent;
-			struct dirent *result = NULL;
-            struct stat st;
-			int rc;
+				struct dirent dent;
+				struct dirent *result = NULL;
+				struct stat st;
+				int rc;
 
-			rc = readdir_r(archive->archiveRootDir, &dent, &result);
-			while (rc == 0 && result != NULL) {
-                char subdir[512];
-                snprintf(subdir, 512, "%s/%s", archiveRoot, dent.d_name);
-                stat(subdir, &st);
-				if (S_ISDIR(st.st_mode) && (strncmp(dent.d_name, "version", 7) == 0)) {
-					sscanf(dent.d_name, "version%*d.%ld", &idx);
-                    if (idx > highestId) {
-                        highestId = idx;
-                    }
-				}
 				rc = readdir_r(archive->archiveRootDir, &dent, &result);
-			}
+				while (rc == 0 && result != NULL) {
+					char subdir[512];
+					snprintf(subdir, 512, "%s/%s", archiveRoot, dent.d_name);
+					int rv = stat(subdir, &st);
+					if (rv == 0 && S_ISDIR(st.st_mode) && (strncmp(dent.d_name, "version", 7) == 0)) {
+						sscanf(dent.d_name, "version%*d.%ld", &idx);
+						if (idx > highestId) {
+							highestId = idx;
+						}
+					}
+					rc = readdir_r(archive->archiveRootDir, &dent, &result);
+				}
 
-            status = CELIX_DO_IF(status, bundleArchive_getRevisionLocation(archive, 0, &location));
-            status = CELIX_DO_IF(status, bundleArchive_reviseInternal(archive, true, highestId, location, NULL));
-            if (location) {
-                free(location);
-            }
-            if (status == CELIX_SUCCESS) {
-                *bundle_archive = archive;
-            }
-            closedir(archive->archiveRootDir);
+				status = CELIX_DO_IF(status, bundleArchive_getRevisionLocation(archive, 0, &location));
+				status = CELIX_DO_IF(status, bundleArchive_reviseInternal(archive, true, highestId, location, NULL));
+				if (location) {
+					free(location);
+				}
+				if (status == CELIX_SUCCESS) {
+					*bundle_archive = archive;
+				}
+				closedir(archive->archiveRootDir);
+			}
 		}
 	}
 
+	if(status != CELIX_SUCCESS && archive != NULL){
+		bundleArchive_destroy(archive);
+	}
+
 	framework_logIfError(logger, status, NULL, "Could not create archive");
 
 	return status;
@@ -233,14 +248,19 @@
 
 	if (archive->id < 0) {
 		FILE *bundleIdFile;
-        char id[256];
-        char bundleId[512];
-        snprintf(bundleId, sizeof(bundleId), "%s/bundle.id", archive->archiveRoot);
+		char id[256];
+		char bundleId[512];
+		snprintf(bundleId, sizeof(bundleId), "%s/bundle.id", archive->archiveRoot);
 
-        bundleIdFile = fopen(bundleId, "r");
-        fgets(id, sizeof(id), bundleIdFile);
-        fclose(bundleIdFile);
-        sscanf(id, "%ld", &archive->id);
+		bundleIdFile = fopen(bundleId, "r");
+		if(bundleIdFile!=NULL){
+			fgets(id, sizeof(id), bundleIdFile);
+			fclose(bundleIdFile);
+			sscanf(id, "%ld", &archive->id);
+		}
+		else{
+			status = CELIX_FILE_IO_EXCEPTION;
+		}
 	}
 
 	if (status == CELIX_SUCCESS) {
@@ -252,31 +272,36 @@
 	return status;
 }
 
-celix_status_t bundleArchive_getLocation(bundle_archive_pt archive, char **location) {
+celix_status_t bundleArchive_getLocation(bundle_archive_pt archive, const char **location) {
 	celix_status_t status = CELIX_SUCCESS;
 	if (archive->location == NULL) {
 		FILE *bundleLocationFile;
 		char bundleLocation[512];
-        char loc[256];
+		char loc[256];
 
-        snprintf(bundleLocation, sizeof(bundleLocation), "%s/bundle.location", archive->archiveRoot);
+		snprintf(bundleLocation, sizeof(bundleLocation), "%s/bundle.location", archive->archiveRoot);
 
-        bundleLocationFile = fopen(bundleLocation, "r");
-        fgets(loc, sizeof(loc), bundleLocationFile);
-        fclose(bundleLocationFile);
-        archive->location = strdup(loc);
+		bundleLocationFile = fopen(bundleLocation, "r");
+		if(bundleLocationFile!=NULL){
+			fgets(loc, sizeof(loc), bundleLocationFile);
+			fclose(bundleLocationFile);
+			archive->location = strdup(loc);
+		}
+		else{
+			status = CELIX_FILE_IO_EXCEPTION;
+		}
 	}
 
 	if (status == CELIX_SUCCESS) {
 		*location = archive->location;
 	}
 
-    framework_logIfError(logger, status, NULL, "Could not get archive location");
+	framework_logIfError(logger, status, NULL, "Could not get archive location");
 
 	return status;
 }
 
-celix_status_t bundleArchive_getArchiveRoot(bundle_archive_pt archive, char **archiveRoot) {
+celix_status_t bundleArchive_getArchiveRoot(bundle_archive_pt archive, const char **archiveRoot) {
 	*archiveRoot = archive->archiveRoot;
 	return CELIX_SUCCESS;
 }
@@ -285,11 +310,11 @@
 	celix_status_t status = CELIX_SUCCESS;
 	bundle_revision_pt revision;
 	*revisionNumber = -1;
-	
+
 	status = CELIX_DO_IF(status, bundleArchive_getCurrentRevision(archive, &revision));
 	status = CELIX_DO_IF(status, bundleRevision_getNumber(revision, revisionNumber));
 
-    framework_logIfError(logger, status, NULL, "Could not get current revision number");
+	framework_logIfError(logger, status, NULL, "Could not get current revision number");
 
 	return status;
 }
@@ -312,35 +337,35 @@
 	} else {
 		FILE *persistentStateLocationFile;
 		char persistentStateLocation[512];
-        char stateString[256];
-        snprintf(persistentStateLocation, sizeof(persistentStateLocation), "%s/bundle.state", archive->archiveRoot);
+		char stateString[256];
+		snprintf(persistentStateLocation, sizeof(persistentStateLocation), "%s/bundle.state", archive->archiveRoot);
 
-        persistentStateLocationFile = fopen(persistentStateLocation, "r");
-        if (persistentStateLocationFile == NULL) {
-            status = CELIX_FILE_IO_EXCEPTION;
-        } else {
-            if (fgets(stateString, sizeof(stateString), persistentStateLocationFile) == NULL) {
-                status = CELIX_FILE_IO_EXCEPTION;
-            }
-            fclose(persistentStateLocationFile);
-        }
+		persistentStateLocationFile = fopen(persistentStateLocation, "r");
+		if (persistentStateLocationFile == NULL) {
+			status = CELIX_FILE_IO_EXCEPTION;
+		} else {
+			if (fgets(stateString, sizeof(stateString), persistentStateLocationFile) == NULL) {
+				status = CELIX_FILE_IO_EXCEPTION;
+			}
+			fclose(persistentStateLocationFile);
+		}
 
-        if (status == CELIX_SUCCESS) {
-            if (strncmp(stateString, "active", 256) == 0) {
-                archive->persistentState = OSGI_FRAMEWORK_BUNDLE_ACTIVE;
-            } else if (strncmp(stateString, "starting", 256) == 0) {
-                archive->persistentState = OSGI_FRAMEWORK_BUNDLE_STARTING;
-            } else if (strncmp(stateString, "uninstalled", 256) == 0) {
-                archive->persistentState = OSGI_FRAMEWORK_BUNDLE_UNINSTALLED;
-            } else {
-                archive->persistentState = OSGI_FRAMEWORK_BUNDLE_INSTALLED;
-            }
+		if (status == CELIX_SUCCESS) {
+			if (strncmp(stateString, "active", 256) == 0) {
+				archive->persistentState = OSGI_FRAMEWORK_BUNDLE_ACTIVE;
+			} else if (strncmp(stateString, "starting", 256) == 0) {
+				archive->persistentState = OSGI_FRAMEWORK_BUNDLE_STARTING;
+			} else if (strncmp(stateString, "uninstalled", 256) == 0) {
+				archive->persistentState = OSGI_FRAMEWORK_BUNDLE_UNINSTALLED;
+			} else {
+				archive->persistentState = OSGI_FRAMEWORK_BUNDLE_INSTALLED;
+			}
 
-            *state = archive->persistentState;
-        }
+			*state = archive->persistentState;
+		}
 	}
 
-    framework_logIfError(logger, status, NULL, "Could not get persistent state");
+	framework_logIfError(logger, status, NULL, "Could not get persistent state");
 
 	return status;
 }
@@ -349,35 +374,35 @@
 	celix_status_t status = CELIX_SUCCESS;
 	char persistentStateLocation[512];
 	FILE *persistentStateLocationFile;
-	
+
 	snprintf(persistentStateLocation, sizeof(persistentStateLocation), "%s/bundle.state", archive->archiveRoot);
 
 	persistentStateLocationFile = fopen(persistentStateLocation, "w");
-    if (persistentStateLocationFile == NULL) {
-        status = CELIX_FILE_IO_EXCEPTION;
-    } else {
-        char * s;
-        switch (state) {
-            case OSGI_FRAMEWORK_BUNDLE_ACTIVE:
-                s = "active";
-                break;
-            case OSGI_FRAMEWORK_BUNDLE_STARTING:
-                s = "starting";
-                break;
-            case OSGI_FRAMEWORK_BUNDLE_UNINSTALLED:
-                s = "uninstalled";
-                break;
-            default:
-                s = "installed";
-                break;
-        }
-        fprintf(persistentStateLocationFile, "%s", s);
-        if (fclose(persistentStateLocationFile) ==  0) {
-            archive->persistentState = state;
-        }
-    }
+	if (persistentStateLocationFile == NULL) {
+		status = CELIX_FILE_IO_EXCEPTION;
+	} else {
+		char * s;
+		switch (state) {
+		case OSGI_FRAMEWORK_BUNDLE_ACTIVE:
+			s = "active";
+			break;
+		case OSGI_FRAMEWORK_BUNDLE_STARTING:
+			s = "starting";
+			break;
+		case OSGI_FRAMEWORK_BUNDLE_UNINSTALLED:
+			s = "uninstalled";
+			break;
+		default:
+			s = "installed";
+			break;
+		}
+		fprintf(persistentStateLocationFile, "%s", s);
+		if (fclose(persistentStateLocationFile) ==  0) {
+			archive->persistentState = state;
+		}
+	}
 
-    framework_logIfError(logger, status, NULL, "Could not set persistent state");
+	framework_logIfError(logger, status, NULL, "Could not set persistent state");
 
 	return status;
 }
@@ -386,30 +411,30 @@
 	celix_status_t status = CELIX_SUCCESS;
 
 	if (archive->refreshCount == -1) {
-	    FILE *refreshCounterFile;
-        char refreshCounter[512];
-        snprintf(refreshCounter, sizeof(refreshCounter), "%s/refresh.counter", archive->archiveRoot);
+		FILE *refreshCounterFile;
+		char refreshCounter[512];
+		snprintf(refreshCounter, sizeof(refreshCounter), "%s/refresh.counter", archive->archiveRoot);
 
-        refreshCounterFile = fopen(refreshCounter, "r");
-        if (refreshCounterFile == NULL) {
-            archive->refreshCount = 0;
-        } else {
-            char counterStr[256];
-            if (fgets(counterStr, sizeof(counterStr), refreshCounterFile) == NULL) {
-                status = CELIX_FILE_IO_EXCEPTION;
-            }
-            fclose(refreshCounterFile);
-            if (status == CELIX_SUCCESS) {
-                sscanf(counterStr, "%ld", &archive->refreshCount);
-            }
-        }
+		refreshCounterFile = fopen(refreshCounter, "r");
+		if (refreshCounterFile == NULL) {
+			archive->refreshCount = 0;
+		} else {
+			char counterStr[256];
+			if (fgets(counterStr, sizeof(counterStr), refreshCounterFile) == NULL) {
+				status = CELIX_FILE_IO_EXCEPTION;
+			}
+			fclose(refreshCounterFile);
+			if (status == CELIX_SUCCESS) {
+				sscanf(counterStr, "%ld", &archive->refreshCount);
+			}
+		}
 	}
 
 	if (status == CELIX_SUCCESS) {
 		*refreshCount = archive->refreshCount;
 	}
 
-    framework_logIfError(logger, status, NULL, "Could not get refresh count");
+	framework_logIfError(logger, status, NULL, "Could not get refresh count");
 
 	return status;
 }
@@ -422,15 +447,15 @@
 	snprintf(refreshCounter, sizeof(refreshCounter), "%s/refresh.counter", archive->archiveRoot);
 
 	refreshCounterFile = fopen(refreshCounter, "w");
-    if (refreshCounterFile == NULL) {
-        status = CELIX_FILE_IO_EXCEPTION;
-    } else {
-        fprintf(refreshCounterFile, "%ld", archive->refreshCount);
-        if (fclose(refreshCounterFile) ==  0) {
-        }
-    }
+	if (refreshCounterFile == NULL) {
+		status = CELIX_FILE_IO_EXCEPTION;
+	} else {
+		fprintf(refreshCounterFile, "%ld", archive->refreshCount);
+		if (fclose(refreshCounterFile) ==  0) {
+		}
+	}
 
-    framework_logIfError(logger, status, NULL, "Could not set refresh count");
+	framework_logIfError(logger, status, NULL, "Could not set refresh count");
 
 	return status;
 }
@@ -439,14 +464,14 @@
 	celix_status_t status = CELIX_SUCCESS;
 
 	if (archive->lastModified == (time_t) NULL) {
-	    status = CELIX_DO_IF(status, bundleArchive_readLastModified(archive, &archive->lastModified));
+		status = CELIX_DO_IF(status, bundleArchive_readLastModified(archive, &archive->lastModified));
 	}
 
 	if (status == CELIX_SUCCESS) {
 		*lastModified = archive->lastModified;
 	}
 
-    framework_logIfError(logger, status, NULL, "Could not get last modified");
+	framework_logIfError(logger, status, NULL, "Could not get last modified");
 
 	return status;
 }
@@ -457,7 +482,7 @@
 	archive->lastModified = lastModifiedTime;
 	status = CELIX_DO_IF(status, bundleArchive_writeLastModified(archive));
 
-    framework_logIfError(logger, status, NULL, "Could not set last modified");
+	framework_logIfError(logger, status, NULL, "Could not set last modified");
 
 	return status;
 }
@@ -471,29 +496,29 @@
 	snprintf(lastModified, sizeof(lastModified), "%s/bundle.lastmodified", archive->archiveRoot);
 
 	lastModifiedFile = fopen(lastModified, "r");
-    if (lastModifiedFile == NULL) {
-        status = CELIX_FILE_IO_EXCEPTION;
-    } else {
-        char timeStr[20];
-        int year, month, day, hours, minutes, seconds;
-        struct tm tm_time;
+	if (lastModifiedFile == NULL) {
+		status = CELIX_FILE_IO_EXCEPTION;
+	} else {
+		char timeStr[20];
+		int year, month, day, hours, minutes, seconds;
+		struct tm tm_time;
 
-        if (fgets(timeStr, sizeof(timeStr), lastModifiedFile) == NULL) {
-            status = CELIX_FILE_IO_EXCEPTION;
-        }
-        fclose(lastModifiedFile);
-        if (status == CELIX_SUCCESS) {
-            sscanf(timeStr, "%d %d %d %d:%d:%d", &year, &month, &day, &hours, &minutes, &seconds);
-            tm_time.tm_year = year - 1900;
-            tm_time.tm_mon = month - 1;
-            tm_time.tm_mday = day;
-            tm_time.tm_hour = hours;
-            tm_time.tm_min = minutes;
-            tm_time.tm_sec = seconds;
+		if (fgets(timeStr, sizeof(timeStr), lastModifiedFile) == NULL) {
+			status = CELIX_FILE_IO_EXCEPTION;
+		}
+		fclose(lastModifiedFile);
+		if (status == CELIX_SUCCESS) {
+			sscanf(timeStr, "%d %d %d %d:%d:%d", &year, &month, &day, &hours, &minutes, &seconds);
+			tm_time.tm_year = year - 1900;
+			tm_time.tm_mon = month - 1;
+			tm_time.tm_mday = day;
+			tm_time.tm_hour = hours;
+			tm_time.tm_min = minutes;
+			tm_time.tm_sec = seconds;
 
-            *time = mktime(&tm_time);
-        }
-    }
+			*time = mktime(&tm_time);
+		}
+	}
 
 	framework_logIfError(logger, status, NULL, "Could not read last modified");
 
@@ -507,21 +532,21 @@
 
 	snprintf(lastModified, sizeof(lastModified), "%s/bundle.lastmodified", archive->archiveRoot);
 	lastModifiedFile = fopen(lastModified, "w");
-    if (lastModifiedFile == NULL) {
-        status = CELIX_FILE_IO_EXCEPTION;
-    } else {
-        char timeStr[20];
-        strftime(timeStr, 20, "%Y %m %d %H:%M:%S", localtime(&archive->lastModified));
-        fprintf(lastModifiedFile, "%s", timeStr);
-        fclose(lastModifiedFile);
-    }
-	
-    framework_logIfError(logger, status, NULL, "Could not write last modified");
+	if (lastModifiedFile == NULL) {
+		status = CELIX_FILE_IO_EXCEPTION;
+	} else {
+		char timeStr[20];
+		strftime(timeStr, 20, "%Y %m %d %H:%M:%S", localtime(&archive->lastModified));
+		fprintf(lastModifiedFile, "%s", timeStr);
+		fclose(lastModifiedFile);
+	}
+
+	framework_logIfError(logger, status, NULL, "Could not write last modified");
 
 	return status;
 }
 
-celix_status_t bundleArchive_revise(bundle_archive_pt archive, char * location, char *inputFile) {
+celix_status_t bundleArchive_revise(bundle_archive_pt archive, const char * location, const char *inputFile) {
 	celix_status_t status = CELIX_SUCCESS;
 	long revNr = 0l;
 	if (!linkedList_isEmpty(archive->revisions)) {
@@ -533,27 +558,27 @@
 		status = bundleArchive_reviseInternal(archive, false, revNr, location, inputFile);
 	}
 
-    framework_logIfError(logger, status, NULL, "Could not revise bundle archive");
+	framework_logIfError(logger, status, NULL, "Could not revise bundle archive");
 
 	return status;
 }
 
-static celix_status_t bundleArchive_reviseInternal(bundle_archive_pt archive, bool isReload, long revNr, char * location, char *inputFile) {
-    celix_status_t status = CELIX_SUCCESS;
-    bundle_revision_pt revision = NULL;
+static celix_status_t bundleArchive_reviseInternal(bundle_archive_pt archive, bool isReload, long revNr, const char * location, const char *inputFile) {
+	celix_status_t status = CELIX_SUCCESS;
+	bundle_revision_pt revision = NULL;
 
-    if (inputFile != NULL) {
+	if (inputFile != NULL) {
 		location = "inputstream:";
 	}
 
 	status = bundleArchive_createRevisionFromLocation(archive, location, inputFile, revNr, &revision);
 
 	if (status == CELIX_SUCCESS) {
-        if (!isReload) {
-            status = bundleArchive_setRevisionLocation(archive, location, revNr);
-        }
+		if (!isReload) {
+			status = bundleArchive_setRevisionLocation(archive, location, revNr);
+		}
 
-        linkedList_addElement(archive->revisions, revision);
+		linkedList_addElement(archive->revisions, revision);
 	}
 
 	framework_logIfError(logger, status, NULL, "Could not revise bundle archive");
@@ -566,30 +591,30 @@
 	return CELIX_SUCCESS;
 }
 
-static celix_status_t bundleArchive_createRevisionFromLocation(bundle_archive_pt archive, char *location, char *inputFile, long revNr, bundle_revision_pt *bundle_revision) {
-    celix_status_t status = CELIX_SUCCESS;
-    char root[256];
-    long refreshCount;
+static celix_status_t bundleArchive_createRevisionFromLocation(bundle_archive_pt archive, const char *location, const char *inputFile, long revNr, bundle_revision_pt *bundle_revision) {
+	celix_status_t status = CELIX_SUCCESS;
+	char root[256];
+	long refreshCount;
 
-    status = bundleArchive_getRefreshCount(archive, &refreshCount);
-    if (status == CELIX_SUCCESS) {
+	status = bundleArchive_getRefreshCount(archive, &refreshCount);
+	if (status == CELIX_SUCCESS) {
 		bundle_revision_pt revision = NULL;
-		
+
 		sprintf(root, "%s/version%ld.%ld", archive->archiveRoot, refreshCount, revNr);
-        status = bundleRevision_create(root, location, revNr, inputFile, &revision);
+		status = bundleRevision_create(root, location, revNr, inputFile, &revision);
 
 		if (status == CELIX_SUCCESS) {
 			*bundle_revision = revision;
 		}
-    }
+	}
 
-    framework_logIfError(logger, status, NULL, "Could not create revision [location=%s,inputFile=%s]", location, inputFile);
+	framework_logIfError(logger, status, NULL, "Could not create revision [location=%s,inputFile=%s]", location, inputFile);
 
 	return status;
 }
 
 static celix_status_t bundleArchive_getRevisionLocation(bundle_archive_pt archive, long revNr, char **revision_location) {
-    celix_status_t status = CELIX_SUCCESS;
+	celix_status_t status = CELIX_SUCCESS;
 	char revisionLocation[256];
 	long refreshCount;
 
@@ -598,7 +623,7 @@
 		FILE *revisionLocationFile;
 
 		snprintf(revisionLocation, sizeof(revisionLocation), "%s/version%ld.%ld/revision.location", archive->archiveRoot, refreshCount, revNr);
-		
+
 		revisionLocationFile = fopen(revisionLocation, "r");
 		if (revisionLocationFile != NULL) {
 			char location[256];
@@ -615,12 +640,12 @@
 	}
 
 
-    framework_logIfError(logger, status, NULL, "Failed to get revision location");
+	framework_logIfError(logger, status, NULL, "Failed to get revision location");
 
 	return status;
 }
 
-static celix_status_t bundleArchive_setRevisionLocation(bundle_archive_pt archive, char * location, long revNr) {
+static celix_status_t bundleArchive_setRevisionLocation(bundle_archive_pt archive, const char * location, long revNr) {
 	celix_status_t status = CELIX_SUCCESS;
 
 	char revisionLocation[256];
@@ -631,7 +656,7 @@
 		FILE * revisionLocationFile;
 
 		snprintf(revisionLocation, sizeof(revisionLocation), "%s/version%ld.%ld/revision.location", archive->archiveRoot, refreshCount, revNr);
-		
+
 		revisionLocationFile = fopen(revisionLocation, "w");
 		if (revisionLocationFile == NULL) {
 			status = CELIX_FILE_IO_EXCEPTION;
@@ -669,13 +694,13 @@
 	celix_status_t status = CELIX_SUCCESS;
 
 	if (archive->archiveRootDir == NULL) {
-        int err = mkdir(archive->archiveRoot, S_IRWXU) ;
-	    if (err != 0) {
-            char *errmsg = strerror(errno);
-            fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Error mkdir: %s\n", errmsg);
+		int err = mkdir(archive->archiveRoot, S_IRWXU) ;
+		if (err != 0) {
+			char *errmsg = strerror(errno);
+			fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Error mkdir: %s\n", errmsg);
 			status = CELIX_FILE_IO_EXCEPTION;
 		} else {
-		    archive->archiveRootDir = opendir(archive->archiveRoot);
+			archive->archiveRootDir = opendir(archive->archiveRoot);
 			if (archive->archiveRootDir == NULL) {
 				status = CELIX_FILE_IO_EXCEPTION;
 			} else {
@@ -701,7 +726,7 @@
 					if (bundleLocationFile == NULL) {
 						status = CELIX_FILE_IO_EXCEPTION;
 					} else {
-					    fprintf(bundleLocationFile, "%s", archive->location);
+						fprintf(bundleLocationFile, "%s", archive->location);
 						// Ignore close status, let it fail if needed again
 						fclose(bundleLocationFile);
 
@@ -718,44 +743,44 @@
 	return status;
 }
 
-static celix_status_t bundleArchive_deleteTree(bundle_archive_pt archive, char * directory) {
+static celix_status_t bundleArchive_deleteTree(bundle_archive_pt archive, const char * directory) {
 	DIR *dir;
 	celix_status_t status = CELIX_SUCCESS;
 	dir = opendir(directory);
 	if (dir == NULL) {
-	    status = CELIX_FILE_IO_EXCEPTION;
+		status = CELIX_FILE_IO_EXCEPTION;
 	} else {
 
 		struct dirent dp;
 		struct dirent *result = NULL;
 		int rc = 0;
 
-        rc = readdir_r(dir, &dp, &result);
-        while (rc == 0 && result != NULL) {
-            if ((strcmp((dp.d_name), ".") != 0) && (strcmp((dp.d_name), "..") != 0)) {
-                char subdir[512];
-                snprintf(subdir, 512, "%s/%s", directory, dp.d_name);
+		rc = readdir_r(dir, &dp, &result);
+		while (rc == 0 && result != NULL) {
+			if ((strcmp((dp.d_name), ".") != 0) && (strcmp((dp.d_name), "..") != 0)) {
+				char subdir[512];
+				snprintf(subdir, 512, "%s/%s", directory, dp.d_name);
 
-                struct stat st;
-                if (stat(subdir, &st) == 0) {
-                    if (S_ISDIR (st.st_mode)) {
-                        status = bundleArchive_deleteTree(archive, subdir);
-                    } else {
-                        if (remove(subdir) != 0) {
-                            status = CELIX_FILE_IO_EXCEPTION;
-                            break;
-                        }
-                    }
-                }
-            }
-            rc = readdir_r(dir, &dp, &result);
-        }
+				struct stat st;
+				if (stat(subdir, &st) == 0) {
+					if (S_ISDIR (st.st_mode)) {
+						status = bundleArchive_deleteTree(archive, subdir);
+					} else {
+						if (remove(subdir) != 0) {
+							status = CELIX_FILE_IO_EXCEPTION;
+							break;
+						}
+					}
+				}
+			}
+			rc = readdir_r(dir, &dp, &result);
+		}
 
 		if (closedir(dir) != 0) {
 			status = CELIX_FILE_IO_EXCEPTION;
 		}
 		if (status == CELIX_SUCCESS) {
-            if (rmdir(directory) != 0) {
+			if (rmdir(directory) != 0) {
 				status = CELIX_FILE_IO_EXCEPTION;
 			}
 		}
diff --git a/framework/private/src/bundle_cache.c b/framework/private/src/bundle_cache.c
index 3c1530a..1572bc0 100644
--- a/framework/private/src/bundle_cache.c
+++ b/framework/private/src/bundle_cache.c
@@ -38,105 +38,114 @@
 static celix_status_t bundleCache_deleteTree(bundle_cache_pt cache, char * directory);
 
 celix_status_t bundleCache_create(properties_pt configurationMap, bundle_cache_pt *bundle_cache) {
-    celix_status_t status;
-    bundle_cache_pt cache;
+	celix_status_t status;
+	bundle_cache_pt cache;
+
+	if (configurationMap == NULL || *bundle_cache != NULL) {
+		return CELIX_ILLEGAL_ARGUMENT;
+	}
 
 	cache = (bundle_cache_pt) calloc(1, sizeof(*cache));
-    if (cache == NULL) {
-        status = CELIX_ENOMEM;
-    } else {
-		if (configurationMap != NULL && *bundle_cache == NULL) {
-            char * cacheDir = properties_get(configurationMap, (char *) OSGI_FRAMEWORK_FRAMEWORK_STORAGE);
-			cache->configurationMap = configurationMap;
-            if (cacheDir == NULL) {
-                cacheDir = ".cache";
-            }
-            cache->cacheDir = cacheDir;
+	if (cache == NULL) {
+		status = CELIX_ENOMEM;
+	} else {
+		char* cacheDir = (char*)properties_get(configurationMap, (char *) OSGI_FRAMEWORK_FRAMEWORK_STORAGE);
+		cache->configurationMap = configurationMap;
+		if (cacheDir == NULL) {
+			cacheDir = ".cache";
+		}
+		cache->cacheDir = cacheDir;
 
-            *bundle_cache = cache;
-            status = CELIX_SUCCESS;
-        } else {
-            status = CELIX_ILLEGAL_ARGUMENT;
-        }
-    }
+		*bundle_cache = cache;
+		status = CELIX_SUCCESS;
+	}
 
-    framework_logIfError(logger, status, NULL, "Failed to create bundle cache");
+	framework_logIfError(logger, status, NULL, "Failed to create bundle cache");
 
 	return status;
 }
 
 celix_status_t bundleCache_destroy(bundle_cache_pt *cache) {
 
-    free(*cache);
-    *cache = NULL;
+	free(*cache);
+	*cache = NULL;
 
-    return CELIX_SUCCESS;
+	return CELIX_SUCCESS;
 }
 
 celix_status_t bundleCache_delete(bundle_cache_pt cache) {
-    return bundleCache_deleteTree(cache, cache->cacheDir);
+	return bundleCache_deleteTree(cache, cache->cacheDir);
 }
 
 celix_status_t bundleCache_getArchives(bundle_cache_pt cache, array_list_pt *archives) {
 	celix_status_t status = CELIX_SUCCESS;
 
 	DIR *dir;
-    struct stat st;
+	struct stat st;
 
 	dir = opendir(cache->cacheDir);
 
 	if (dir == NULL && errno == ENOENT) {
-		mkdir(cache->cacheDir, S_IRWXU);
-		dir = opendir(cache->cacheDir);
+		if(mkdir(cache->cacheDir, S_IRWXU) == 0 ){
+			dir = opendir(cache->cacheDir);
+		}
 	}
 
 	if (dir != NULL) {
-        array_list_pt list = NULL;
-        arrayList_create(&list);
+		array_list_pt list = NULL;
+		arrayList_create(&list);
 
-        struct dirent dp;
-        struct dirent *result = NULL;
-        int rc = 0;
+		struct dirent dp;
+		struct dirent *result = NULL;
+		int rc = 0;
 
-        rc = readdir_r(dir, &dp, &result);
-        while (rc == 0 && result != NULL) {
-            char archiveRoot[512];
+		rc = readdir_r(dir, &dp, &result);
+		while (rc == 0 && result != NULL) {
+			char archiveRoot[512];
 
-            snprintf(archiveRoot, sizeof(archiveRoot), "%s/%s", cache->cacheDir, dp.d_name);
+			snprintf(archiveRoot, sizeof(archiveRoot), "%s/%s", cache->cacheDir, dp.d_name);
 
-            if (stat (archiveRoot, &st) == 0) {
-                if (S_ISDIR (st.st_mode)
-                    && (strcmp((dp.d_name), ".") != 0)
-                    && (strcmp((dp.d_name), "..") != 0)
-                    && (strncmp(dp.d_name, "bundle", 6) == 0)
-                    && (strcmp(dp.d_name, "bundle0") != 0)) {
+			if (stat (archiveRoot, &st) == 0) {
+				if (S_ISDIR (st.st_mode)
+						&& (strcmp((dp.d_name), ".") != 0)
+						&& (strcmp((dp.d_name), "..") != 0)
+						&& (strncmp(dp.d_name, "bundle", 6) == 0)
+						&& (strcmp(dp.d_name, "bundle0") != 0)) {
 
-                    bundle_archive_pt archive = NULL;
-                    status = bundleArchive_recreate(archiveRoot, &archive);
-                    if (status == CELIX_SUCCESS) {
-                        arrayList_add(list, archive);
-                    }
-                }
-            }
+					bundle_archive_pt archive = NULL;
+					status = bundleArchive_recreate(archiveRoot, &archive);
+					if (status == CELIX_SUCCESS) {
+						arrayList_add(list, archive);
+					}
+				}
+			}
 
-            readdir_r(dir, &dp, &result);
-        }
+			rc = readdir_r(dir, &dp, &result);
+		}
 
-        if (rc != 0) {
-            fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Error reading dir");
-            status = CELIX_FILE_IO_EXCEPTION;
-        } else {
-            status = CELIX_SUCCESS;
-        }
+		if (rc != 0) {
+			fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Error reading dir");
+			status = CELIX_FILE_IO_EXCEPTION;
+		} else {
+			status = CELIX_SUCCESS;
+		}
 
-        closedir(dir);
+		closedir(dir);
 
-        if (status == CELIX_SUCCESS) {
-            *archives = list;
-        }
+		if (status == CELIX_SUCCESS) {
+			*archives = list;
+		}
+		else{
+			int idx = 0;
+			for(;idx<arrayList_size(list);idx++){
+				bundleArchive_destroy((bundle_archive_pt)arrayList_get(list,idx));
+			}
+			arrayList_destroy(list);
+			*archives = NULL;
+		}
 
 	} else {
-	    status = CELIX_FILE_IO_EXCEPTION;
+		status = CELIX_FILE_IO_EXCEPTION;
 	}
 
 	framework_logIfError(logger, status, NULL, "Failed to get bundle archives");
@@ -144,13 +153,13 @@
 	return status;
 }
 
-celix_status_t bundleCache_createArchive(bundle_cache_pt cache, long id, char * location, char *inputFile, bundle_archive_pt *bundle_archive) {
+celix_status_t bundleCache_createArchive(bundle_cache_pt cache, long id, const char * location, const char *inputFile, bundle_archive_pt *bundle_archive) {
 	celix_status_t status = CELIX_SUCCESS;
 	char archiveRoot[512];
 
 	if (cache && location) {
 		snprintf(archiveRoot, sizeof(archiveRoot), "%s/bundle%ld",  cache->cacheDir, id);
-        status = bundleArchive_create(archiveRoot, id, location, inputFile, bundle_archive);
+		status = bundleArchive_create(archiveRoot, id, location, inputFile, bundle_archive);
 	}
 
 	framework_logIfError(logger, status, NULL, "Failed to create archive");
@@ -159,48 +168,48 @@
 }
 
 static celix_status_t bundleCache_deleteTree(bundle_cache_pt cache, char * directory) {
-    DIR *dir;
-    celix_status_t status = CELIX_SUCCESS;
-    struct stat st;
+	DIR *dir;
+	celix_status_t status = CELIX_SUCCESS;
+	struct stat st;
 
-    dir = opendir(directory);
-    if (dir == NULL) {
-        status = CELIX_FILE_IO_EXCEPTION;
-    } else {
-        struct dirent dp;
-        struct dirent *result = NULL;
-        int rc = 0;
-        rc = readdir_r(dir, &dp, &result);
-        while (rc == 0 && result != NULL) {
-            if ((strcmp((dp.d_name), ".") != 0) && (strcmp((dp.d_name), "..") != 0)) {
-                char subdir[512];
-                snprintf(subdir, sizeof(subdir), "%s/%s", directory, dp.d_name);
+	dir = opendir(directory);
+	if (dir == NULL) {
+		status = CELIX_FILE_IO_EXCEPTION;
+	} else {
+		struct dirent dp;
+		struct dirent *result = NULL;
+		int rc = 0;
+		rc = readdir_r(dir, &dp, &result);
+		while (rc == 0 && result != NULL) {
+			if ((strcmp((dp.d_name), ".") != 0) && (strcmp((dp.d_name), "..") != 0)) {
+				char subdir[512];
+				snprintf(subdir, sizeof(subdir), "%s/%s", directory, dp.d_name);
 
-                if (stat(subdir, &st) == 0) {
-                    if (S_ISDIR (st.st_mode)) {
-                        status = bundleCache_deleteTree(cache, subdir);
-                    } else {
-                        if (remove(subdir) != 0) {
-                            status = CELIX_FILE_IO_EXCEPTION;
-                            break;
-                        }
-                    }
-                }
-            }
-            readdir_r(dir, &dp, &result);
-        }
+				if (stat(subdir, &st) == 0) {
+					if (S_ISDIR (st.st_mode)) {
+						status = bundleCache_deleteTree(cache, subdir);
+					} else {
+						if (remove(subdir) != 0) {
+							status = CELIX_FILE_IO_EXCEPTION;
+							break;
+						}
+					}
+				}
+			}
+			rc = readdir_r(dir, &dp, &result);
+		}
 
-        if (closedir(dir) != 0) {
-            status = CELIX_FILE_IO_EXCEPTION;
-        }
-        if (status == CELIX_SUCCESS) {
-            if (rmdir(directory) != 0) {
-                status = CELIX_FILE_IO_EXCEPTION;
-            }
-        }
-    }
+		if (closedir(dir) != 0) {
+			status = CELIX_FILE_IO_EXCEPTION;
+		}
+		if (status == CELIX_SUCCESS) {
+			if (rmdir(directory) != 0) {
+				status = CELIX_FILE_IO_EXCEPTION;
+			}
+		}
+	}
 
-    framework_logIfError(logger, status, NULL, "Failed to delete tree at dir '%s'", directory);
+	framework_logIfError(logger, status, NULL, "Failed to delete tree at dir '%s'", directory);
 
-    return status;
+	return status;
 }
diff --git a/framework/private/src/bundle_context.c b/framework/private/src/bundle_context.c
index 594355c..7951f87 100644
--- a/framework/private/src/bundle_context.c
+++ b/framework/private/src/bundle_context.c
@@ -98,11 +98,11 @@
 	return status;
 }
 
-celix_status_t bundleContext_installBundle(bundle_context_pt context, char * location, bundle_pt *bundle) {
+celix_status_t bundleContext_installBundle(bundle_context_pt context, const char * location, bundle_pt *bundle) {
 	return bundleContext_installBundle2(context, location, NULL, bundle);
 }
 
-celix_status_t bundleContext_installBundle2(bundle_context_pt context, char * location, char *inputFile, bundle_pt *bundle) {
+celix_status_t bundleContext_installBundle2(bundle_context_pt context, const char * location, const char *inputFile, bundle_pt *bundle) {
 	celix_status_t status = CELIX_SUCCESS;
 	bundle_pt b = NULL;
 
@@ -121,7 +121,7 @@
 	return status;
 }
 
-celix_status_t bundleContext_registerService(bundle_context_pt context, char * serviceName, void * svcObj,
+celix_status_t bundleContext_registerService(bundle_context_pt context, const char * serviceName, const void * svcObj,
         properties_pt properties, service_registration_pt *service_registration) {
 	service_registration_pt registration = NULL;
 	celix_status_t status = CELIX_SUCCESS;
@@ -138,7 +138,7 @@
 	return status;
 }
 
-celix_status_t bundleContext_registerServiceFactory(bundle_context_pt context, char * serviceName, service_factory_pt factory,
+celix_status_t bundleContext_registerServiceFactory(bundle_context_pt context, const char * serviceName, service_factory_pt factory,
         properties_pt properties, service_registration_pt *service_registration) {
     service_registration_pt registration = NULL;
     celix_status_t status = CELIX_SUCCESS;
@@ -155,7 +155,7 @@
     return status;
 }
 
-celix_status_t bundleContext_getServiceReferences(bundle_context_pt context, const char * serviceName, char * filter, array_list_pt *service_references) {
+celix_status_t bundleContext_getServiceReferences(bundle_context_pt context, const char * serviceName, const char * filter, array_list_pt *service_references) {
     celix_status_t status = CELIX_SUCCESS;
 
     if (context != NULL && *service_references == NULL) {
@@ -169,7 +169,7 @@
 	return status;
 }
 
-celix_status_t bundleContext_getServiceReference(bundle_context_pt context, char * serviceName, service_reference_pt *service_reference) {
+celix_status_t bundleContext_getServiceReference(bundle_context_pt context, const char * serviceName, service_reference_pt *service_reference) {
     service_reference_pt reference = NULL;
     array_list_pt services = NULL;
     celix_status_t status = CELIX_SUCCESS;
@@ -219,11 +219,14 @@
     return status;
 }
 
-celix_status_t bundleContext_getService(bundle_context_pt context, service_reference_pt reference, void **service_instance) {
+celix_status_t bundleContext_getService(bundle_context_pt context, service_reference_pt reference, void** service_instance) {
     celix_status_t status = CELIX_SUCCESS;
 
     if (context != NULL && reference != NULL && *service_instance == NULL) {
-	    status = fw_getService(context->framework, context->bundle, reference, service_instance);
+        /*NOTE argument service_instance should be considerd a 'const void**'. 
+        To ensure backwards compatiblity a cast is made instead.
+        */
+	    status = fw_getService(context->framework, context->bundle, reference, (const void**) service_instance);
     } else {
         status = CELIX_ILLEGAL_ARGUMENT;
     }
@@ -278,7 +281,7 @@
 	return status;
 }
 
-celix_status_t bundleContext_addServiceListener(bundle_context_pt context, service_listener_pt listener, char * filter) {
+celix_status_t bundleContext_addServiceListener(bundle_context_pt context, service_listener_pt listener, const char* filter) {
     celix_status_t status = CELIX_SUCCESS;
 
     if (context != NULL && listener != NULL) {
@@ -362,16 +365,20 @@
     return status;
 }
 
-celix_status_t bundleContext_getProperty(bundle_context_pt context, const char *name, char **value) {
-	celix_status_t status = CELIX_SUCCESS;
+celix_status_t bundleContext_getProperty(bundle_context_pt context, const char *name, const char** value) {
+	return bundleContext_getPropertyWithDefault(context, name, NULL, value);
+}
 
-	if (context == NULL || name == NULL || *value != NULL) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	} else {
-		fw_getProperty(context->framework, name, value);
-	}
+celix_status_t bundleContext_getPropertyWithDefault(bundle_context_pt context, const char* name, const char* defaultValue, const char** value) {
+    celix_status_t status = CELIX_SUCCESS;
 
-	framework_logIfError(logger, status, NULL, "Failed to get property [name=%s]", name);
+    if (context == NULL || name == NULL || *value != NULL) {
+        status = CELIX_ILLEGAL_ARGUMENT;
+    } else {
+        fw_getProperty(context->framework, name, defaultValue, value);
+    }
 
-	return status;
+    framework_logIfError(logger, status, NULL, "Failed to get property [name=%s]", name);
+
+    return status;
 }
diff --git a/framework/private/src/bundle_revision.c b/framework/private/src/bundle_revision.c
index 6c538f9..b0d993c 100644
--- a/framework/private/src/bundle_revision.c
+++ b/framework/private/src/bundle_revision.c
@@ -34,7 +34,7 @@
 #include "archive.h"
 #include "celix_log.h"
 
-celix_status_t bundleRevision_create(char *root, char *location, long revisionNr, char *inputFile, bundle_revision_pt *bundle_revision) {
+celix_status_t bundleRevision_create(const char *root, const char *location, long revisionNr, const char *inputFile, bundle_revision_pt *bundle_revision) {
     celix_status_t status = CELIX_SUCCESS;
 	bundle_revision_pt revision = NULL;
 
@@ -102,7 +102,7 @@
 	return status;
 }
 
-celix_status_t bundleRevision_getLocation(bundle_revision_pt revision, char **location) {
+celix_status_t bundleRevision_getLocation(bundle_revision_pt revision, const char **location) {
 	celix_status_t status = CELIX_SUCCESS;
 	if (revision == NULL) {
 		status = CELIX_ILLEGAL_ARGUMENT;
@@ -115,7 +115,7 @@
 	return status;
 }
 
-celix_status_t bundleRevision_getRoot(bundle_revision_pt revision, char **root) {
+celix_status_t bundleRevision_getRoot(bundle_revision_pt revision, const char **root) {
 	celix_status_t status = CELIX_SUCCESS;
 	if (revision == NULL) {
 		status = CELIX_ILLEGAL_ARGUMENT;
diff --git a/framework/private/src/capability.c b/framework/private/src/capability.c
index 5ca66ea..9e4dc3a 100644
--- a/framework/private/src/capability.c
+++ b/framework/private/src/capability.c
@@ -84,7 +84,7 @@
 	return CELIX_SUCCESS;
 }
 
-celix_status_t capability_getServiceName(capability_pt capability, char **serviceName) {
+celix_status_t capability_getServiceName(capability_pt capability, const char **serviceName) {
 	*serviceName = capability->serviceName;
 	return CELIX_SUCCESS;
 }
diff --git a/framework/private/src/celix_launcher.c b/framework/private/src/celix_launcher.c
index 144c8dc..0fd04cf 100644
--- a/framework/private/src/celix_launcher.c
+++ b/framework/private/src/celix_launcher.c
@@ -40,127 +40,136 @@
 #include "linked_list_iterator.h"
 
 int celixLauncher_launch(const char *configFile, framework_pt *framework) {
-    int status = 0;
-    FILE *config = fopen(configFile, "r");
-    if (config != NULL) {
-        status = celixLauncher_launchWithStream(config, framework);
-    } else {
-        fprintf(stderr, "Error: invalid or non-existing configuration file: '%s'.", configFile);
-        perror("");
-        status = 1;
-    }
-    return status;
+	int status = 0;
+	FILE *config = fopen(configFile, "r");
+	if (config != NULL) {
+		status = celixLauncher_launchWithStream(config, framework);
+	} else {
+		fprintf(stderr, "Error: invalid or non-existing configuration file: '%s'.", configFile);
+		perror("");
+		status = 1;
+	}
+	return status;
 }
 
 int celixLauncher_launchWithStream(FILE *stream, framework_pt *framework) {
-    int status = 0;
+	int status = 0;
 
-    properties_pt config = properties_loadWithStream(stream);
-    fclose(stream);
-    // Make sure we've read it and that nothing went wrong with the file access...
-    if (config == NULL) {
-        fprintf(stderr, "Error: invalid configuration file");
-        perror(NULL);
-        status = 1;
-    }
-    else {
-        status = celixLauncher_launchWithProperties(config, framework);
-    }
+	properties_pt config = properties_loadWithStream(stream);
+	fclose(stream);
+	// Make sure we've read it and that nothing went wrong with the file access...
+	if (config == NULL) {
+		fprintf(stderr, "Error: invalid configuration file");
+		perror(NULL);
+		status = 1;
+	}
+	else {
+		status = celixLauncher_launchWithProperties(config, framework);
+	}
 
-    return status;
+	return status;
 }
 
 
 int celixLauncher_launchWithProperties(properties_pt config, framework_pt *framework) {
-    celix_status_t status;
+	celix_status_t status;
 #ifndef CELIX_NO_CURLINIT
-    // Before doing anything else, let's setup Curl
-    curl_global_init(CURL_GLOBAL_NOTHING);
+	// Before doing anything else, let's setup Curl
+	curl_global_init(CURL_GLOBAL_NOTHING);
 #endif
 
-    char *autoStart = properties_get(config, "cosgi.auto.start.1");
+	const char* autoStartProp = properties_get(config, "cosgi.auto.start.1");
+	char* autoStart = NULL;
+	if (autoStartProp != NULL) {
+		autoStart = strndup(autoStartProp, 1024*10);
+	}
 
-    status = framework_create(framework, config);
-    bundle_pt fwBundle = NULL;
-    if (status == CELIX_SUCCESS) {
-        status = fw_init(*framework);
-        if (status == CELIX_SUCCESS) {
-            // Start the system bundle
-            framework_getFrameworkBundle(*framework, &fwBundle);
-            bundle_start(fwBundle);
+	status = framework_create(framework, config);
+	bundle_pt fwBundle = NULL;
+	if (status == CELIX_SUCCESS) {
+		status = fw_init(*framework);
+		if (status == CELIX_SUCCESS) {
+			// Start the system bundle
+			status = framework_getFrameworkBundle(*framework, &fwBundle);
 
-            char delims[] = " ";
-            char *result = NULL;
-            char *save_ptr = NULL;
-            linked_list_pt bundles;
-            array_list_pt installed = NULL;
-            bundle_context_pt context = NULL;
-            linked_list_iterator_pt iter = NULL;
-            unsigned int i;
+			if(status == CELIX_SUCCESS){
+				bundle_start(fwBundle);
 
-            linkedList_create(&bundles);
-            result = strtok_r(autoStart, delims, &save_ptr);
-            while (result != NULL) {
-                char *location = strdup(result);
-                linkedList_addElement(bundles, location);
-                result = strtok_r(NULL, delims, &save_ptr);
-            }
-            // First install all bundles
-            // Afterwards start them
-            arrayList_create(&installed);
-            bundle_getContext(fwBundle, &context);
-            iter = linkedListIterator_create(bundles, 0);
-            while (linkedListIterator_hasNext(iter)) {
-                bundle_pt current = NULL;
-                char *location = (char *) linkedListIterator_next(iter);
-                if (bundleContext_installBundle(context, location, &current) == CELIX_SUCCESS) {
-                    // Only add bundle if it is installed correctly
-                    arrayList_add(installed, current);
-                } else {
-                    printf("Could not install bundle from %s\n", location);
-                }
-                linkedListIterator_remove(iter);
-                free(location);
-            }
-            linkedListIterator_destroy(iter);
-            linkedList_destroy(bundles);
+				char delims[] = " ";
+				char *result = NULL;
+				char *save_ptr = NULL;
+				linked_list_pt bundles;
+				array_list_pt installed = NULL;
+				bundle_context_pt context = NULL;
+				linked_list_iterator_pt iter = NULL;
+				unsigned int i;
 
-            for (i = 0; i < arrayList_size(installed); i++) {
-                bundle_pt installedBundle = (bundle_pt) arrayList_get(installed, i);
-                bundle_startWithOptions(installedBundle, 0);
-            }
+				linkedList_create(&bundles);
+				result = strtok_r(autoStart, delims, &save_ptr);
+				while (result != NULL) {
+					char *location = strdup(result);
+					linkedList_addElement(bundles, location);
+					result = strtok_r(NULL, delims, &save_ptr);
+				}
+				// First install all bundles
+				// Afterwards start them
+				arrayList_create(&installed);
+				bundle_getContext(fwBundle, &context);
+				iter = linkedListIterator_create(bundles, 0);
+				while (linkedListIterator_hasNext(iter)) {
+					bundle_pt current = NULL;
+					char *location = (char *) linkedListIterator_next(iter);
+					if (bundleContext_installBundle(context, location, &current) == CELIX_SUCCESS) {
+						// Only add bundle if it is installed correctly
+						arrayList_add(installed, current);
+					} else {
+						printf("Could not install bundle from %s\n", location);
+					}
+					linkedListIterator_remove(iter);
+					free(location);
+				}
+				linkedListIterator_destroy(iter);
+				linkedList_destroy(bundles);
 
-            arrayList_destroy(installed);
-        }
-    }
+				for (i = 0; i < arrayList_size(installed); i++) {
+					bundle_pt installedBundle = (bundle_pt) arrayList_get(installed, i);
+					bundle_startWithOptions(installedBundle, 0);
+				}
 
-    if (status != CELIX_SUCCESS) {
-        printf("Problem creating framework\n");
-    }
+				arrayList_destroy(installed);
+			}
+		}
+	}
 
-    printf("Launcher: Framework Started\n");
+	if (status != CELIX_SUCCESS) {
+		printf("Problem creating framework\n");
+	}
 
+	printf("Launcher: Framework Started\n");
 
-    return status;
+	free(autoStart);
+	
+	return status;
 }
 
 void celixLauncher_waitForShutdown(framework_pt framework) {
-    framework_waitForStop(framework);
+	framework_waitForStop(framework);
 }
 
 void celixLauncher_destroy(framework_pt framework) {
-    framework_destroy(framework);
+	framework_destroy(framework);
 
-    #ifndef CELIX_NO_CURLINIT
-        // Cleanup Curl
-        curl_global_cleanup();
-    #endif
+#ifndef CELIX_NO_CURLINIT
+	// Cleanup Curl
+	curl_global_cleanup();
+#endif
 
-    printf("Launcher: Exit\n");
+	printf("Launcher: Exit\n");
 }
 
 void celixLauncher_stop(framework_pt framework) {
-    bundle_pt fwBundle = NULL;
-    framework_getFrameworkBundle(framework, &fwBundle);
-    bundle_stop(fwBundle);
+	bundle_pt fwBundle = NULL;
+	if( framework_getFrameworkBundle(framework, &fwBundle) == CELIX_SUCCESS){
+		bundle_stop(fwBundle);
+	}
 }
diff --git a/framework/private/src/celix_log.c b/framework/private/src/celix_log.c
index d2e222e..c4d51e2 100644
--- a/framework/private/src/celix_log.c
+++ b/framework/private/src/celix_log.c
@@ -28,7 +28,7 @@
 #include "celix_errno.h"
 #include "celix_log.h"
 
-void framework_log(framework_logger_pt logger, framework_log_level_t level, const char *func, const char *file, int line, char *fmsg, ...) {
+void framework_log(framework_logger_pt logger, framework_log_level_t level, const char *func, const char *file, int line, const char *fmsg, ...) {
     char msg[512];
     va_list listPointer;
     va_start(listPointer, fmsg);
@@ -38,9 +38,11 @@
     if (logger != NULL && logger->logFunction != NULL) {
         logger->logFunction(level, func, file, line, msg);
     }
+
+    va_end(listPointer);
 }
 
-void framework_logCode(framework_logger_pt logger, framework_log_level_t level, const char *func, const char *file, int line, celix_status_t code, char *fmsg, ...) {
+void framework_logCode(framework_logger_pt logger, framework_log_level_t level, const char *func, const char *file, int line, celix_status_t code, const char *fmsg, ...) {
     char message[256];
     celix_strerror(code, message, 256);
     char msg[512];
@@ -49,9 +51,11 @@
     vsprintf(msg, fmsg, listPointer);
 
     framework_log(logger, level, func, file, line, "%s [%d]: %s", message, code, msg);
+
+    va_end(listPointer);
 }
 
-celix_status_t frameworkLogger_log(framework_log_level_t level, const char *func, const char *file, int line, char *msg) {
+celix_status_t frameworkLogger_log(framework_log_level_t level, const char *func, const char *file, int line, const char *msg) {
     char *levelStr = NULL;
     switch (level) {
         case OSGI_FRAMEWORK_LOG_ERROR:
diff --git a/framework/private/src/filter.c b/framework/private/src/filter.c
index 02ebc83..f06d6e8 100644
--- a/framework/private/src/filter.c
+++ b/framework/private/src/filter.c
@@ -31,16 +31,16 @@
 #include "celix_log.h"
 #include "filter_private.h"
 
-static void filter_skipWhiteSpace(char * filterString, int * pos);
-static filter_pt filter_parseFilter(char * filterString, int * pos);
-static filter_pt filter_parseFilterComp(char * filterString, int * pos);
-static filter_pt filter_parseAnd(char * filterString, int * pos);
-static filter_pt filter_parseOr(char * filterString, int * pos);
-static filter_pt filter_parseNot(char * filterString, int * pos);
-static filter_pt filter_parseItem(char * filterString, int * pos);
-static char * filter_parseAttr(char * filterString, int * pos);
-static char * filter_parseValue(char * filterString, int * pos);
-static array_list_pt filter_parseSubstring(char * filterString, int * pos);
+static void filter_skipWhiteSpace(char* filterString, int* pos);
+static filter_pt filter_parseFilter(char* filterString, int* pos);
+static filter_pt filter_parseFilterComp(char* filterString, int* pos);
+static filter_pt filter_parseAnd(char* filterString, int* pos);
+static filter_pt filter_parseOr(char* filterString, int* pos);
+static filter_pt filter_parseNot(char* filterString, int* pos);
+static filter_pt filter_parseItem(char* filterString, int* pos);
+static char * filter_parseAttr(char* filterString, int* pos);
+static char * filter_parseValue(char* filterString, int* pos);
+static array_list_pt filter_parseSubstring(char* filterString, int* pos);
 
 static celix_status_t filter_compare(OPERAND operand, char * string, void * value2, bool *result);
 static celix_status_t filter_compareString(OPERAND operand, char * string, void * value2, bool *result);
@@ -52,18 +52,19 @@
 	}
 }
 
-filter_pt filter_create(char * filterString) {
+filter_pt filter_create(const char* filterString) {
 	filter_pt filter = NULL;
+	char* filterStr = (char*) filterString;
 	int pos = 0;
-	filter = filter_parseFilter(filterString, &pos);
-	if (pos != strlen(filterString)) {
+	filter = filter_parseFilter(filterStr, &pos);
+	if (pos != strlen(filterStr)) {
 		fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR,  "Error: Extraneous trailing characters.");
 		filter_destroy(filter);
 		return NULL;
 	}
 	if(filter != NULL){
-		filter->filterStr = filterString;
-	}
+		filter->filterStr = filterStr;
+	} 
 
 	return filter;
 }
@@ -107,7 +108,7 @@
 	filter_pt filter;
 	filter_skipWhiteSpace(filterString, pos);
 	if (filterString[*pos] != '(') {
-		fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Error: Missing '('.");
+		fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Error: Missing '(' in filter string '%s'.", filterString);
 		return NULL;
 	}
 	(*pos)++;
@@ -117,7 +118,7 @@
 	filter_skipWhiteSpace(filterString, pos);
 
 	if (filterString[*pos] != ')') {
-		fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Error: Missing ')'.");
+		fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Error: Missing ')' in filter string '%s'.", filterString);
 		if(filter!=NULL){
 			filter_destroy(filter);
 		}
@@ -549,12 +550,12 @@
 		case LESS :
         case LESSEQUAL :
 		case APPROX : {
-			char * value = (properties == NULL) ? NULL: properties_get(properties, filter->attribute);
+			char * value = (properties == NULL) ? NULL: (char*)properties_get(properties, filter->attribute);
 
 			return filter_compare(filter->operand, value, filter->value, result);
 		}
 		case PRESENT: {
-			char * value = (properties == NULL) ? NULL: properties_get(properties, filter->attribute);
+			char * value = (properties == NULL) ? NULL: (char*)properties_get(properties, filter->attribute);
 			*result = value != NULL;
 			return CELIX_SUCCESS;
 		}
@@ -662,7 +663,7 @@
 	return CELIX_SUCCESS;
 }
 
-celix_status_t filter_getString(filter_pt filter, char **filterStr) {
+celix_status_t filter_getString(filter_pt filter, const char **filterStr) {
 	if (filter != NULL) {
 		*filterStr = filter->filterStr;
 	}
diff --git a/framework/private/src/framework.c b/framework/private/src/framework.c
index 6190121..a9d19f8 100644
--- a/framework/private/src/framework.c
+++ b/framework/private/src/framework.c
@@ -26,7 +26,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <sys/stat.h>
+#include <unistd.h>
 #include "celixbool.h"
 
 #ifdef _WIN32
@@ -67,12 +67,12 @@
 bool framework_acquireGlobalLock(framework_pt framework);
 celix_status_t framework_releaseGlobalLock(framework_pt framework);
 
-celix_status_t framework_acquireInstallLock(framework_pt framework, char * location);
-celix_status_t framework_releaseInstallLock(framework_pt framework, char * location);
+celix_status_t framework_acquireInstallLock(framework_pt framework, const char* location);
+celix_status_t framework_releaseInstallLock(framework_pt framework, const char* location);
 
 long framework_getNextBundleId(framework_pt framework);
 
-celix_status_t fw_installBundle2(framework_pt framework, bundle_pt * bundle, long id, char * location, char *inputFile, bundle_archive_pt archive);
+celix_status_t fw_installBundle2(framework_pt framework, bundle_pt * bundle, long id, const char * location, const char *inputFile, bundle_archive_pt archive);
 
 celix_status_t fw_refreshBundles(framework_pt framework, bundle_pt bundles[], int size);
 celix_status_t fw_refreshBundle(framework_pt framework, bundle_pt bundle);
@@ -87,8 +87,8 @@
 celix_status_t fw_invokeFrameworkListener(framework_pt framework, framework_listener_pt listener, framework_event_pt event, bundle_pt bundle);
 
 static celix_status_t framework_loadBundleLibraries(framework_pt framework, bundle_pt bundle);
-static celix_status_t framework_loadLibraries(framework_pt framework, char *libraries, char *activator, bundle_archive_pt archive, void **activatorHandle);
-static celix_status_t framework_loadLibrary(framework_pt framework, char *library, bundle_archive_pt archive, void **handle);
+static celix_status_t framework_loadLibraries(framework_pt framework, const char* libraries, const char* activator, bundle_archive_pt archive, void **activatorHandle);
+static celix_status_t framework_loadLibrary(framework_pt framework, const char* library, bundle_archive_pt archive, void **handle);
 
 static celix_status_t frameworkActivator_start(void * userData, bundle_context_pt context);
 static celix_status_t frameworkActivator_stop(void * userData, bundle_context_pt context);
@@ -160,6 +160,17 @@
     logger->logFunction = frameworkLogger_log;
 }
 
+/* Note: RTLD_NODELETE flag is needed in order to obtain a readable valgrind output.
+ * Valgrind output is written when the application terminates, so symbols resolving
+ * is impossible if dlopened libraries are unloaded before the application ends.
+ * RTLD_NODELETE closes the dynamic library but does not unload it from the memory space,
+ * so that symbols will be available until the application terminates.
+ * On the other hand, since the memory mapping is not destroyed after dlclose, calling again
+ * dlopen for the same library clashes with the previous mapping: this breaks the memory layout
+ * in case the user, for example, uninstall (dlclose) and install the bundle again (dlopen)
+ * So, RTLD_NODELETE should be used only for debugging purposes.
+ * Refer to dlopen manpage for additional details about libraries dynamic loading.
+ */
 #ifdef _WIN32
     #define handle_t HMODULE
     #define fw_openLibrary(path) LoadLibrary(path)
@@ -176,7 +187,11 @@
     }
 #else
     #define handle_t void *
-    #define fw_openLibrary(path) dlopen(path, RTLD_LAZY|RTLD_LOCAL)
+    #if defined(DEBUG) && !defined(ANDROID)
+	#define fw_openLibrary(path) dlopen(path, RTLD_LAZY|RTLD_LOCAL|RTLD_NODELETE)
+    #else
+	#define fw_openLibrary(path) dlopen(path, RTLD_LAZY|RTLD_LOCAL)
+    #endif
     #define fw_closeLibrary(handle) dlclose(handle)
     #define fw_getSymbol(handle, name) dlsym(handle, name)
     #define fw_getLastError() dlerror()
@@ -268,9 +283,11 @@
                     array_list_pt handles = NULL;
                     status = CELIX_DO_IF(status, bundleArchive_getCurrentRevision(archive, &revision));
                     status = CELIX_DO_IF(status, bundleRevision_getHandles(revision, &handles));
-                    for (int i = arrayList_size(handles) - 1; i >= 0; i--) {
-                        void *handle = arrayList_get(handles, i);
-                        fw_closeLibrary(handle);
+                    if (handles != NULL) {
+                        for (int i = arrayList_size(handles) - 1; i >= 0; i--) {
+                            void *handle = arrayList_get(handles, i);
+                            fw_closeLibrary(handle);
+                        }
                     }
                 }
 
@@ -338,7 +355,7 @@
 
 celix_status_t fw_init(framework_pt framework) {
 	bundle_state_e state;
-	char *location = NULL;
+	const char *location = NULL;
 	module_pt module = NULL;
 	linked_list_pt wires = NULL;
 	array_list_pt archives = NULL;
@@ -359,7 +376,7 @@
 	        status = CELIX_DO_IF(status, bundle_getState(framework->bundle, &state));
 	        if (status == CELIX_SUCCESS) {
 	            if (state == OSGI_FRAMEWORK_BUNDLE_INSTALLED) {
-	                char *clean = properties_get(framework->configurationMap, (char *) OSGI_FRAMEWORK_FRAMEWORK_STORAGE_CLEAN);
+	                const char *clean = properties_get(framework->configurationMap, OSGI_FRAMEWORK_FRAMEWORK_STORAGE_CLEAN);
 	                if (clean != NULL && (strcmp(clean, OSGI_FRAMEWORK_FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT) == 0)) {
 	                    bundleCache_delete(framework->cache);
 	                }
@@ -412,7 +429,7 @@
                 bundleArchive_closeAndDelete(archive1);
             } else {
                 bundle_pt bundle = NULL;
-                char *location1 = NULL;
+                const char *location1 = NULL;
                 status = bundleArchive_getLocation(archive1, &location1);
                 fw_installBundle2(framework, &bundle, id, location1, NULL, archive1);
             }
@@ -429,12 +446,12 @@
     status = CELIX_DO_IF(status, bundle_setContext(framework->bundle, context));
     if (status == CELIX_SUCCESS) {
         activator_pt activator = NULL;
-        activator = (activator_pt) malloc((sizeof(*activator)));
+        activator = (activator_pt) calloc(1,(sizeof(*activator)));
         if (activator != NULL) {
             bundle_context_pt context = NULL;
             void * userData = NULL;
 
-			create_function_pt create = NULL;
+			//create_function_pt create = NULL;
 			start_function_pt start = (start_function_pt) frameworkActivator_start;
 			stop_function_pt stop = (stop_function_pt) frameworkActivator_stop;
 			destroy_function_pt destroy = (destroy_function_pt) frameworkActivator_destroy;
@@ -446,15 +463,21 @@
             status = CELIX_DO_IF(status, bundle_getContext(framework->bundle, &context));
 
             if (status == CELIX_SUCCESS) {
-                if (create != NULL) {
+                /* This code part is in principle dead, but in future it may do something.
+                 * That's why it's outcommented and not deleted
+		if (create != NULL) {
                     create(context, &userData);
                 }
+                */
                 activator->userData = userData;
 
                 if (start != NULL) {
                     start(userData, context);
                 }
             }
+            else{
+            	free(activator);
+            }
         } else {
             status = CELIX_ENOMEM;
         }
@@ -506,29 +529,31 @@
 	fw_stopBundle(framework, framework->bundle, true);
 }
 
-celix_status_t fw_getProperty(framework_pt framework, const char *name, char **value) {
+celix_status_t fw_getProperty(framework_pt framework, const char* name, const char* defaultValue, const char** value) {
 	celix_status_t status = CELIX_SUCCESS;
 
 	if (framework == NULL || name == NULL || *value != NULL) {
 		status = CELIX_ILLEGAL_ARGUMENT;
-		fw_logCode(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, status, "Missing required arguments");
 	} else {
 		if (framework->configurationMap != NULL) {
-			*value = properties_get(framework->configurationMap, (char *) name);
+			*value = properties_get(framework->configurationMap, name);
 		}
 		if (*value == NULL) {
 			*value = getenv(name);
 		}
+        if (*value == NULL) {
+            *value = defaultValue;
+        }
 	}
 
 	return status;
 }
 
-celix_status_t fw_installBundle(framework_pt framework, bundle_pt * bundle, char * location, char *inputFile) {
+celix_status_t fw_installBundle(framework_pt framework, bundle_pt * bundle, const char * location, const char *inputFile) {
 	return fw_installBundle2(framework, bundle, -1, location, inputFile, NULL);
 }
 
-celix_status_t fw_installBundle2(framework_pt framework, bundle_pt * bundle, long id, char * location, char *inputFile, bundle_archive_pt archive) {
+celix_status_t fw_installBundle2(framework_pt framework, bundle_pt * bundle, long id, const char * location, const char *inputFile, bundle_archive_pt archive) {
     celix_status_t status = CELIX_SUCCESS;
 //    bundle_archive_pt bundle_archive = NULL;
     bundle_state_e state = OSGI_FRAMEWORK_BUNDLE_UNKNOWN;
@@ -596,29 +621,28 @@
   	return status;
 }
 
-celix_status_t framework_getBundleEntry(framework_pt framework, bundle_pt bundle, char *name, char **entry) {
+celix_status_t framework_getBundleEntry(framework_pt framework, bundle_pt bundle, const char* name, char** entry) {
 	celix_status_t status = CELIX_SUCCESS;
 
 	bundle_revision_pt revision;
 	bundle_archive_pt archive = NULL;
-    char *root;
+    const char *root;
 
 	status = CELIX_DO_IF(status, bundle_getArchive(bundle, &archive));
     status = CELIX_DO_IF(status, bundleArchive_getCurrentRevision(archive, &revision));
     status = CELIX_DO_IF(status, bundleRevision_getRoot(revision, &root));
     if (status == CELIX_SUCCESS) {
-        if ((strlen(name) > 0) && (name[0] == '/')) {
-            name++;
-        }
         char e[strlen(name) + strlen(root) + 2];
         strcpy(e, root);
-        strcat(e, "/");
-        strcat(e, name);
+        if ((strlen(name) > 0) && (name[0] == '/')) {
+            strcat(e, name);
+        } else {
+            strcat(e, "/");
+            strcat(e, name);
+        }
 
-        struct stat info;
-
-        if (stat(e, &info) == 0) {
-            (*entry) = strdup(e);
+        if (access(e, F_OK) == 0) {
+            (*entry) = strndup(e, 1024*10);
         } else {
             (*entry) = NULL;
         }
@@ -636,7 +660,7 @@
 	module_pt module = NULL;
 	activator_pt activator = NULL;
 	char *error = NULL;
-	char *name = NULL;
+	const char *name = NULL;
 
 	status = CELIX_DO_IF(status, framework_acquireBundleLock(framework, bundle, OSGI_FRAMEWORK_BUNDLE_INSTALLED|OSGI_FRAMEWORK_BUNDLE_RESOLVED|OSGI_FRAMEWORK_BUNDLE_STARTING|OSGI_FRAMEWORK_BUNDLE_ACTIVE));
 	status = CELIX_DO_IF(status, bundle_getState(bundle, &state));
@@ -683,7 +707,7 @@
                 status = CELIX_DO_IF(status, bundle_setContext(bundle, context));
 
                 if (status == CELIX_SUCCESS) {
-                    activator = (activator_pt) malloc((sizeof(*activator)));
+                    activator = (activator_pt) calloc(1,(sizeof(*activator)));
                     if (activator == NULL) {
                         status = CELIX_ENOMEM;
                     } else {
@@ -714,7 +738,6 @@
                         }
                         if (status == CELIX_SUCCESS) {
                             if (start != NULL) {
-
                                 status = CELIX_DO_IF(status, start(userData, context));
                             }
                         }
@@ -732,7 +755,7 @@
 
 	if (status != CELIX_SUCCESS) {
 	    module_pt module = NULL;
-	    char *symbolicName = NULL;
+	    const char *symbolicName = NULL;
 	    long id = 0;
 	    bundle_getCurrentModule(bundle, &module);
 	    module_getSymbolicName(module, &symbolicName);
@@ -742,15 +765,18 @@
 	    } else {
 	        fw_logCode(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, status, "Could not start bundle: %s [%ld]", symbolicName, id);
 	    }
+	    if(activator!=NULL){
+	    	free(activator);
+	    }
 	}
 
 	return status;
 }
 
-celix_status_t framework_updateBundle(framework_pt framework, bundle_pt bundle, char *inputFile) {
+celix_status_t framework_updateBundle(framework_pt framework, bundle_pt bundle, const char *inputFile) {
 	celix_status_t status = CELIX_SUCCESS;
 	bundle_state_e oldState;
-	char *location;
+	const char *location;
 	bundle_archive_pt archive = NULL;
 	char *error = NULL;
 
@@ -778,14 +804,16 @@
 	status = CELIX_DO_IF(status, bundleArchive_setLastModified(archive, time(NULL)));
 	status = CELIX_DO_IF(status, framework_setBundleStateAndNotify(framework, bundle, OSGI_FRAMEWORK_BUNDLE_INSTALLED));
 
-	// TODO Unload all libraries for transition to unresolved
 	bundle_revision_pt revision = NULL;
 	array_list_pt handles = NULL;
 	status = CELIX_DO_IF(status, bundleArchive_getCurrentRevision(archive, &revision));
     status = CELIX_DO_IF(status, bundleRevision_getHandles(revision, &handles));
-    for (int i = arrayList_size(handles) - 1; i >= 0; i--) {
-        void *handle = arrayList_get(handles, i);
-        fw_closeLibrary(handle);
+    if (handles != NULL) {
+        int i;
+	    for (i = arrayList_size(handles) - 1; i >= 0; i--) {
+	        void* handle = arrayList_get(handles, i);
+	        fw_closeLibrary(handle);
+	    }
     }
 
 
@@ -804,7 +832,7 @@
 
 	if (status != CELIX_SUCCESS) {
 	    module_pt module = NULL;
-        char *symbolicName = NULL;
+        const char *symbolicName = NULL;
         long id = 0;
         bundle_getCurrentModule(bundle, &module);
         module_getSymbolicName(module, &symbolicName);
@@ -886,7 +914,7 @@
                 status = CELIX_DO_IF(status, serviceRegistry_clearServiceRegistrations(framework->registry, bundle));
                 if (status == CELIX_SUCCESS) {
                     module_pt module = NULL;
-                    char *symbolicName = NULL;
+                    const char *symbolicName = NULL;
                     long id = 0;
                     bundle_getCurrentModule(bundle, &module);
                     module_getSymbolicName(module, &symbolicName);
@@ -915,7 +943,7 @@
 
 	if (status != CELIX_SUCCESS) {
 	    module_pt module = NULL;
-        char *symbolicName = NULL;
+        const char *symbolicName = NULL;
         long id = 0;
         bundle_getCurrentModule(bundle, &module);
         module_getSymbolicName(module, &symbolicName);
@@ -936,7 +964,7 @@
     celix_status_t status = CELIX_SUCCESS;
     bool locked;
     bundle_archive_pt archive = NULL;
-    char * location = NULL;
+    const char * location = NULL;
     bundle_pt target = NULL;
     char *error = NULL;
 
@@ -985,9 +1013,11 @@
 	array_list_pt handles = NULL;
 	status = CELIX_DO_IF(status, bundleArchive_getCurrentRevision(archive, &revision));
 	status = CELIX_DO_IF(status, bundleRevision_getHandles(revision, &handles));
-	for (int i = arrayList_size(handles) - 1; i >= 0; i--) {
-		void *handle = arrayList_get(handles, i);
-		fw_closeLibrary(handle);
+	if(handles != NULL){
+		for (int i = arrayList_size(handles) - 1; i >= 0; i--) {
+			void *handle = arrayList_get(handles, i);
+			fw_closeLibrary(handle);
+		}
 	}
 
     status = CELIX_DO_IF(status, fw_fireBundleEvent(framework, OSGI_FRAMEWORK_BUNDLE_EVENT_UNRESOLVED, bundle));
@@ -1159,26 +1189,28 @@
 celix_status_t fw_getDependentBundles(framework_pt framework, bundle_pt exporter, array_list_pt *list) {
     celix_status_t status = CELIX_SUCCESS;
 
-    if (*list == NULL && exporter != NULL && framework != NULL) {
-		array_list_pt modules;
-		unsigned int modIdx = 0;
-        arrayList_create(list);
-
-        modules = bundle_getModules(exporter);
-        for (modIdx = 0; modIdx < arrayList_size(modules); modIdx++) {
-            module_pt module = (module_pt) arrayList_get(modules, modIdx);
-            array_list_pt dependents = module_getDependents(module);
-            unsigned int depIdx = 0;
-            for (depIdx = 0; (dependents != NULL) && (depIdx < arrayList_size(dependents)); depIdx++) {
-                module_pt dependent = (module_pt) arrayList_get(dependents, depIdx);
-                arrayList_add(*list, module_getBundle(dependent));
-            }
-            arrayList_destroy(dependents);
-        }
-    } else {
-        status = CELIX_ILLEGAL_ARGUMENT;
+    if (*list != NULL || exporter == NULL || framework == NULL) {
+	return CELIX_ILLEGAL_ARGUMENT;
     }
 
+	 array_list_pt modules;
+	 unsigned int modIdx = 0;
+	 arrayList_create(list);
+
+	 modules = bundle_getModules(exporter);
+	 for (modIdx = 0; modIdx < arrayList_size(modules); modIdx++) {
+				module_pt module = (module_pt) arrayList_get(modules, modIdx);
+				array_list_pt dependents = module_getDependents(module);
+			if(dependents!=NULL){
+					unsigned int depIdx = 0;
+					for (depIdx = 0; depIdx < arrayList_size(dependents); depIdx++) {
+							  module_pt dependent = (module_pt) arrayList_get(dependents, depIdx);
+							  arrayList_add(*list, module_getBundle(dependent));
+					}
+					arrayList_destroy(dependents);
+				}
+	 }
+
     framework_logIfError(framework->logger, status, NULL, "Cannot get dependent bundles");
 
     return status;
@@ -1187,20 +1219,22 @@
 celix_status_t fw_populateDependentGraph(framework_pt framework, bundle_pt exporter, hash_map_pt *map) {
     celix_status_t status = CELIX_SUCCESS;
 
-    if (exporter != NULL && framework != NULL) {
-        array_list_pt dependents = NULL;
-        if ((status = fw_getDependentBundles(framework, exporter, &dependents)) == CELIX_SUCCESS) {
-            unsigned int depIdx = 0;
-            for (depIdx = 0; (dependents != NULL) && (depIdx < arrayList_size(dependents)); depIdx++) {
-                if (!hashMap_containsKey(*map, arrayList_get(dependents, depIdx))) {
-                    hashMap_put(*map, arrayList_get(dependents, depIdx), arrayList_get(dependents, depIdx));
-                    fw_populateDependentGraph(framework, (bundle_pt) arrayList_get(dependents, depIdx), map);
-                }
-            }
-            arrayList_destroy(dependents);
-        }
-    } else {
-        status = CELIX_ILLEGAL_ARGUMENT;
+    if(framework == NULL || exporter == NULL){
+	return CELIX_ILLEGAL_ARGUMENT;
+    }
+
+    array_list_pt dependents = NULL;
+    if ((status = fw_getDependentBundles(framework, exporter, &dependents)) == CELIX_SUCCESS) {
+		  if(dependents!=NULL){
+         unsigned int depIdx = 0;
+		for (depIdx = 0; depIdx < arrayList_size(dependents); depIdx++) {
+		    if (!hashMap_containsKey(*map, arrayList_get(dependents, depIdx))) {
+		        hashMap_put(*map, arrayList_get(dependents, depIdx), arrayList_get(dependents, depIdx));
+		        fw_populateDependentGraph(framework, (bundle_pt) arrayList_get(dependents, depIdx), map);
+		    }
+		}
+		arrayList_destroy(dependents);
+		  }
     }
 
     framework_logIfError(framework->logger, status, NULL, "Cannot populate dependent graph");
@@ -1208,7 +1242,7 @@
     return status;
 }
 
-celix_status_t fw_registerService(framework_pt framework, service_registration_pt *registration, bundle_pt bundle, char * serviceName, void * svcObj, properties_pt properties) {
+celix_status_t fw_registerService(framework_pt framework, service_registration_pt *registration, bundle_pt bundle, const char* serviceName, const void* svcObj, properties_pt properties) {
 	celix_status_t status = CELIX_SUCCESS;
 	char *error = NULL;
 	if (serviceName == NULL || svcObj == NULL) {
@@ -1256,19 +1290,20 @@
                         info->context = lContext;
                         info->removed = false;
                     }
-                    subs = CELIX_DO_IF(subs, filter_getString(listener->filter, &info->filter));
+                    subs = CELIX_DO_IF(subs, filter_getString(listener->filter, (const char**)&info->filter));
 
                     if (subs == CELIX_SUCCESS) {
                         arrayList_add(infos, info);
                     }
-                    if (subs != CELIX_SUCCESS) {
+                    else{
                         fw_logCode(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, status, "Could not pass all listeners to the hook: %s", serviceName);
+                        free(info);
                     }
                 }
 
                 status = CELIX_DO_IF(status, serviceRegistry_getServiceReference(framework->registry, framework->bundle,
                                                                                  *registration, &ref));
-                status = CELIX_DO_IF(status, fw_getService(framework,framework->bundle, ref, (void **) &hook));
+                status = CELIX_DO_IF(status, fw_getService(framework,framework->bundle, ref, (const void **) &hook));
                 if (status == CELIX_SUCCESS) {
                     hook->added(hook->handle, infos);
                 }
@@ -1290,7 +1325,7 @@
 	return status;
 }
 
-celix_status_t fw_registerServiceFactory(framework_pt framework, service_registration_pt *registration, bundle_pt bundle, char * serviceName, service_factory_pt factory, properties_pt properties) {
+celix_status_t fw_registerServiceFactory(framework_pt framework, service_registration_pt *registration, bundle_pt bundle, const char* serviceName, service_factory_pt factory, properties_pt properties) {
     celix_status_t status = CELIX_SUCCESS;
     char *error = NULL;
 	if (serviceName == NULL || factory == NULL) {
@@ -1310,7 +1345,7 @@
     return CELIX_SUCCESS;
 }
 
-celix_status_t fw_getServiceReferences(framework_pt framework, array_list_pt *references, bundle_pt bundle, const char * serviceName, char * sfilter) {
+celix_status_t fw_getServiceReferences(framework_pt framework, array_list_pt *references, bundle_pt bundle, const char * serviceName, const char * sfilter) {
     celix_status_t status = CELIX_SUCCESS;
 
 	filter_pt filter = NULL;
@@ -1330,12 +1365,12 @@
         for (refIdx = 0; (*references != NULL) && refIdx < arrayList_size(*references); refIdx++) {
             service_reference_pt ref = (service_reference_pt) arrayList_get(*references, refIdx);
             service_registration_pt reg = NULL;
-            char * serviceName;
+            const char* serviceName;
             properties_pt props = NULL;
             status = CELIX_DO_IF(status, serviceReference_getServiceRegistration(ref, &reg));
             status = CELIX_DO_IF(status, serviceRegistration_getProperties(reg, &props));
             if (status == CELIX_SUCCESS) {
-                serviceName = properties_get(props, (char *) OSGI_FRAMEWORK_OBJECTCLASS);
+                serviceName = properties_get(props, OSGI_FRAMEWORK_OBJECTCLASS);
                 if (!serviceReference_isAssignableTo(ref, bundle, serviceName)) {
                     arrayList_remove(*references, refIdx);
                     refIdx--;
@@ -1353,7 +1388,7 @@
     return serviceRegistry_ungetServiceReference(framework->registry, bundle, reference);
 }
 
-celix_status_t fw_getService(framework_pt framework, bundle_pt bundle, service_reference_pt reference, void **service) {
+celix_status_t fw_getService(framework_pt framework, bundle_pt bundle, service_reference_pt reference, const void **service) {
 	return serviceRegistry_getService(framework->registry, bundle, reference, service);
 }
 
@@ -1371,7 +1406,7 @@
 	return serviceRegistry_ungetService(framework->registry, bundle, reference, result);
 }
 
-void fw_addServiceListener(framework_pt framework, bundle_pt bundle, service_listener_pt listener, char * sfilter) {
+void fw_addServiceListener(framework_pt framework, bundle_pt bundle, service_listener_pt listener, const char* sfilter) {
 	array_list_pt listenerHooks = NULL;
 	listener_hook_info_pt info;
 	unsigned int i;
@@ -1407,7 +1442,7 @@
 		array_list_pt infos = NULL;
 		bool ungetResult = false;
 
-		fw_getService(framework, framework->bundle, ref, (void **) &hook);
+		fw_getService(framework, framework->bundle, ref, (const void **) &hook);
 
 		arrayList_create(&infos);
 		arrayList_add(infos, info);
@@ -1444,7 +1479,7 @@
 			info->context = lContext;
 
 			// TODO Filter toString;
-			filter_getString(element->filter, &info->filter);
+			filter_getString(element->filter, (const char**)&info->filter);
 			info->removed = true;
 
 			arrayList_remove(framework->serviceListeners, i);
@@ -1482,7 +1517,7 @@
 			array_list_pt infos = NULL;
 			bool ungetResult;
 
-			fw_getService(framework, framework->bundle, ref, (void **) &hook);
+			fw_getService(framework, framework->bundle, ref, (const void **) &hook);
 
 			arrayList_create(&infos);
 			arrayList_add(infos, info);
@@ -1634,8 +1669,10 @@
                 serviceRegistry_ungetServiceReference(framework->registry, element->bundle, reference);
                 
                 if (eventType == OSGI_FRAMEWORK_SERVICE_EVENT_UNREGISTERING) {
-                    arrayList_removeElement(element->retainedReferences, reference);
-                    serviceRegistry_ungetServiceReference(framework->registry, element->bundle, reference); // decrease retain counter
+                    //if service listener was active when service was registered, release the retained reference
+                    if (arrayList_removeElement(element->retainedReferences, reference)) {
+                        serviceRegistry_ungetServiceReference(framework->registry, element->bundle, reference); // decrease retain counter
+                    }
                 }
                 
                 free(event);
@@ -1751,7 +1788,7 @@
 			module_setResolved(module);
 			resolver_moduleResolved(module);
 
-			char *mname = NULL;
+			const char *mname = NULL;
 			module_getSymbolicName(module, &mname);
 			framework_markBundleResolved(framework, module);
 			linkedListIterator_remove(iterator);
@@ -1789,7 +1826,7 @@
 
 		if (status != CELIX_SUCCESS) {
             module_pt module = NULL;
-            char *symbolicName = NULL;
+            const char *symbolicName = NULL;
             long id = 0;
             module_getSymbolicName(module, &symbolicName);
             bundle_getBundleId(bundle, &id);
@@ -1825,7 +1862,7 @@
 	return bundles;
 }
 
-bundle_pt framework_getBundle(framework_pt framework, char * location) {
+bundle_pt framework_getBundle(framework_pt framework, const char* location) {
 	celixThreadMutex_lock(&framework->installedBundleMapLock);
 	bundle_pt bundle = (bundle_pt) hashMap_get(framework->installedBundleMap, location);
 	celixThreadMutex_unlock(&framework->installedBundleMapLock);
@@ -1853,20 +1890,20 @@
 	return bundle;
 }
 
-celix_status_t framework_acquireInstallLock(framework_pt framework, char * location) {
+celix_status_t framework_acquireInstallLock(framework_pt framework, const char * location) {
     celixThreadMutex_lock(&framework->installRequestLock);
 
 	while (hashMap_get(framework->installRequestMap, location) != NULL) {
 	    celixThreadCondition_wait(&framework->condition, &framework->installRequestLock);
 	}
-	hashMap_put(framework->installRequestMap, location, location);
+	hashMap_put(framework->installRequestMap, (char*)location, (char*)location);
 
 	celixThreadMutex_unlock(&framework->installRequestLock);
 
 	return CELIX_SUCCESS;
 }
 
-celix_status_t framework_releaseInstallLock(framework_pt framework, char * location) {
+celix_status_t framework_releaseInstallLock(framework_pt framework, const char* location) {
     celixThreadMutex_lock(&framework->installRequestLock);
 
 	hashMap_remove(framework->installRequestMap, location);
@@ -1920,16 +1957,17 @@
 
 		while (!lockable
 				|| (( celixThread_initalized(framework->globalLockThread) == true)
-				&& !isSelf)) {
+				&& !isSelf))
+		{
 			bundle_state_e state;
 			bundle_getState(bundle, &state);
 			if ((desiredStates & state) == 0) {
 				status = CELIX_ILLEGAL_STATE;
 				break;
-			} else
-				bundle_getLockingThread(bundle, &lockingThread);
-				if (isSelf
-					&& (celixThread_initalized(lockingThread) == true)
+			}
+
+			bundle_getLockingThread(bundle, &lockingThread);
+			if (isSelf && (celixThread_initalized(lockingThread) == true)
 					&& arrayList_contains(framework->globalLockWaitersList, &lockingThread)) {
 				framework->interrupted = true;
 //				celixThreadCondition_signal_thread_np(&framework->condition, bundle_getLockingThread(bundle));
@@ -1942,7 +1980,7 @@
 			if (status != CELIX_SUCCESS) {
 				break;
 			}
-		}
+	}
 
 		if (status == CELIX_SUCCESS) {
 			bundle_state_e state;
@@ -2160,8 +2198,6 @@
 		status = CELIX_ILLEGAL_ARGUMENT;
 	}
 
-	framework_logIfError(framework->logger, status, NULL, "Failed to get framework bundle");
-
 	return status;
 }
 
@@ -2201,7 +2237,7 @@
                 status = bundle_getCurrentModule(bundle, &module);
 
                 if (status == CELIX_SUCCESS) {
-                    char *symbolicName = NULL;
+                    const char *symbolicName = NULL;
                     status = module_getSymbolicName(module, &symbolicName);
                     if (status == CELIX_SUCCESS) {
                         request->bundleSymbolicName = strdup(symbolicName);
@@ -2213,12 +2249,10 @@
                 status = CELIX_FRAMEWORK_EXCEPTION;
             } else {
                 arrayList_add(framework->requests, request);
-                if (celixThreadCondition_broadcast(&framework->dispatcher)) {
+                celix_status_t bcast_status = celixThreadCondition_broadcast(&framework->dispatcher);
+                celix_status_t unlock_status = celixThreadMutex_unlock(&framework->dispatcherLock);
+                if (bcast_status!=0 || unlock_status!=0) {
                     status = CELIX_FRAMEWORK_EXCEPTION;
-                } else {
-                    if (celixThreadMutex_unlock(&framework->dispatcherLock)) {
-                        status = CELIX_FRAMEWORK_EXCEPTION;
-                    }
                 }
             }
         }
@@ -2263,7 +2297,7 @@
             status = bundle_getCurrentModule(bundle, &module);
 
             if (status == CELIX_SUCCESS) {
-                char *symbolicName = NULL;
+                const char *symbolicName = NULL;
                 status = module_getSymbolicName(module, &symbolicName);
                 if (status == CELIX_SUCCESS) {
                     request->bundleSymbolicName = strdup(symbolicName);
@@ -2281,12 +2315,10 @@
             status = CELIX_FRAMEWORK_EXCEPTION;
         } else {
             arrayList_add(framework->requests, request);
-            if (celixThreadCondition_broadcast(&framework->dispatcher)) {
-                status = CELIX_FRAMEWORK_EXCEPTION;
-            } else {
-                if (celixThreadMutex_unlock(&framework->dispatcherLock)) {
-                    status = CELIX_FRAMEWORK_EXCEPTION;
-                }
+            celix_status_t bcast_status = celixThreadCondition_broadcast(&framework->dispatcher);
+            celix_status_t unlock_status = celixThreadMutex_unlock(&framework->dispatcherLock);
+            if (bcast_status!=0 || unlock_status!=0) {
+		status = CELIX_FRAMEWORK_EXCEPTION;
             }
         }
     }
@@ -2449,9 +2481,9 @@
     status = CELIX_DO_IF(status, bundleArchive_getCurrentRevision(archive, &revision));
     status = CELIX_DO_IF(status, bundleRevision_getManifest(revision, &manifest));
     if (status == CELIX_SUCCESS) {
-        char *privateLibraries = NULL;
-        char *exportLibraries = NULL;
-        char *activator = NULL;
+        const char *privateLibraries = NULL;
+        const char *exportLibraries = NULL;
+        const char *activator = NULL;
 
         privateLibraries = manifest_getValue(manifest, OSGI_FRAMEWORK_PRIVATE_LIBRARY);
         exportLibraries = manifest_getValue(manifest, OSGI_FRAMEWORK_EXPORT_LIBRARY);
@@ -2469,6 +2501,9 @@
         if (status == CELIX_SUCCESS) {
             bundle_setHandle(bundle, handle);
         }
+        else if(handle != NULL){
+		fw_closeLibrary(handle);
+        }
     }
 
     framework_logIfError(framework->logger, status, NULL, "Could not load all bundle libraries");
@@ -2476,12 +2511,12 @@
     return status;
 }
 
-// TODO Store all handles for unloading!
-static celix_status_t framework_loadLibraries(framework_pt framework, char *libraries, char *activator, bundle_archive_pt archive, void **activatorHandle) {
+static celix_status_t framework_loadLibraries(framework_pt framework, const char *librariesIn, const char *activator, bundle_archive_pt archive, void **activatorHandle) {
     celix_status_t status = CELIX_SUCCESS;
 
-    char *last;
-    char *token = strtok_r(libraries, ",", &last);
+    char* last;
+    char* libraries = strndup(librariesIn, 1024*10);
+    char* token = strtok_r(libraries, ",", &last);
     while (token != NULL) {
         void *handle = NULL;
         char lib[128];
@@ -2510,12 +2545,11 @@
         char *trimmedLib = utils_stringTrim(lib);
         status = framework_loadLibrary(framework, trimmedLib, archive, &handle);
 
-        if (status == CELIX_SUCCESS) {
-            if (activator != NULL) {
-                if (strcmp(trimmedLib, activator) == 0) {
-                    *activatorHandle = handle;
-                }
-            }
+        if ( (status == CELIX_SUCCESS) && (activator != NULL) && (strcmp(trimmedLib, activator) == 0) ) {
+		    *activatorHandle = handle;
+        }
+        else if(handle!=NULL){
+        	fw_closeLibrary(handle);
         }
 
         token = strtok_r(NULL, ",", &last);
@@ -2523,10 +2557,11 @@
 
     framework_logIfError(framework->logger, status, NULL, "Could not load all libraries");
 
+    free(libraries);
     return status;
 }
 
-static celix_status_t framework_loadLibrary(framework_pt framework, char *library, bundle_archive_pt archive, void **handle) {
+static celix_status_t framework_loadLibrary(framework_pt framework, const char *library, bundle_archive_pt archive, void **handle) {
     celix_status_t status = CELIX_SUCCESS;
     char *error = NULL;
 
@@ -2543,7 +2578,7 @@
 
     char libraryPath[256];
     long refreshCount = 0;
-    char *archiveRoot = NULL;
+    const char *archiveRoot = NULL;
     long revisionNumber = 0;
 
     status = CELIX_DO_IF(status, bundleArchive_getRefreshCount(archive, &refreshCount));
@@ -2563,9 +2598,8 @@
     	status = CELIX_FRAMEWORK_EXCEPTION;
     } else {
 		*handle = fw_openLibrary(libraryPath);
-		if (*handle == NULL) {
+        if (*handle == NULL) {
 			error = fw_getLastError();
-			// #TODO this is wrong
 			status =  CELIX_BUNDLE_EXCEPTION;
 		} else {
 			bundle_revision_pt revision = NULL;
@@ -2574,7 +2608,9 @@
 			status = CELIX_DO_IF(status, bundleArchive_getCurrentRevision(archive, &revision));
 			status = CELIX_DO_IF(status, bundleRevision_getHandles(revision, &handles));
 
-			arrayList_add(handles, *handle);
+			if(handles != NULL){
+				arrayList_add(handles, *handle);
+			}
 		}
     }
 
diff --git a/framework/private/src/manifest.c b/framework/private/src/manifest.c
index 3cbb0e7..29b155a 100644
--- a/framework/private/src/manifest.c
+++ b/framework/private/src/manifest.c
@@ -63,7 +63,7 @@
 	return CELIX_SUCCESS;
 }
 
-celix_status_t manifest_createFromFile(char *filename, manifest_pt *manifest) {
+celix_status_t manifest_createFromFile(const char *filename, manifest_pt *manifest) {
 	celix_status_t status;
 
 	status = manifest_create(manifest);
@@ -90,7 +90,7 @@
 	return CELIX_SUCCESS;
 }
 
-celix_status_t manifest_read(manifest_pt manifest, char *filename) {
+celix_status_t manifest_read(manifest_pt manifest, const char *filename) {
     celix_status_t status = CELIX_SUCCESS;
 
 	FILE *file = fopen ( filename, "r" );
@@ -99,7 +99,9 @@
 		char name[512];
 		bool skipEmptyLines = true;
 		char lastline[512];
-		name[0] = '\0';
+		memset(lbuf,0,512);
+		memset(name,0,512);
+		memset(lastline,0,512);
 
 		manifest_readAttributes(manifest, manifest->mainAttributes, file);
 		
@@ -110,7 +112,7 @@
 			if (lbuf[--len] != '\n') {
 				status = CELIX_FILE_IO_EXCEPTION;
 				framework_logIfError(logger, status, NULL, "Manifest '%s' line too long", filename);
-				return status;
+				break;
 			}
 			if (len > 0 && lbuf[len - 1] == '\r') {
 				--len;
@@ -131,7 +133,7 @@
 				} else {
 					status = CELIX_FILE_IO_EXCEPTION;
 					framework_logIfError(logger, status, NULL, "Manifest '%s' invalid format", filename);
-					return status;
+					break;
 				}
 
 				if (fpeek(file) == ' ') {
@@ -180,12 +182,12 @@
 	return status;
 }
 
-void manifest_write(manifest_pt manifest, char * filename) {
+void manifest_write(manifest_pt manifest, const char * filename) {
 
 }
 
-char * manifest_getValue(manifest_pt manifest, const char * name) {
-	char * val = properties_get(manifest->mainAttributes, (char *) name);
+const char* manifest_getValue(manifest_pt manifest, const char* name) {
+	const char* val = properties_get(manifest->mainAttributes, name);
 	bool isEmpty = utils_isStringEmptyOrNull(val);
 	return isEmpty ? NULL : val;
 }
@@ -198,14 +200,13 @@
 }
 
 celix_status_t manifest_readAttributes(manifest_pt manifest, properties_pt properties, FILE *file) {
-	char name[512];
-	char value[512];
-	char lastLine[512];
-	char lbuf[512];
+	char name[512]; memset(name,0,512);
+	char value[512]; memset(value,0,512);
+	char lastLine[512]; memset(lastLine,0,512);
+	char lbuf[512]; memset(lbuf,0,512);
 
 
 	while (fgets(lbuf, sizeof(lbuf), file ) != NULL ) {
-		bool lineContinued = false;
 		int len = strlen(lbuf);
 
 		if (lbuf[--len] != '\n') {
@@ -224,7 +225,6 @@
 			buf[0] = '\0';
 
 			// Line continued
-			lineContinued = true;
 			strcat(buf, lastLine);
 			strncat(buf, lbuf+1, len - 1);
 
@@ -263,9 +263,7 @@
 			value[len - i] = '\0';
 		}
 
-		if ((properties_set(properties, name, value) != NULL) && (!lineContinued)) {
-			printf("Duplicate entry: %s", name);
-		}
+		properties_set(properties, name, value);
 	}
 
 	return CELIX_SUCCESS;
diff --git a/framework/private/src/manifest_parser.c b/framework/private/src/manifest_parser.c
index 1af4665..07b40a8 100644
--- a/framework/private/src/manifest_parser.c
+++ b/framework/private/src/manifest_parser.c
@@ -49,45 +49,45 @@
 	linked_list_pt requirements;
 };
 
-static linked_list_pt manifestParser_parseImportHeader(char * header);
-static linked_list_pt manifestParser_parseExportHeader(module_pt module, char * header);
-static linked_list_pt manifestParser_parseDelimitedString(char * value, char * delim);
-static linked_list_pt manifestParser_parseStandardHeaderClause(char * clauseString);
-static linked_list_pt manifestParser_parseStandardHeader(char * header);
+static linked_list_pt manifestParser_parseImportHeader(const char* header);
+static linked_list_pt manifestParser_parseExportHeader(module_pt module, const char* header);
+static linked_list_pt manifestParser_parseDelimitedString(const char* value, const char* delim);
+static linked_list_pt manifestParser_parseStandardHeaderClause(const char* clauseString);
+static linked_list_pt manifestParser_parseStandardHeader(const char* header);
 
 celix_status_t manifestParser_create(module_pt owner, manifest_pt manifest, manifest_parser_pt *manifest_parser) {
 	celix_status_t status;
-    manifest_parser_pt parser;
+	manifest_parser_pt parser;
 
-    status = CELIX_SUCCESS;
+	status = CELIX_SUCCESS;
 	parser = (manifest_parser_pt) malloc(sizeof(*parser));
 	if (parser) {
-		char * bundleVersion = NULL;
-		char * bundleSymbolicName = NULL;
-        parser->manifest = manifest;
-        parser->owner = owner;
+		const char * bundleVersion = NULL;
+		const char * bundleSymbolicName = NULL;
+		parser->manifest = manifest;
+		parser->owner = owner;
 
-        bundleVersion = manifest_getValue(manifest, OSGI_FRAMEWORK_BUNDLE_VERSION);
-        if (bundleVersion != NULL) {
-            parser->bundleVersion = NULL;
-            version_createVersionFromString(bundleVersion, &parser->bundleVersion);
-        } else {
-        	parser->bundleVersion = NULL;
+		bundleVersion = manifest_getValue(manifest, OSGI_FRAMEWORK_BUNDLE_VERSION);
+		if (bundleVersion != NULL) {
+			parser->bundleVersion = NULL;
+			version_createVersionFromString(bundleVersion, &parser->bundleVersion);
+		} else {
+			parser->bundleVersion = NULL;
 			version_createEmptyVersion(&parser->bundleVersion);
-        }
-        bundleSymbolicName = manifest_getValue(manifest, OSGI_FRAMEWORK_BUNDLE_SYMBOLICNAME);
-        if (bundleSymbolicName != NULL) {
-            parser->bundleSymbolicName = bundleSymbolicName;
-        }
+		}
+		bundleSymbolicName = manifest_getValue(manifest, OSGI_FRAMEWORK_BUNDLE_SYMBOLICNAME);
+		if (bundleSymbolicName != NULL) {
+			parser->bundleSymbolicName = (char*)bundleSymbolicName;
+		}
 
-        parser->capabilities = manifestParser_parseExportHeader(owner, manifest_getValue(manifest, OSGI_FRAMEWORK_EXPORT_LIBRARY));
-        parser->requirements = manifestParser_parseImportHeader(manifest_getValue(manifest, OSGI_FRAMEWORK_IMPORT_LIBRARY));
+		parser->capabilities = manifestParser_parseExportHeader(owner, manifest_getValue(manifest, OSGI_FRAMEWORK_EXPORT_LIBRARY));
+		parser->requirements = manifestParser_parseImportHeader(manifest_getValue(manifest, OSGI_FRAMEWORK_IMPORT_LIBRARY));
 
-        *manifest_parser = parser;
+		*manifest_parser = parser;
 
-	    status = CELIX_SUCCESS;
+		status = CELIX_SUCCESS;
 	} else {
-        status = CELIX_ENOMEM;
+		status = CELIX_ENOMEM;
 	}
 
 	framework_logIfError(logger, status, NULL, "Cannot create manifest parser");
@@ -96,305 +96,376 @@
 }
 
 celix_status_t manifestParser_destroy(manifest_parser_pt mp) {
-    linkedList_destroy(mp->capabilities);
-    mp->capabilities = NULL;
-    linkedList_destroy(mp->requirements);
-    mp->requirements = NULL;
-    mp->bundleSymbolicName = NULL;
-    version_destroy(mp->bundleVersion);
-    mp->bundleVersion = NULL;
-    mp->manifest = NULL;
-    mp->owner = NULL;
+	linkedList_destroy(mp->capabilities);
+	mp->capabilities = NULL;
+	linkedList_destroy(mp->requirements);
+	mp->requirements = NULL;
+	mp->bundleSymbolicName = NULL;
+	version_destroy(mp->bundleVersion);
+	mp->bundleVersion = NULL;
+	mp->manifest = NULL;
+	mp->owner = NULL;
 
-    free(mp);
+	free(mp);
 
-    return CELIX_SUCCESS;
+	return CELIX_SUCCESS;
 }
 
-static linked_list_pt manifestParser_parseDelimitedString(char * value, char * delim) {
-    linked_list_pt list;
+static linked_list_pt manifestParser_parseDelimitedString(const char * value, const char * delim) {
+	linked_list_pt list;
 
-    if (linkedList_create(&list) == CELIX_SUCCESS) {
-        if (value != NULL) {
-            int CHAR = 1;
-            int DELIMITER = 2;
-            int STARTQUOTE = 4;
-            int ENDQUOTE = 8;
+	if (linkedList_create(&list) == CELIX_SUCCESS) {
+		if (value != NULL) {
+			int CHAR = 1;
+			int DELIMITER = 2;
+			int STARTQUOTE = 4;
+			int ENDQUOTE = 8;
 
-            char buffer[512];
-            int expecting = (CHAR | DELIMITER | STARTQUOTE);
-            unsigned int i;
+			char buffer[512];
+			int expecting = (CHAR | DELIMITER | STARTQUOTE);
+			unsigned int i;
 
-            buffer[0] = '\0';
+			buffer[0] = '\0';
 
-            for (i = 0; i < strlen(value); i++) {
-                char c = value[i];
+			for (i = 0; i < strlen(value); i++) {
+				char c = value[i];
 
-                bool isDelimiter = (strchr(delim, c) != NULL);
-                bool isQuote = (c == '"');
+				bool isDelimiter = (strchr(delim, c) != NULL);
+				bool isQuote = (c == '"');
 
-                if (isDelimiter && ((expecting & DELIMITER) > 0)) {
-                    linkedList_addElement(list, strdup(buffer));
-                    buffer[0] = '\0';
-                    expecting = (CHAR | DELIMITER | STARTQUOTE);
-                } else if (isQuote && ((expecting & STARTQUOTE) > 0)) {
-                    char tmp[2];
-                    tmp[0] = c;
-                    tmp[1] = '\0';
-                    strcat(buffer, tmp);
-                    expecting = CHAR | ENDQUOTE;
-                } else if (isQuote && ((expecting & ENDQUOTE) > 0)) {
-                    char tmp[2];
-                    tmp[0] = c;
-                    tmp[1] = '\0';
-                    strcat(buffer, tmp);
-                    expecting = (CHAR | STARTQUOTE | DELIMITER);
-                } else if ((expecting & CHAR) > 0) {
-                    char tmp[2];
-                    tmp[0] = c;
-                    tmp[1] = '\0';
-                    strcat(buffer, tmp);
-                } else {
-                    return NULL;
-                }
-            }
+				if (isDelimiter && ((expecting & DELIMITER) > 0)) {
+					linkedList_addElement(list, strdup(buffer));
+					buffer[0] = '\0';
+					expecting = (CHAR | DELIMITER | STARTQUOTE);
+				} else if (isQuote && ((expecting & STARTQUOTE) > 0)) {
+					char tmp[2];
+					tmp[0] = c;
+					tmp[1] = '\0';
+					strcat(buffer, tmp);
+					expecting = CHAR | ENDQUOTE;
+				} else if (isQuote && ((expecting & ENDQUOTE) > 0)) {
+					char tmp[2];
+					tmp[0] = c;
+					tmp[1] = '\0';
+					strcat(buffer, tmp);
+					expecting = (CHAR | STARTQUOTE | DELIMITER);
+				} else if ((expecting & CHAR) > 0) {
+					char tmp[2];
+					tmp[0] = c;
+					tmp[1] = '\0';
+					strcat(buffer, tmp);
+				} else {
+					linkedList_destroy(list);
+					return NULL;
+				}
+			}
 
-            if (strlen(buffer) > 0) {
-                linkedList_addElement(list, strdup(utils_stringTrim(buffer)));
-            }
-        }
-    }
+			if (strlen(buffer) > 0) {
+				linkedList_addElement(list, strdup(utils_stringTrim(buffer)));
+			}
+		}
+	}
 
 	return list;
 }
 
-static linked_list_pt manifestParser_parseStandardHeaderClause(char * clauseString) {
-	linked_list_pt paths;
-    linked_list_pt clause;
-    linked_list_pt pieces;
+static linked_list_pt manifestParser_parseStandardHeaderClause(const char * clauseString) {
+	linked_list_pt paths = NULL;
+	linked_list_pt clause = NULL;
+	linked_list_pt pieces = NULL;
 
-    clause = NULL;
-    pieces = manifestParser_parseDelimitedString(clauseString, ";");
+	if(linkedList_create(&paths) != CELIX_SUCCESS){
+		return NULL;
+	}
 
-    if (linkedList_create(&paths) == CELIX_SUCCESS) {
-        int pathCount = 0;
-        int pieceIdx;
-        hash_map_pt dirsMap = NULL;
-        hash_map_pt attrsMap = NULL;
-        char * sep;
+	pieces = manifestParser_parseDelimitedString(clauseString, ";");
 
-        for (pieceIdx = 0; pieceIdx < linkedList_size(pieces); pieceIdx++) {
-            char * piece = linkedList_get(pieces, pieceIdx);
-            if (strchr(piece, '=') != NULL) {
-                break;
-            } else {
-                linkedList_addElement(paths, strdup(piece));
-                pathCount++;
-            }
-        }
+	if (pieces != NULL) {
+		int pathCount = 0;
+		int pieceIdx;
+		hash_map_pt dirsMap = NULL;
+		hash_map_pt attrsMap = NULL;
+		char * sep;
 
-        if (pathCount == 0) {
-            return NULL;
-        }
+		for (pieceIdx = 0; pieceIdx < linkedList_size(pieces); pieceIdx++) {
+			char * piece = linkedList_get(pieces, pieceIdx);
+			if (strchr(piece, '=') != NULL) {
+				break;
+			} else {
+				linkedList_addElement(paths, strdup(piece));
+				pathCount++;
+			}
+		}
 
-        dirsMap = hashMap_create(utils_stringHash, NULL, utils_stringEquals, NULL);
-        attrsMap = hashMap_create(utils_stringHash, NULL, utils_stringEquals, NULL);
+		if (pathCount != 0) {
 
+			dirsMap = hashMap_create(utils_stringHash, NULL, utils_stringEquals, NULL);
+			attrsMap = hashMap_create(utils_stringHash, NULL, utils_stringEquals, NULL);
 
-        for (pieceIdx = pathCount; pieceIdx < linkedList_size(pieces); pieceIdx++) {
-            char * sepPtr;
-            char * key;
-            char * value;
-            char * DIRECTIVE_SEP = ":=";
-            char * ATTRIBUTE_SEP = "=";
-            char * piece = linkedList_get(pieces, pieceIdx);
-            if ((sepPtr = strstr(piece, DIRECTIVE_SEP)) != NULL) {
-                sep = DIRECTIVE_SEP;
-            } else if ((sepPtr = strstr(piece, ATTRIBUTE_SEP)) != NULL) {
-                sep = ATTRIBUTE_SEP;
-            } else {
-                return NULL;
-            }
+			bool failure = false;
+			char *key = NULL;
+			char *value = NULL;
 
-            key = string_ndup(piece, sepPtr - piece);
-            value = strdup(sepPtr+strlen(sep));
+			for (pieceIdx = pathCount; pieceIdx < linkedList_size(pieces) && !failure ; pieceIdx++) {
+				char * sepPtr;
+				char * DIRECTIVE_SEP = ":=";
+				char * ATTRIBUTE_SEP = "=";
+				char * piece = linkedList_get(pieces, pieceIdx);
+				if ((sepPtr = strstr(piece, DIRECTIVE_SEP)) != NULL) {
+					sep = DIRECTIVE_SEP;
+				} else if ((sepPtr = strstr(piece, ATTRIBUTE_SEP)) != NULL) {
+					sep = ATTRIBUTE_SEP;
+				} else {
+					failure=true;
+					break;
+				}
 
-            if (value[0] == '"' && value[strlen(value) -1] == '"') {
-                char * oldV = strdup(value);
-                int len = strlen(oldV) - 2;
-                value = (char *) realloc(value, (sizeof(char) * len+1));
-                value[0] = '\0';
-                value = strncpy(value, oldV+1, strlen(oldV) - 2);
-                value[len] = '\0';
-                //check if correct
-                free(oldV);
-            }
+				if (strcmp(sep, DIRECTIVE_SEP) == 0) {
+					// Not implemented
+				}
+				else {
 
-            if (strcmp(sep, DIRECTIVE_SEP) == 0) {
-                // Not implemented
-            } else {
-                attribute_pt attr = NULL;
-                if (hashMap_containsKey(attrsMap, key)) {
-                    return NULL;
-                }
+					key = string_ndup(piece, sepPtr - piece);
+					value = strdup(sepPtr+strlen(sep));
 
-                if (attribute_create(key, value, &attr) == CELIX_SUCCESS) {
-                    hashMap_put(attrsMap, key, attr);
-                }
-            }
-        }
+					if (value[0] == '"' && value[strlen(value) -1] == '"') {
+						char * oldV = strdup(value);
+						int len = strlen(oldV) - 2;
+						value = (char *) realloc(value, (sizeof(char) * len+1));
+						value[0] = '\0';
+						value = strncpy(value, oldV+1, strlen(oldV) - 2);
+						value[len] = '\0';
+						//check if correct
+						free(oldV);
+					}
 
-        if (linkedList_create(&clause) == CELIX_SUCCESS) {
-            linkedList_addElement(clause, paths);
-            linkedList_addElement(clause, dirsMap);
-            linkedList_addElement(clause, attrsMap);
-        }
-    }
+					attribute_pt attr = NULL;
+					if (hashMap_containsKey(attrsMap, key)) {
+						failure=true;
+						break;
+					}
 
-    for(int listIdx = 0; listIdx < linkedList_size(pieces); listIdx++){
-    	void * element = linkedList_get(pieces, listIdx);
-    	free(element);
-    }
+					if (attribute_create(key, value, &attr) == CELIX_SUCCESS) {
+						hashMap_put(attrsMap, key, attr);
+					}
+				}
+			}
 
-    linkedList_destroy(pieces);
+			if(linkedList_create(&clause) != CELIX_SUCCESS){
+				failure=true;
+			}
 
+			if(failure){
+				hashMap_destroy(dirsMap,false,false);
+
+				hash_map_iterator_pt attrIter = hashMapIterator_create(attrsMap);
+				while(hashMapIterator_hasNext(attrIter)){
+					hash_map_entry_pt entry = hashMapIterator_nextEntry(attrIter);
+					char *mkey = (char*)hashMapEntry_getKey(entry);
+					attribute_pt mattr = (attribute_pt)hashMapEntry_getValue(entry);
+					free(mkey);
+					attribute_destroy(mattr);
+				}
+				hashMapIterator_destroy(attrIter);
+				hashMap_destroy(attrsMap,false,false);
+
+				if(key!=NULL){
+					free(key);
+				}
+				if(value!=NULL){
+					free(value);
+				}
+
+				linked_list_iterator_pt piter = linkedListIterator_create(paths,0);
+				while(linkedListIterator_hasNext(piter)){
+					free(linkedListIterator_next(piter));
+				}
+				linkedListIterator_destroy(piter);
+				linkedList_destroy(paths);
+
+				if(clause!=NULL){
+					linkedList_destroy(clause);
+					clause = NULL;
+				}
+			}
+			else{
+				linkedList_addElement(clause, paths);
+				linkedList_addElement(clause, dirsMap);
+				linkedList_addElement(clause, attrsMap);
+			}
+
+		}
+		else{
+			linkedList_destroy(paths);
+		}
+
+		for(int listIdx = 0; listIdx < linkedList_size(pieces); listIdx++){
+			void * element = linkedList_get(pieces, listIdx);
+			free(element);
+		}
+		linkedList_destroy(pieces);
+	}
+	else{
+		linkedList_destroy(paths);
+	}
 
 	return clause;
 }
 
-static linked_list_pt manifestParser_parseStandardHeader(char * header) {
-    linked_list_pt clauseStrings = NULL;
-    linked_list_pt completeList = NULL;
+static linked_list_pt manifestParser_parseStandardHeader(const char * header) {
+	linked_list_pt clauseStrings = NULL;
+	linked_list_pt completeList = NULL;
 
-    if (linkedList_create(&completeList) == CELIX_SUCCESS) {
-        if (header != NULL) {
-            if (strlen(header) == 0) {
-                return NULL;
-            }
+	if(header != NULL && strlen(header)==0){
+		return NULL;
+	}
 
-            char *hdr = strdup(header);
-            clauseStrings = manifestParser_parseDelimitedString(hdr, ",");
-            free(hdr);
-            if (clauseStrings != NULL) {
-                int i;
-                for (i = 0; i < linkedList_size(clauseStrings); i++) {
-                    char *clauseString = (char *) linkedList_get(clauseStrings, i);
-                    linkedList_addElement(completeList, manifestParser_parseStandardHeaderClause(clauseString));
-                    free(clauseString);
-                }
-                linkedList_destroy(clauseStrings);
-            }
+	if (linkedList_create(&completeList) == CELIX_SUCCESS) {
+		if(header!=NULL){
+			char *hdr = strdup(header);
+			clauseStrings = manifestParser_parseDelimitedString(hdr, ",");
+			free(hdr);
+			if (clauseStrings != NULL) {
+				int i;
+				for (i = 0; i < linkedList_size(clauseStrings); i++) {
+					char *clauseString = (char *) linkedList_get(clauseStrings, i);
+					linkedList_addElement(completeList, manifestParser_parseStandardHeaderClause(clauseString));
+					free(clauseString);
+				}
+				linkedList_destroy(clauseStrings);
+			}
 		}
+
 	}
 
 	return completeList;
 }
 
-static linked_list_pt manifestParser_parseImportHeader(char * header) {
-    linked_list_pt clauses;
-    linked_list_pt requirements;
+static linked_list_pt manifestParser_parseImportHeader(const char * header) {
+	linked_list_pt clauses = NULL;
+	linked_list_pt requirements = NULL;
+	bool failure = false;
 
-        int clauseIdx;
-		linked_list_iterator_pt iter;
-		clauses = manifestParser_parseStandardHeader(header);
-        linkedList_create(&requirements);
-        
-        for (clauseIdx = 0; clauseIdx < linkedList_size(clauses); clauseIdx++) {
-            linked_list_pt clause = linkedList_get(clauses, clauseIdx);
+	int clauseIdx;
+	linked_list_iterator_pt iter;
+	clauses = manifestParser_parseStandardHeader(header);
+	linkedList_create(&requirements);
 
-            linked_list_pt paths = linkedList_get(clause, 0);
-            hash_map_pt directives = linkedList_get(clause, 1);
-            hash_map_pt attributes = linkedList_get(clause, 2);
+	for (clauseIdx = 0; clauseIdx < linkedList_size(clauses) && !failure ; clauseIdx++) {
+		linked_list_pt clause = linkedList_get(clauses, clauseIdx);
 
-            int pathIdx;
-            for (pathIdx = 0; pathIdx < linkedList_size(paths); pathIdx++) {
-            	attribute_pt name = NULL;
-				requirement_pt req = NULL;
-				char * path = (char *) linkedList_get(paths, pathIdx);
-                if (strlen(path) == 0) {
-                    return NULL;
-                }
-                
-                if (attribute_create(strdup("service"), path, &name) == CELIX_SUCCESS) {
-                	char *key = NULL;
-                	attribute_getKey(name, &key);
-                    hashMap_put(attributes, key, name);
-                }
+		linked_list_pt paths = linkedList_get(clause, 0);
+		hash_map_pt directives = linkedList_get(clause, 1);
+		hash_map_pt attributes = linkedList_get(clause, 2);
 
-                requirement_create(directives, attributes, &req);
-                linkedList_addElement(requirements, req);
-            }
-        }
+		int pathIdx;
+		for (pathIdx = 0; pathIdx < linkedList_size(paths) && !failure ; pathIdx++) {
+			attribute_pt name = NULL;
+			requirement_pt req = NULL;
+			char * path = (char *) linkedList_get(paths, pathIdx);
+			if (strlen(path) == 0) {
+				failure = true;
+				break;
+			}
 
-        iter = linkedListIterator_create(clauses, 0);
-        while(linkedListIterator_hasNext(iter)) {
-            linked_list_pt clause = linkedListIterator_next(iter);
+			if (attribute_create(strdup("service"), path, &name) == CELIX_SUCCESS) {
+				char *key = NULL;
+				attribute_getKey(name, &key);
+				hashMap_put(attributes, key, name);
+			}
 
-            linked_list_pt paths = linkedList_get(clause, 0);
-            linkedList_destroy(paths);
+			requirement_create(directives, attributes, &req);
+			linkedList_addElement(requirements, req);
+		}
+	}
 
-            linkedListIterator_remove(iter);
-            linkedList_destroy(clause);
-        }
-        linkedListIterator_destroy(iter);
-        linkedList_destroy(clauses);
+	if(!failure){
+		iter = linkedListIterator_create(clauses, 0);
+		while(linkedListIterator_hasNext(iter)) {
+			linked_list_pt clause = linkedListIterator_next(iter);
+
+			linked_list_pt paths = linkedList_get(clause, 0);
+			linkedList_destroy(paths);
+
+			linkedListIterator_remove(iter);
+			linkedList_destroy(clause);
+		}
+		linkedListIterator_destroy(iter);
+	}
+
+	linkedList_destroy(clauses);
+
+	if(failure){
+		linkedList_destroy(requirements);
+		requirements = NULL;
+	}
 
 	return requirements;
 }
 
-static linked_list_pt manifestParser_parseExportHeader(module_pt module, char * header) {
-    linked_list_pt clauses;
-    linked_list_pt capabilities;
+static linked_list_pt manifestParser_parseExportHeader(module_pt module, const char * header) {
+	linked_list_pt clauses = NULL;
+	linked_list_pt capabilities = NULL;
 	int clauseIdx;
 	linked_list_iterator_pt iter;
-    clauses = manifestParser_parseStandardHeader(header);
-    linkedList_create(&capabilities);
+	bool failure = false;
 
-    
-    for (clauseIdx = 0; clauseIdx < linkedList_size(clauses); clauseIdx++) {
-        linked_list_pt clause = linkedList_get(clauses, clauseIdx);
+	clauses = manifestParser_parseStandardHeader(header);
+	linkedList_create(&capabilities);
 
-        linked_list_pt paths = linkedList_get(clause, 0);
-        hash_map_pt directives = linkedList_get(clause, 1);
-        hash_map_pt attributes = linkedList_get(clause, 2);
+	for (clauseIdx = 0; clauseIdx < linkedList_size(clauses) && !failure ; clauseIdx++) {
+		linked_list_pt clause = linkedList_get(clauses, clauseIdx);
 
-        int pathIdx;
-        for (pathIdx = 0; pathIdx < linkedList_size(paths); pathIdx++) {
-            char * path = (char *) linkedList_get(paths, pathIdx);
-            attribute_pt name = NULL;
+		linked_list_pt paths = linkedList_get(clause, 0);
+		hash_map_pt directives = linkedList_get(clause, 1);
+		hash_map_pt attributes = linkedList_get(clause, 2);
+
+		int pathIdx;
+		for (pathIdx = 0; pathIdx < linkedList_size(paths) && !failure ; pathIdx++) {
+			char * path = (char *) linkedList_get(paths, pathIdx);
+			attribute_pt name = NULL;
 			capability_pt cap = NULL;
 			if (strlen(path) == 0) {
-                return NULL;
-            }
+				failure=true;
+				break;
+			}
 
-            if (attribute_create(strdup("service"), path, &name) == CELIX_SUCCESS) {
-            	char *key = NULL;
+			if (attribute_create(strdup("service"), path, &name) == CELIX_SUCCESS) {
+				char *key = NULL;
 				attribute_getKey(name, &key);
 				hashMap_put(attributes, key, name);
-            }
+			}
 
-            capability_create(module, directives, attributes, &cap);
-            linkedList_addElement(capabilities, cap);
-        }
-    }
-    iter = linkedListIterator_create(clauses, 0);
-    while(linkedListIterator_hasNext(iter)) {
-        linked_list_pt clause = linkedListIterator_next(iter);
+			capability_create(module, directives, attributes, &cap);
+			linkedList_addElement(capabilities, cap);
+		}
+	}
 
-        linked_list_pt paths = linkedList_get(clause, 0);
-        linkedList_destroy(paths);
+	if(!failure){
+		iter = linkedListIterator_create(clauses, 0);
+		while(linkedListIterator_hasNext(iter)) {
+			linked_list_pt clause = linkedListIterator_next(iter);
 
-        linkedListIterator_remove(iter);
-        linkedList_destroy(clause);
-    }
-    linkedListIterator_destroy(iter);
-    linkedList_destroy(clauses);
+			linked_list_pt paths = linkedList_get(clause, 0);
+			linkedList_destroy(paths);
+
+			linkedListIterator_remove(iter);
+			linkedList_destroy(clause);
+		}
+		linkedListIterator_destroy(iter);
+	}
+
+	linkedList_destroy(clauses);
+	if(failure){
+		linkedList_destroy(capabilities);
+		capabilities = NULL;
+	}
 
 	return capabilities;
 }
 
-celix_status_t manifestParser_getSymbolicName(manifest_parser_pt parser, char **symbolicName) {
-	*symbolicName = strdup(parser->bundleSymbolicName);
+celix_status_t manifestParser_getAndDuplicateSymbolicName(manifest_parser_pt parser, char **symbolicName) {
+	*symbolicName = strndup(parser->bundleSymbolicName, 1024*10);
 	return CELIX_SUCCESS;
 }
 
diff --git a/framework/private/src/miniunz.c b/framework/private/src/miniunz.c
index a308e47..c3a9bd1 100644
--- a/framework/private/src/miniunz.c
+++ b/framework/private/src/miniunz.c
@@ -333,7 +333,7 @@
     return 0;
 }
 
-celix_status_t extractBundle(char * bundleName, char * revisionRoot) {
+celix_status_t extractBundle(const char* bundleName, const char* revisionRoot) {
     celix_status_t status = CELIX_SUCCESS;
     char filename_try[MAXFILENAME+16] = "";
     unzFile uf=NULL;
@@ -371,7 +371,7 @@
         printf("Cannot open %s or %s.zip\n",bundleName,bundleName);
         status = CELIX_FILE_IO_EXCEPTION;
     } else {
-        if (do_extract(uf, revisionRoot) != 0) {
+        if (do_extract(uf, (char*)revisionRoot) != 0) {
             status = CELIX_FILE_IO_EXCEPTION;
         }
 
diff --git a/framework/private/src/module.c b/framework/private/src/module.c
index 17fea5c..e81a1ee 100644
--- a/framework/private/src/module.c
+++ b/framework/private/src/module.c
@@ -48,7 +48,7 @@
 	struct bundle * bundle;
 };
 
-module_pt module_create(manifest_pt headerMap, char * moduleId, bundle_pt bundle) {
+module_pt module_create(manifest_pt headerMap, const char * moduleId, bundle_pt bundle) {
     module_pt module = NULL;
     manifest_parser_pt mp;
 
@@ -64,7 +64,7 @@
 
         if (manifestParser_create(module, headerMap, &mp) == CELIX_SUCCESS) {
             module->symbolicName = NULL;
-            manifestParser_getSymbolicName(mp, &module->symbolicName);
+            manifestParser_getAndDuplicateSymbolicName(mp, &module->symbolicName);
 
             module->version = NULL;
             manifestParser_getBundleVersion(mp, &module->version);
@@ -151,12 +151,12 @@
 	free(module);
 }
 
-wire_pt module_getWire(module_pt module, char * serviceName) {
+wire_pt module_getWire(module_pt module, const char * serviceName) {
 	wire_pt wire = NULL;
 	if (module->wires != NULL) {
 		linked_list_iterator_pt iterator = linkedListIterator_create(module->wires, 0);
 		while (linkedListIterator_hasNext(iterator)) {
-			char *name;
+			const char* name;
 			wire_pt next = linkedListIterator_next(iterator);
 			capability_pt cap = NULL;
 			wire_getCapability(next, &cap);
@@ -174,10 +174,10 @@
 	return module->version;
 }
 
-celix_status_t module_getSymbolicName(module_pt module, char **symbolicName) {
+celix_status_t module_getSymbolicName(module_pt module, const char **symbolicName) {
 	celix_status_t status = CELIX_SUCCESS;
 
-	if (module == NULL || *symbolicName != NULL) {
+	if (module == NULL) {
 		status = CELIX_ILLEGAL_ARGUMENT;
 	} else {
 		*symbolicName = module->symbolicName;
diff --git a/framework/private/src/properties.c b/framework/private/src/properties.c
index 5f1b67e..cd3b1f1 100644
--- a/framework/private/src/properties.c
+++ b/framework/private/src/properties.c
@@ -31,6 +31,10 @@
 #include "properties.h"
 #include "utils.h"
 
+#define MALLOC_BLOCK_SIZE		5
+
+static void parseLine(const char* line, properties_pt props);
+
 properties_pt properties_create(void) {
 	return hashMap_create(utils_stringHash, utils_stringHash, utils_stringEquals, utils_stringEquals);
 }
@@ -46,8 +50,11 @@
 	hashMap_destroy(properties, false, false);
 }
 
-properties_pt properties_load(char *filename) {
+properties_pt properties_load(const char* filename) {
 	FILE *file = fopen(filename, "r");
+	if(file==NULL){
+		return NULL;
+	}
 	properties_pt props = properties_loadWithStream(file);
 	fclose(file);
 	return props;
@@ -55,82 +62,33 @@
 
 FRAMEWORK_EXPORT properties_pt properties_loadWithStream(FILE *file) {
 	properties_pt props = NULL;
-	char line[1024];
-	char key[1024];
-	char value[1024];
-	bool precedingCharIsBackslash = false;
-	bool isComment = false;
-	int linePos = 0;
-	int outputPos = 0;
-	char *output = NULL;
+
 
 	if (file != NULL ) {
+		char *saveptr;
+		char *filebuffer = NULL;
+		char *line = NULL;
+		size_t file_size = 0;
+
 		props = properties_create();
-		while ( fgets ( line, sizeof line, file ) != NULL ) {
+		fseek(file, 0, SEEK_END);
+		file_size = ftell(file);
+		fseek(file, 0, SEEK_SET);
 
-			linePos = 0;
-			precedingCharIsBackslash = false;
-			isComment = false;
-			output = NULL;
-			outputPos = 0;
-			key[0] = '\0';
-			value[0] = '\0';
-
-			while (line[linePos] != '\0') {
-				if (line[linePos] == ' ' || line[linePos] == '\t') {
-					if (output == NULL) {
-						//ignore
-						linePos += 1;
-						continue;
-					} else {
-						output[outputPos++] = line[linePos];
-					}
-				} else {
-					if (output == NULL) {
-						output = key;
-					}
+		if(file_size > 0){
+			filebuffer = calloc(file_size + 1, sizeof(char));
+			if(filebuffer) {
+				size_t rs = fread(filebuffer, sizeof(char), file_size, file);
+				if(rs != file_size){
+					fprintf(stderr,"fread read only %lu bytes out of %lu\n",rs,file_size);
 				}
-				if (line[linePos] == '=' || line[linePos] == ':' || line[linePos] == '#' || line[linePos] == '!') {
-					if (precedingCharIsBackslash) {
-						//escaped special character
-						output[outputPos++] = line[linePos];
-						precedingCharIsBackslash = false;
-					} else {
-						if (line[linePos] == '#' || line[linePos] == '!') {
-							if (outputPos == 0) {
-								isComment = true;
-								break;
-							} else {
-								output[outputPos++] = line[linePos];
-							}
-						} else { // = or :
-							if (output == value) { //already have a seperator
-								output[outputPos++] = line[linePos];
-							} else {
-								output[outputPos++] = '\0';
-								output = value;
-								outputPos = 0;
-							}
-						}
-					}
-				} else if (line[linePos] == '\\') {
-					if (precedingCharIsBackslash) { //double backslash -> backslash
-						output[outputPos++] = '\\';
-					}
-					precedingCharIsBackslash = true;
-				} else { //normal character
-					precedingCharIsBackslash = false;
-					output[outputPos++] = line[linePos];
+				filebuffer[file_size]='\0';
+				line = strtok_r(filebuffer, "\n", &saveptr);
+				while ( line != NULL ) {
+					parseLine(line, props);
+					line = strtok_r(NULL, "\n", &saveptr);
 				}
-				linePos += 1;
-			}
-			if (output != NULL) {
-				output[outputPos] = '\0';
-			}
-
-			if (!isComment) {
-				//printf("putting 'key'/'value' '%s'/'%s' in properties\n", utils_stringTrim(key), utils_stringTrim(value));
-				hashMap_put(props, strdup(utils_stringTrim(key)), strdup(utils_stringTrim(value)));
+				free(filebuffer);
 			}
 		}
 	}
@@ -142,7 +100,7 @@
 /**
  * Header is ignored for now, cannot handle comments yet
  */
-void properties_store(properties_pt properties, char * filename, char * header) {
+void properties_store(properties_pt properties, const char* filename, const char* header) {
 	FILE *file = fopen ( filename, "w+" );
 	char *str;
 
@@ -204,15 +162,145 @@
 	return status;
 }
 
-char * properties_get(properties_pt properties, char * key) {
-	return hashMap_get(properties, key);
+const char* properties_get(properties_pt properties, const char* key) {
+	return hashMap_get(properties, (void*)key);
 }
 
-char * properties_getWithDefault(properties_pt properties, char * key, char * defaultValue) {
-	char * value = properties_get(properties, key);
+const char* properties_getWithDefault(properties_pt properties, const char* key, const char* defaultValue) {
+	const char* value = properties_get(properties, key);
 	return value == NULL ? defaultValue : value;
 }
 
-char * properties_set(properties_pt properties, char * key, char * value) {
-	return hashMap_put(properties, strdup(key), strdup(value));
+void properties_set(properties_pt properties, const char* key, const char* value) {
+	hash_map_entry_pt entry = hashMap_getEntry(properties, key);
+	char* oldValue = NULL;
+	if (entry != NULL) {
+		char* oldKey = hashMapEntry_getKey(entry);
+		oldValue = hashMapEntry_getValue(entry);
+		hashMap_put(properties, oldKey, strndup(value, 1024*10));
+	} else {
+		hashMap_put(properties, strndup(key, 1024*10), strndup(value, 1024*10));
+	}
+	free(oldValue);
+}
+
+static void updateBuffers(char **key, char ** value, char **output, int outputPos, int *key_len, int *value_len) {
+	if (*output == *key) {
+		if (outputPos == (*key_len) - 1) {
+			(*key_len) += MALLOC_BLOCK_SIZE;
+			*key = realloc(*key, *key_len);
+			*output = *key;
+		}
+	}
+	else {
+		if (outputPos == (*value_len) - 1) {
+			(*value_len) += MALLOC_BLOCK_SIZE;
+			*value = realloc(*value, *value_len);
+			*output = *value;
+		}
+	}
+}
+
+static void parseLine(const char* line, properties_pt props) {
+	int linePos = 0;
+	bool precedingCharIsBackslash = false;
+	bool isComment = false;
+	int outputPos = 0;
+	char *output = NULL;
+	int key_len = MALLOC_BLOCK_SIZE;
+	int value_len = MALLOC_BLOCK_SIZE;
+	linePos = 0;
+	precedingCharIsBackslash = false;
+	isComment = false;
+	output = NULL;
+	outputPos = 0;
+
+	//Ignore empty lines
+	if (line[0] == '\n' && line[1] == '\0') {
+		return;
+	}
+
+	char *key = calloc(1, key_len);
+	char *value = calloc(1, value_len);
+	key[0] = '\0';
+	value[0] = '\0';
+
+	while (line[linePos] != '\0') {
+		if (line[linePos] == ' ' || line[linePos] == '\t') {
+			if (output == NULL) {
+				//ignore
+				linePos += 1;
+				continue;
+			}
+			else {
+				output[outputPos++] = line[linePos];
+				updateBuffers(&key, &value, &output, outputPos, &key_len, &value_len);
+			}
+		}
+		else {
+			if (output == NULL) {
+				output = key;
+			}
+		}
+		if (line[linePos] == '=' || line[linePos] == ':' || line[linePos] == '#' || line[linePos] == '!') {
+			if (precedingCharIsBackslash) {
+				//escaped special character
+				output[outputPos++] = line[linePos];
+				updateBuffers(&key, &value, &output, outputPos, &key_len, &value_len);
+				precedingCharIsBackslash = false;
+			}
+			else {
+				if (line[linePos] == '#' || line[linePos] == '!') {
+					if (outputPos == 0) {
+						isComment = true;
+						break;
+					}
+					else {
+						output[outputPos++] = line[linePos];
+						updateBuffers(&key, &value, &output, outputPos, &key_len, &value_len);
+					}
+				}
+				else { // = or :
+					if (output == value) { //already have a seperator
+						output[outputPos++] = line[linePos];
+						updateBuffers(&key, &value, &output, outputPos, &key_len, &value_len);
+					}
+					else {
+						output[outputPos++] = '\0';
+						updateBuffers(&key, &value, &output, outputPos, &key_len, &value_len);
+						output = value;
+						outputPos = 0;
+					}
+				}
+			}
+		}
+		else if (line[linePos] == '\\') {
+			if (precedingCharIsBackslash) { //double backslash -> backslash
+				output[outputPos++] = '\\';
+				updateBuffers(&key, &value, &output, outputPos, &key_len, &value_len);
+			}
+			precedingCharIsBackslash = true;
+		}
+		else { //normal character
+			precedingCharIsBackslash = false;
+			output[outputPos++] = line[linePos];
+			updateBuffers(&key, &value, &output, outputPos, &key_len, &value_len);
+		}
+		linePos += 1;
+	}
+	if (output != NULL) {
+		output[outputPos] = '\0';
+	}
+
+	if (!isComment) {
+		//printf("putting 'key'/'value' '%s'/'%s' in properties\n", utils_stringTrim(key), utils_stringTrim(value));
+		properties_set(props, utils_stringTrim(key), utils_stringTrim(value));
+	}
+	if(key) {
+		free(key);
+	}
+	if(value) {
+		free(value);
+	}
+
 }
diff --git a/framework/private/src/requirement.c b/framework/private/src/requirement.c
index 375ede2..7ce585c 100644
--- a/framework/private/src/requirement.c
+++ b/framework/private/src/requirement.c
@@ -90,7 +90,7 @@
 	return CELIX_SUCCESS;
 }
 
-celix_status_t requirement_getTargetName(requirement_pt requirement, char **targetName) {
+celix_status_t requirement_getTargetName(requirement_pt requirement, const char **targetName) {
 	*targetName = requirement->targetName;
 	return CELIX_SUCCESS;
 }
diff --git a/framework/private/src/resolver.c b/framework/private/src/resolver.c
index aaded68..256eff5 100644
--- a/framework/private/src/resolver.c
+++ b/framework/private/src/resolver.c
@@ -55,7 +55,7 @@
 linked_list_pt m_resolvedServices = NULL;
 
 int resolver_populateCandidatesMap(hash_map_pt candidatesMap, module_pt targetModule);
-capability_list_pt resolver_getCapabilityList(linked_list_pt list, char * name);
+capability_list_pt resolver_getCapabilityList(linked_list_pt list, const char* name);
 void resolver_removeInvalidCandidate(module_pt module, hash_map_pt candidates, linked_list_pt invalid);
 linked_list_pt resolver_populateWireMap(hash_map_pt candidates, module_pt importer, linked_list_pt wireMap);
 
@@ -134,7 +134,7 @@
         for (i = 0; i < linkedList_size(module_getRequirements(targetModule)); i++) {
             capability_list_pt capList;
             requirement_pt req;
-            char *targetName = NULL;
+            const char *targetName = NULL;
             req = (requirement_pt) linkedList_get(module_getRequirements(targetModule), i);
             requirement_getTargetName(req, &targetName);
             capList = resolver_getCapabilityList(m_resolvedServices, targetName);
@@ -176,7 +176,7 @@
 
                 if (linkedList_size(candidates) == 0) {
                     if (linkedList_create(&invalid) == CELIX_SUCCESS) {
-                        char *name = NULL;
+                        const char *name = NULL;
                         resolver_removeInvalidCandidate(targetModule, candidatesMap, invalid);
 
                         module_getSymbolicName(targetModule, &name);
@@ -258,8 +258,8 @@
         linkedList_addElement(m_modules, module);
 
         for (i = 0; i < linkedList_size(module_getCapabilities(module)); i++) {
-            char *serviceName = NULL;
-            capability_list_pt list;
+            const char *serviceName = NULL;
+            capability_list_pt list = NULL;
             capability_pt cap;
 
             cap = (capability_pt) linkedList_get(module_getCapabilities(module), i);
@@ -272,9 +272,16 @@
                     if (linkedList_create(&list->capabilities) == CELIX_SUCCESS) {
                         linkedList_addElement(m_unresolvedServices, list);
                     }
+                    else{
+                    	free(list->serviceName);
+                    	free(list);
+			list=NULL;
+                    }
                 }
             }
-            linkedList_addElement(list->capabilities, cap);
+            if(list != NULL){
+		linkedList_addElement(list->capabilities, cap);
+            }
         }
     }
 }
@@ -287,7 +294,7 @@
         int i = 0;
         for (i = 0; i < linkedList_size(caps); i++) {
             capability_pt cap = (capability_pt) linkedList_get(caps, i);
-            char *serviceName = NULL;
+            const char *serviceName = NULL;
             capability_list_pt list;
             capability_getServiceName(cap, &serviceName);
             list = resolver_getCapabilityList(m_unresolvedServices, serviceName);
@@ -344,11 +351,13 @@
 
             for (capIdx = 0; (module_getCapabilities(module) != NULL) && (capIdx < linkedList_size(module_getCapabilities(module))); capIdx++) {
                 capability_pt cap = (capability_pt) linkedList_get(module_getCapabilities(module), capIdx);
-                char *serviceName = NULL;
+                const char *serviceName = NULL;
                 capability_list_pt list;
                 capability_getServiceName(cap, &serviceName);
                 list = resolver_getCapabilityList(m_unresolvedServices, serviceName);
-                linkedList_removeElement(list->capabilities, cap);
+                if(list != NULL){
+			linkedList_removeElement(list->capabilities, cap);
+                }
 
                 linkedList_addElement(capsCopy, cap);
             }
@@ -375,8 +384,8 @@
                 capability_pt cap = linkedList_get(capsCopy, capIdx);
 
                 if (cap != NULL) {
-                    char *serviceName = NULL;
-                    capability_list_pt list;
+                    const char *serviceName = NULL;
+                    capability_list_pt list = NULL;
                     capability_getServiceName(cap, &serviceName);
 
                     list = resolver_getCapabilityList(m_resolvedServices, serviceName);
@@ -387,9 +396,16 @@
                             if (linkedList_create(&list->capabilities) == CELIX_SUCCESS) {
                                 linkedList_addElement(m_resolvedServices, list);
                             }
+                            else{
+                            	free(list->serviceName);
+                            	free(list);
+				list=NULL;
+                            }
                         }
                     }
-                    linkedList_addElement(list->capabilities, cap);
+                    if(list != NULL){
+			linkedList_addElement(list->capabilities, cap);
+                    }
                 }
             }
 
@@ -398,7 +414,7 @@
     }
 }
 
-capability_list_pt resolver_getCapabilityList(linked_list_pt list, char * name) {
+capability_list_pt resolver_getCapabilityList(linked_list_pt list, const char * name) {
     capability_list_pt capabilityList = NULL;
     linked_list_iterator_pt iterator = linkedListIterator_create(list, 0);
     while (linkedListIterator_hasNext(iterator)) {
@@ -445,7 +461,7 @@
 
                     // hashMap_put(wireMap, importer, emptyWires);
 
-                    char *mname = NULL;
+                    const char *mname = NULL;
                     module_getSymbolicName(importer, &mname);
 
                     importer_wires_pt importerWires = malloc(sizeof(*importerWires));
diff --git a/framework/private/src/service_reference.c b/framework/private/src/service_reference.c
index c40d3c2..545426d 100644
--- a/framework/private/src/service_reference.c
+++ b/framework/private/src/service_reference.c
@@ -151,12 +151,15 @@
 celix_status_t serviceReference_getService(service_reference_pt ref, void **service) {
     celix_status_t status = CELIX_SUCCESS;
     celixThreadRwlock_readLock(&ref->lock);
-    *service = ref->service;
+    /*NOTE the service argument should be 'const void**'
+      To ensure backwards compatability a cast is made instead.
+    */
+    *service = (const void**) ref->service;
     celixThreadRwlock_unlock(&ref->lock);
     return status;
 }
 
-celix_status_t serviceReference_setService(service_reference_pt ref, void *service) {
+celix_status_t serviceReference_setService(service_reference_pt ref, const void *service) {
     celix_status_t status = CELIX_SUCCESS;
     celixThreadRwlock_writeLock(&ref->lock);
     ref->service = service;
@@ -190,20 +193,24 @@
 }
 
 celix_status_t serviceReference_getServiceRegistration(service_reference_pt ref, service_registration_pt *out) {
-    celixThreadRwlock_readLock(&ref->lock);
-    *out = ref->registration;
-    celixThreadRwlock_unlock(&ref->lock);
-    return CELIX_SUCCESS;
+    if (ref != NULL) {
+        celixThreadRwlock_readLock(&ref->lock);
+        *out = ref->registration;
+        celixThreadRwlock_unlock(&ref->lock);
+        return CELIX_SUCCESS;
+    } else {
+        return CELIX_ILLEGAL_ARGUMENT;
+    }
 }
 
-celix_status_t serviceReference_getProperty(service_reference_pt ref, char *key, char **value) {
+celix_status_t serviceReference_getProperty(service_reference_pt ref, const char* key, const char** value) {
     celix_status_t status = CELIX_SUCCESS;
     properties_pt props = NULL;
     celixThreadRwlock_readLock(&ref->lock);
     if (ref->registration != NULL) {
         status = serviceRegistration_getProperties(ref->registration, &props);
         if (status == CELIX_SUCCESS) {
-            *value = properties_get(props, key);
+            *value = (char*) properties_get(props, key);
         }
     } else {
         *value = NULL;
@@ -222,7 +229,7 @@
     int i = 0;
     int vsize = hashMap_size(props);
     *size = (unsigned int)vsize;
-    *keys = malloc(vsize * sizeof(*keys));
+    *keys = malloc(vsize * sizeof(**keys));
     it = hashMapIterator_create(props);
     while (hashMapIterator_hasNext(it)) {
         (*keys)[i] = hashMapIterator_nextKey(it);
@@ -255,7 +262,7 @@
     return CELIX_SUCCESS;
 }
 
-bool serviceReference_isAssignableTo(service_reference_pt reference __attribute__((unused)), bundle_pt requester __attribute__((unused)), char * serviceName __attribute__((unused))) {
+bool serviceReference_isAssignableTo(service_reference_pt reference __attribute__((unused)), bundle_pt requester __attribute__((unused)), const char* serviceName __attribute__((unused))) {
 	bool allow = true;
 
 	/*NOTE for now always true. It would be nice to be able to do somechecks if the services are really assignable.
@@ -279,9 +286,9 @@
 	return status;
 }
 
-int serviceReference_equals2(void *reference1, void *reference2) {
+int serviceReference_equals2(const void* reference1, const void* reference2) {
 	bool equal;
-	serviceReference_equals(reference1, reference2, &equal);
+	serviceReference_equals((service_reference_pt)reference1, (service_reference_pt)reference2, &equal);
 	return equal;
 }
 
@@ -289,7 +296,8 @@
 	celix_status_t status = CELIX_SUCCESS;
 
 	long id, other_id;
-	char *id_str, *other_id_str;
+	const char* id_str;
+    const char* other_id_str;
 	serviceReference_getProperty(reference, (char *) OSGI_FRAMEWORK_SERVICE_ID, &id_str);
 	serviceReference_getProperty(compareTo, (char *) OSGI_FRAMEWORK_SERVICE_ID, &other_id_str);
 
@@ -298,9 +306,10 @@
 
 
 	long rank, other_rank;
-	char *rank_str, *other_rank_str;
-	serviceReference_getProperty(reference, (char *) OSGI_FRAMEWORK_SERVICE_RANKING, &rank_str);
-	serviceReference_getProperty(compareTo, (char *) OSGI_FRAMEWORK_SERVICE_RANKING, &other_rank_str);
+	const char *rank_str;
+    const char* other_rank_str;
+	serviceReference_getProperty(reference, OSGI_FRAMEWORK_SERVICE_RANKING, &rank_str);
+	serviceReference_getProperty(compareTo, OSGI_FRAMEWORK_SERVICE_RANKING, &other_rank_str);
 
 	rank = rank_str == NULL ? 0 : atol(rank_str);
 	other_rank = other_rank_str == NULL ? 0 : atol(other_rank_str);
@@ -310,8 +319,8 @@
 	return status;
 }
 
-unsigned int serviceReference_hashCode(void *referenceP) {
-    service_reference_pt ref = referenceP;
+unsigned int serviceReference_hashCode(const void *referenceP) {
+    service_reference_pt ref = (service_reference_pt)referenceP;
     bundle_pt bundle = NULL;
     service_registration_pt reg = NULL;
 
diff --git a/framework/private/src/service_registration.c b/framework/private/src/service_registration.c
index f78fcca..e916457 100644
--- a/framework/private/src/service_registration.c
+++ b/framework/private/src/service_registration.c
@@ -32,24 +32,24 @@
 #include "constants.h"
 
 static celix_status_t serviceRegistration_initializeProperties(service_registration_pt registration, properties_pt properties);
-static celix_status_t serviceRegistration_createInternal(registry_callback_t callback, bundle_pt bundle, char * serviceName, long serviceId,
-        void * serviceObject, properties_pt dictionary, bool isFactory, service_registration_pt *registration);
+static celix_status_t serviceRegistration_createInternal(registry_callback_t callback, bundle_pt bundle, const char* serviceName, unsigned long serviceId,
+        const void * serviceObject, properties_pt dictionary, bool isFactory, service_registration_pt *registration);
 static celix_status_t serviceRegistration_destroy(service_registration_pt registration);
 
-service_registration_pt serviceRegistration_create(registry_callback_t callback, bundle_pt bundle, char * serviceName, long serviceId, void * serviceObject, properties_pt dictionary) {
+service_registration_pt serviceRegistration_create(registry_callback_t callback, bundle_pt bundle, const char* serviceName, unsigned long serviceId, const void * serviceObject, properties_pt dictionary) {
     service_registration_pt registration = NULL;
 	serviceRegistration_createInternal(callback, bundle, serviceName, serviceId, serviceObject, dictionary, false, &registration);
 	return registration;
 }
 
-service_registration_pt serviceRegistration_createServiceFactory(registry_callback_t callback, bundle_pt bundle, char * serviceName, long serviceId, void * serviceObject, properties_pt dictionary) {
+service_registration_pt serviceRegistration_createServiceFactory(registry_callback_t callback, bundle_pt bundle, const char* serviceName, unsigned long serviceId, const void * serviceObject, properties_pt dictionary) {
     service_registration_pt registration = NULL;
     serviceRegistration_createInternal(callback, bundle, serviceName, serviceId, serviceObject, dictionary, true, &registration);
     return registration;
 }
 
-static celix_status_t serviceRegistration_createInternal(registry_callback_t callback, bundle_pt bundle, char * serviceName, long serviceId,
-        void * serviceObject, properties_pt dictionary, bool isFactory, service_registration_pt *out) {
+static celix_status_t serviceRegistration_createInternal(registry_callback_t callback, bundle_pt bundle, const char* serviceName, unsigned long serviceId,
+        const void * serviceObject, properties_pt dictionary, bool isFactory, service_registration_pt *out) {
     celix_status_t status = CELIX_SUCCESS;
 
 	service_registration_pt  reg = calloc(1, sizeof(*reg));
@@ -58,12 +58,12 @@
         reg->services = NULL;
         reg->nrOfServices = 0;
 		reg->isServiceFactory = isFactory;
-		reg->className = strdup(serviceName);
+		reg->className = strndup(serviceName, 1024*10);
 		reg->bundle = bundle;
 		reg->refCount = 1;
 
 		reg->serviceId = serviceId;
-		reg->svcObj = serviceObject;
+	reg->svcObj = serviceObject;
 		if (isFactory) {
 			reg->serviceFactory = (service_factory_pt) reg->svcObj;
 		} else {
@@ -128,7 +128,7 @@
 	}
 
 
-	snprintf(sId, 32, "%ld", registration->serviceId);
+	snprintf(sId, 32, "%lu", registration->serviceId);
 	properties_set(dictionary, (char *) OSGI_FRAMEWORK_SERVICE_ID, sId);
 
 	if (properties_get(dictionary, (char *) OSGI_FRAMEWORK_OBJECTCLASS) == NULL) {
@@ -189,12 +189,15 @@
 	return status;
 }
 
-celix_status_t serviceRegistration_getService(service_registration_pt registration, bundle_pt bundle, void **service) {
+celix_status_t serviceRegistration_getService(service_registration_pt registration, bundle_pt bundle, const void** service) {
 	int status = CELIX_SUCCESS;
     celixThreadRwlock_readLock(&registration->lock);
     if (registration->isServiceFactory) {
-        service_factory_pt factory = registration->serviceFactory;
-        status = factory->getService(factory->handle, bundle, registration, service);
+        service_factory_pt factory = (void*) registration->serviceFactory;
+        /*NOTE the service argument of the service_factory should be const void**.
+          To ensure backwards compatability a cast is made instead.
+        */
+        status = factory->getService(factory->handle, bundle, registration, (void**) service);
     } else {
         (*service) = registration->svcObj;
     }
@@ -202,11 +205,14 @@
     return status;
 }
 
-celix_status_t serviceRegistration_ungetService(service_registration_pt registration, bundle_pt bundle, void **service) {
+celix_status_t serviceRegistration_ungetService(service_registration_pt registration, bundle_pt bundle, const void** service) {
     celixThreadRwlock_readLock(&registration->lock);
     if (registration->isServiceFactory) {
-        service_factory_pt factory = registration->serviceFactory;
-        factory->ungetService(factory->handle, bundle, registration, service);
+        service_factory_pt factory = (void*) registration->serviceFactory;
+        /*NOTE the service argument of the service_factory should be const void**.
+          To ensure backwards compatability a cast is made instead.
+        */
+        factory->ungetService(factory->handle, bundle, registration, (void**) service);
     }
     celixThreadRwlock_unlock(&registration->lock);
     return CELIX_SUCCESS;
@@ -249,7 +255,10 @@
 
 
 celix_status_t serviceRegistration_getBundle(service_registration_pt registration, bundle_pt *bundle) {
-	celix_status_t status = CELIX_SUCCESS;
+    celix_status_t status = CELIX_SUCCESS;
+    if (registration == NULL) {
+        return CELIX_ILLEGAL_ARGUMENT;
+    }
 
     if (registration != NULL && *bundle == NULL) {
         celixThreadRwlock_readLock(&registration->lock);
@@ -264,7 +273,7 @@
 	return status;
 }
 
-celix_status_t serviceRegistration_getServiceName(service_registration_pt registration, char **serviceName) {
+celix_status_t serviceRegistration_getServiceName(service_registration_pt registration, const char **serviceName) {
 	celix_status_t status = CELIX_SUCCESS;
 
     if (registration != NULL && *serviceName == NULL) {
diff --git a/framework/private/src/service_registry.c b/framework/private/src/service_registry.c
index ab9c324..8df355f 100644
--- a/framework/private/src/service_registry.c
+++ b/framework/private/src/service_registry.c
@@ -35,16 +35,16 @@
 #include "service_reference_private.h"
 #include "framework_private.h"
 
-#ifdef NDEBUG
-#define CHECK_DELETED_REFERENCES false
-#else
+#ifdef DEBUG
 #define CHECK_DELETED_REFERENCES true
+#else
+#define CHECK_DELETED_REFERENCES false
 #endif
 
-static celix_status_t serviceRegistry_registerServiceInternal(service_registry_pt registry, bundle_pt bundle, char * serviceName, void * serviceObject, properties_pt dictionary, bool isFactory, service_registration_pt *registration);
-static celix_status_t serviceRegistry_addHooks(service_registry_pt registry, char *serviceName, void *serviceObject, service_registration_pt registration);
+static celix_status_t serviceRegistry_registerServiceInternal(service_registry_pt registry, bundle_pt bundle, const char* serviceName, const void * serviceObject, properties_pt dictionary, bool isFactory, service_registration_pt *registration);
+static celix_status_t serviceRegistry_addHooks(service_registry_pt registry, const char* serviceName, const void *serviceObject, service_registration_pt registration);
 static celix_status_t serviceRegistry_removeHook(service_registry_pt registry, service_registration_pt registration);
-static void serviceRegistry_logWarningServiceReferenceUsageCount(service_registry_pt registry, size_t usageCount, size_t refCount);
+static void serviceRegistry_logWarningServiceReferenceUsageCount(service_registry_pt registry, bundle_pt bundle, service_reference_pt ref, size_t usageCount, size_t refCount);
 static void serviceRegistry_logWarningServiceRegistration(service_registry_pt registry, service_registration_pt reg);
 static celix_status_t serviceRegistry_checkReference(service_registry_pt registry, service_reference_pt ref,
                                                      reference_status_t *refStatus);
@@ -71,7 +71,7 @@
         reg->serviceChanged = serviceChanged;
 		reg->serviceRegistrations = hashMap_create(NULL, NULL, NULL, NULL);
 		reg->framework = framework;
-		reg->currentServiceId = 1l;
+		reg->currentServiceId = 1UL;
 		reg->serviceReferences = hashMap_create(NULL, NULL, NULL, NULL);
 
         reg->checkDeletedReferences = CHECK_DELETED_REFERENCES;
@@ -146,15 +146,15 @@
 	return status;
 }
 
-celix_status_t serviceRegistry_registerService(service_registry_pt registry, bundle_pt bundle, char * serviceName, void * serviceObject, properties_pt dictionary, service_registration_pt *registration) {
+celix_status_t serviceRegistry_registerService(service_registry_pt registry, bundle_pt bundle, const char* serviceName, const void* serviceObject, properties_pt dictionary, service_registration_pt *registration) {
     return serviceRegistry_registerServiceInternal(registry, bundle, serviceName, serviceObject, dictionary, false, registration);
 }
 
-celix_status_t serviceRegistry_registerServiceFactory(service_registry_pt registry, bundle_pt bundle, char * serviceName, service_factory_pt factory, properties_pt dictionary, service_registration_pt *registration) {
-    return serviceRegistry_registerServiceInternal(registry, bundle, serviceName, (void *) factory, dictionary, true, registration);
+celix_status_t serviceRegistry_registerServiceFactory(service_registry_pt registry, bundle_pt bundle, const char* serviceName, service_factory_pt factory, properties_pt dictionary, service_registration_pt *registration) {
+    return serviceRegistry_registerServiceInternal(registry, bundle, serviceName, (const void *) factory, dictionary, true, registration);
 }
 
-static celix_status_t serviceRegistry_registerServiceInternal(service_registry_pt registry, bundle_pt bundle, char * serviceName, void * serviceObject, properties_pt dictionary, bool isFactory, service_registration_pt *registration) {
+static celix_status_t serviceRegistry_registerServiceInternal(service_registry_pt registry, bundle_pt bundle, const char* serviceName, const void* serviceObject, properties_pt dictionary, bool isFactory, service_registration_pt *registration) {
 	array_list_pt regs;
 
 	if (isFactory) {
@@ -218,7 +218,7 @@
     while (hashMapIterator_hasNext(iter)) {
         hash_map_pt refsMap = hashMapIterator_nextValue(iter);
         service_reference_pt ref = refsMap != NULL ?
-                                   hashMap_get(refsMap, registration) : NULL;
+                                   hashMap_get(refsMap, (void*)registration->serviceId) : NULL;
         if (ref != NULL) {
             serviceReference_invalidate(ref);
         }
@@ -271,7 +271,7 @@
 }
 
 static void serviceRegistry_logWarningServiceRegistration(service_registry_pt registry __attribute__((unused)), service_registration_pt reg) {
-    char *servName = NULL;
+    const char *servName = NULL;
     serviceRegistration_getServiceName(reg, &servName);
     fw_log(logger, OSGI_FRAMEWORK_LOG_WARNING, "Dangling service registration for service %s. Look for missing serviceRegistration_unregister calls.", servName);
 }
@@ -302,7 +302,7 @@
         hashMap_put(registry->serviceReferences, owner, references);
 	}
 
-    ref = hashMap_get(references, registration);
+    ref = hashMap_get(references, (void*)registration->serviceId);
 
     if (ref == NULL) {
         status = serviceRegistration_getBundle(registration, &bundle);
@@ -310,7 +310,7 @@
             status = serviceReference_create(registry->callback, owner, registration, &ref);
         }
         if (status == CELIX_SUCCESS) {
-            hashMap_put(references, registration, ref);
+            hashMap_put(references, (void*)registration->serviceId, ref);
             hashMap_put(registry->deletedServiceReferences, ref, (void *)false);
         }
     } else {
@@ -356,7 +356,7 @@
 				if ((serviceName == NULL) && ((filter == NULL) || matchResult)) {
 					matched = true;
 				} else if (serviceName != NULL) {
-					char *className = NULL;
+					const char *className = NULL;
 					matchResult = false;
 					serviceRegistration_getServiceName(registration, &className);
 					if (filter != NULL) {
@@ -393,7 +393,10 @@
             }
             serviceRegistration_release(reg);
         }
-        arrayList_destroy(matchingRegistrations);
+    }
+
+    if(matchingRegistrations != NULL){
+    	arrayList_destroy(matchingRegistrations);
     }
 
     if (status == CELIX_SUCCESS) {
@@ -445,30 +448,30 @@
         if (destroyed) {
 
             if (count > 0) {
-                serviceRegistry_logWarningServiceReferenceUsageCount(registry, count, 0);
+                serviceRegistry_logWarningServiceReferenceUsageCount(registry, bundle, reference, count, 0);
             }
 
             hash_map_pt refsMap = hashMap_get(registry->serviceReferences, bundle);
 
-            service_registration_pt reg = NULL;
+            unsigned long refId = 0UL;
             service_reference_pt ref = NULL;
             hash_map_iterator_pt iter = hashMapIterator_create(refsMap);
             while (hashMapIterator_hasNext(iter)) {
                 hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
-                reg = hashMapEntry_getKey(entry); //note could be invalid e.g. freed
+                refId = (unsigned long)hashMapEntry_getKey(entry); //note could be invalid e.g. freed
                 ref = hashMapEntry_getValue(entry);
 
                 if (ref == reference) {
                     break;
                 } else {
                     ref = NULL;
-                    reg = NULL;
+                    refId = 0UL;
                 }
             }
             hashMapIterator_destroy(iter);
 
             if (ref != NULL) {
-                hashMap_remove(refsMap, reg);
+                hashMap_remove(refsMap, (void*)refId);
                 int size = hashMap_size(refsMap);
                 if (size == 0) {
                     hashMap_destroy(refsMap, false, false);
@@ -524,12 +527,34 @@
     return status;
 }
 
-static void serviceRegistry_logWarningServiceReferenceUsageCount(service_registry_pt registry __attribute__((unused)), size_t usageCount, size_t refCount) {
+static void serviceRegistry_logWarningServiceReferenceUsageCount(service_registry_pt registry __attribute__((unused)), bundle_pt bundle, service_reference_pt ref, size_t usageCount, size_t refCount) {
     if (usageCount > 0) {
-        fw_log(logger, OSGI_FRAMEWORK_LOG_WARNING, "Service Reference destroyed with usage count is %zu. Look for missing bundleContext_ungetService calls.", usageCount);
+        fw_log(logger, OSGI_FRAMEWORK_LOG_WARNING, "Service Reference destroyed with usage count is %zu, expected 0. Look for missing bundleContext_ungetService calls.", usageCount);
     }
     if (refCount > 0) {
-        fw_log(logger, OSGI_FRAMEWORK_LOG_WARNING, "Dangling service reference. Reference count is %zu.  Look for missing bundleContext_ungetServiceReference calls.", refCount);
+        fw_log(logger, OSGI_FRAMEWORK_LOG_WARNING, "Dangling service reference. Reference count is %zu, expected 1.  Look for missing bundleContext_ungetServiceReference calls.", refCount);
+    }
+
+    if(usageCount > 0 || refCount > 0) {
+        module_pt module_ptr = NULL;
+        bundle_getCurrentModule(bundle, &module_ptr);
+        const char* bundle_name = NULL;
+        module_getSymbolicName(module_ptr, &bundle_name);
+
+        const char* service_name = "unknown";
+        const char* bundle_provider_name = "unknown";
+        if (refCount > 0 && ref != NULL) {
+            serviceReference_getProperty(ref, OSGI_FRAMEWORK_OBJECTCLASS, &service_name);
+            service_registration_pt reg = NULL;
+            bundle_pt bundle = NULL;
+            module_pt mod = NULL;
+            serviceReference_getServiceRegistration(ref, &reg);
+            serviceRegistration_getBundle(reg, &bundle);
+            bundle_getCurrentModule(bundle, &mod);
+            module_getSymbolicName(mod, &bundle_provider_name);
+        }
+
+        fw_log(logger, OSGI_FRAMEWORK_LOG_WARNING, "Previous Dangling service reference warnings caused by bundle '%s', for service '%s', provided by bundle '%s'", bundle_name, service_name, bundle_provider_name);
     }
 }
 
@@ -549,8 +574,7 @@
 
             serviceReference_getUsageCount(ref, &usageCount);
             serviceReference_getReferenceCount(ref, &refCount);
-
-            serviceRegistry_logWarningServiceReferenceUsageCount(registry, usageCount, refCount);
+            serviceRegistry_logWarningServiceReferenceUsageCount(registry, bundle, ref, usageCount, refCount);
 
             while (usageCount > 0) {
                 serviceReference_decreaseUsage(ref, &usageCount);
@@ -598,11 +622,11 @@
 	return CELIX_SUCCESS;
 }
 
-celix_status_t serviceRegistry_getService(service_registry_pt registry, bundle_pt bundle, service_reference_pt reference, void **out) {
+celix_status_t serviceRegistry_getService(service_registry_pt registry, bundle_pt bundle, service_reference_pt reference, const void **out) {
 	celix_status_t status = CELIX_SUCCESS;
 	service_registration_pt registration = NULL;
     size_t count = 0;
-    void *service = NULL;
+    const void *service = NULL;
     reference_status_t refStatus;
 
 
@@ -619,7 +643,10 @@
                 serviceReference_setService(reference, service);
             }
 
-            serviceReference_getService(reference, out);
+            /* NOTE the out argument of sr_getService should be 'const void**'
+               To ensure backwards compatability a cast is made instead.
+            */
+            serviceReference_getService(reference, (void **)out);
         } else {
             *out = NULL; //invalid service registration
         }
@@ -635,7 +662,7 @@
 celix_status_t serviceRegistry_ungetService(service_registry_pt registry, bundle_pt bundle, service_reference_pt reference, bool *result) {
 	celix_status_t status = CELIX_SUCCESS;
     service_registration_pt reg = NULL;
-    void *service = NULL;
+    const void *service = NULL;
     size_t count = 0;
     celix_status_t subStatus = CELIX_SUCCESS;
     reference_status_t refStatus;
@@ -647,7 +674,10 @@
     if (refStatus == REF_ACTIVE) {
         subStatus = serviceReference_decreaseUsage(reference, &count);
         if (count == 0) {
-            serviceReference_getService(reference, &service);
+            /*NOTE the argument service of sr_getService should be 'const void**'
+              TO ensure backwards compatability a cast is made instead.
+              */
+            serviceReference_getService(reference, (void**)&service);
             serviceReference_getServiceRegistration(reference, &reg);
             if (reg != NULL) {
                 serviceRegistration_ungetService(reg, bundle, &service);
@@ -666,7 +696,7 @@
 	return status;
 }
 
-static celix_status_t serviceRegistry_addHooks(service_registry_pt registry, char *serviceName, void *serviceObject __attribute__((unused)), service_registration_pt registration) {
+static celix_status_t serviceRegistry_addHooks(service_registry_pt registry, const char* serviceName, const void* serviceObject __attribute__((unused)), service_registration_pt registration) {
 	celix_status_t status = CELIX_SUCCESS;
 
 	if (strcmp(OSGI_FRAMEWORK_LISTENER_HOOK_SERVICE_NAME, serviceName) == 0) {
@@ -680,7 +710,7 @@
 
 static celix_status_t serviceRegistry_removeHook(service_registry_pt registry, service_registration_pt registration) {
 	celix_status_t status = CELIX_SUCCESS;
-	char *serviceName = NULL;
+	const char* serviceName = NULL;
 
 	properties_pt props = NULL;
 	serviceRegistration_getProperties(registration, &props);
@@ -748,7 +778,7 @@
             hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
             bundle_pt registrationUser = hashMapEntry_getKey(entry);
             hash_map_pt regMap = hashMapEntry_getValue(entry);
-            if (hashMap_containsKey(regMap, registration)) {
+            if (hashMap_containsKey(regMap, (void*)registration->serviceId)) {
                 arrayList_add(bundles, registrationUser);
             }
         }
diff --git a/framework/private/src/service_tracker.c b/framework/private/src/service_tracker.c
index 546ee5d..d43b362 100644
--- a/framework/private/src/service_tracker.c
+++ b/framework/private/src/service_tracker.c
@@ -46,7 +46,7 @@
 static celix_status_t serviceTracker_invokeRemovingService(service_tracker_pt tracker, service_reference_pt ref,
                                                            void *service);
 
-celix_status_t serviceTracker_create(bundle_context_pt context, char * service, service_tracker_customizer_pt customizer, service_tracker_pt *tracker) {
+celix_status_t serviceTracker_create(bundle_context_pt context, const char * service, service_tracker_customizer_pt customizer, service_tracker_pt *tracker) {
 	celix_status_t status = CELIX_SUCCESS;
 
 	if (service == NULL || *tracker != NULL) {
@@ -64,7 +64,7 @@
 	return status;
 }
 
-celix_status_t serviceTracker_createWithFilter(bundle_context_pt context, char * filter, service_tracker_customizer_pt customizer, service_tracker_pt *tracker) {
+celix_status_t serviceTracker_createWithFilter(bundle_context_pt context, const char * filter, service_tracker_customizer_pt customizer, service_tracker_pt *tracker) {
 	celix_status_t status = CELIX_SUCCESS;
 
 	*tracker = (service_tracker_pt) malloc(sizeof(**tracker));
@@ -118,8 +118,8 @@
 	celix_status_t status = CELIX_SUCCESS;
 	listener = (service_listener_pt) malloc(sizeof(*listener));
 	
-	status = bundleContext_getServiceReferences(tracker->context, NULL, tracker->filter, &initial);
-	if (status == CELIX_SUCCESS) {
+	status = bundleContext_getServiceReferences(tracker->context, NULL, tracker->filter, &initial); //REF COUNT to 1
+	if (status == CELIX_SUCCESS && listener != NULL) {
 		service_reference_pt initial_reference;
 		unsigned int i;
 
@@ -131,15 +131,20 @@
 
 			for (i = 0; i < arrayList_size(initial); i++) {
 				initial_reference = (service_reference_pt) arrayList_get(initial, i);
-				serviceTracker_track(tracker, initial_reference, NULL);
+				serviceTracker_track(tracker, initial_reference, NULL); //REF COUNT to 2
+                bundleContext_ungetServiceReference(tracker->context, initial_reference); //REF COUNT to 1
 			}
-			arrayList_clear(initial);
+
 			arrayList_destroy(initial);
 
 			initial = NULL;
 		}
 	}
 
+	if(status != CELIX_SUCCESS && listener != NULL){
+		free(listener);
+	}
+
 	framework_logIfError(logger, status, NULL, "Cannot open tracker");
 
 	return status;
@@ -403,8 +408,8 @@
 
     if (found && tracked != NULL) {
         serviceTracker_invokeRemovingService(tracker, tracked->reference, tracked->service);
-        free(tracked);
         bundleContext_ungetServiceReference(tracker->context, reference);
+        free(tracked);
     }
    
     framework_logIfError(logger, status, NULL, "Cannot untrack reference");
diff --git a/framework/private/src/unzip.c b/framework/private/src/unzip.c
index e80113d..d8a6716 100644
--- a/framework/private/src/unzip.c
+++ b/framework/private/src/unzip.c
@@ -603,6 +603,7 @@
     if (unz_copyright[0]!=' ')
         return NULL;
 
+    memset(&us,0,sizeof(unz64_s));
     us.z_filefunc.zseek32_file = NULL;
     us.z_filefunc.ztell32_file = NULL;
     if (pzlib_filefunc64_32_def==NULL)
@@ -750,6 +751,7 @@
     us.central_pos = central_pos;
     us.pfile_in_zip_read = NULL;
     us.encrypted = 0;
+    us.num_file = 0;
 
 
     s=(unz64_s*)ALLOC(sizeof(unz64_s));
@@ -784,6 +786,7 @@
         zlib_filefunc64_32_def_fill.zfile_func64 = *pzlib_filefunc_def;
         zlib_filefunc64_32_def_fill.ztell32_file = NULL;
         zlib_filefunc64_32_def_fill.zseek32_file = NULL;
+        zlib_filefunc64_32_def_fill.zopen32_file = NULL;
         return unzOpenInternal(path, &zlib_filefunc64_32_def_fill, 1);
     }
     else
diff --git a/framework/private/src/utils.c b/framework/private/src/utils.c
index fdb0f62..9fc5335 100644
--- a/framework/private/src/utils.c
+++ b/framework/private/src/utils.c
@@ -28,8 +28,8 @@
 
 #include "utils.h"
 
-unsigned int utils_stringHash(void * strPtr) {
-    char * string = strPtr;
+unsigned int utils_stringHash(const void* strPtr) {
+    const char* string = strPtr;
     unsigned int hash = 5381;
     unsigned int i = 0;
     unsigned int len = strlen(string);
@@ -40,8 +40,8 @@
     return hash;
 }
 
-int utils_stringEquals(void * string, void * toCompare) {
-	return strcmp((char *)string, (char *) toCompare) == 0;
+int utils_stringEquals(const void* string, const void* toCompare) {
+	return strcmp((const char*)string, (const char*)toCompare) == 0;
 }
 
 char * string_ndup(const char *s, size_t n) {
@@ -59,7 +59,7 @@
 }
 
 char * utils_stringTrim(char * string) {
-	char * copy = string;
+	char* copy = string;
 
 	char *end;
 	// Trim leading space
@@ -70,13 +70,21 @@
 	// Trim trailing space
 	end = copy + strlen(copy) - 1;
 	while(end > copy && isspace(*end)) {
-		*(end) = 0;
+		*(end) = '\0';
 		end--;
 	}
 
+	if (copy != string) { 
+		//beginning whitespaces -> move char in copy to to begin string
+		//This to ensure free still works on the same pointer.
+		char* nstring = string;
+		while(*copy != '\0') {
+			*(nstring++) = *(copy++);
+		}
+		(*nstring) = '\0';
+	}
 
-
-	return copy;
+	return string;
 }
 
 bool utils_isStringEmptyOrNull(const char * const str) {
@@ -105,7 +113,7 @@
 	return status;
 }
 
-celix_status_t utils_isNumeric(char *number, bool *ret) {
+celix_status_t utils_isNumeric(const char *number, bool *ret) {
 	celix_status_t status = CELIX_SUCCESS;
 	*ret = true;
 	while(*number) {
@@ -119,7 +127,7 @@
 }
 
 
-FRAMEWORK_EXPORT int utils_compareServiceIdsAndRanking(long servId, long servRank, long otherServId, long otherServRank) {
+FRAMEWORK_EXPORT int utils_compareServiceIdsAndRanking(unsigned long servId, long servRank, unsigned long otherServId, long otherServRank) {
 	int result;
 
 	if (servId == otherServId) {
diff --git a/framework/private/test/bundle_cache_test.cpp b/framework/private/test/bundle_cache_test.cpp
index 1d543d0..13e0e80 100644
--- a/framework/private/test/bundle_cache_test.cpp
+++ b/framework/private/test/bundle_cache_test.cpp
@@ -76,11 +76,19 @@
 	char cacheFile[] = "bundle_cache_test_directory/tempXXXXXX";
 	cache->cacheDir = cacheDir;
 
-	mkdir(cacheDir, S_IRWXU);
-	mkdir(cacheDir2, S_IRWXU);
-	//mkstemp opens the file for safety, but bundlecache_delete needs to reopen the file
-	close(mkstemp(cacheFile));
+	int rv = 0;
+	rv += mkdir(cacheDir, S_IRWXU);
+	rv += mkdir(cacheDir2, S_IRWXU);
 
+	/* Check previous mkdir calls were fine*/
+	LONGS_EQUAL(rv,0);
+
+	//mkstemp opens the file for safety, but bundlecache_delete needs to reopen the file
+	umask(0033);
+	int fd = mkstemp(cacheFile);
+	if(fd>=0){
+		close(fd);
+	}
 
 	LONGS_EQUAL(CELIX_SUCCESS, bundleCache_delete(cache));
 
@@ -94,9 +102,13 @@
 
 	char bundle0[] = "bundle_cache_test_directory/bundle0";
 	char bundle1[] = "bundle_cache_test_directory/bundle1";
-	mkdir(cacheDir, S_IRWXU);
-	mkdir(bundle0, S_IRWXU);
-	mkdir(bundle1, S_IRWXU);
+	int rv = 0;
+	rv += mkdir(cacheDir, S_IRWXU);
+	rv += mkdir(bundle0, S_IRWXU);
+	rv += mkdir(bundle1, S_IRWXU);
+
+	/* Check previous mkdir calls were fine*/
+	LONGS_EQUAL(rv,0);
 
 	bundle_archive_pt archive = (bundle_archive_pt) 0x10;
 	mock().expectOneCall("bundleArchive_recreate")
diff --git a/framework/private/test/bundle_context_test.cpp b/framework/private/test/bundle_context_test.cpp
index a83bdfb..0379da6 100644
--- a/framework/private/test/bundle_context_test.cpp
+++ b/framework/private/test/bundle_context_test.cpp
@@ -606,10 +606,11 @@
 	mock().expectOneCall("fw_getProperty")
 		.withParameter("framework", framework)
 		.withParameter("name", name)
+		.withStringParameter("defaultValue", NULL)
 		.withOutputParameterReturning("value", &value, sizeof(value))
 		.andReturnValue(CELIX_SUCCESS);
 
-	char *actualValue = NULL;
+	const char *actualValue = NULL;
 	celix_status_t status = bundleContext_getProperty(context, name, &actualValue);
 	LONGS_EQUAL(CELIX_SUCCESS, status);
 	STRCMP_EQUAL(value, actualValue);
diff --git a/framework/private/test/bundle_revision_test.cpp b/framework/private/test/bundle_revision_test.cpp
index c9fb567..5e9320d 100644
--- a/framework/private/test/bundle_revision_test.cpp
+++ b/framework/private/test/bundle_revision_test.cpp
@@ -121,8 +121,8 @@
 	revision->manifest = expectedManifest;
 	revision->libraryHandles = handles;
 
-	char *actualRoot = NULL;
-	char *actualLocation = NULL;
+	const char *actualRoot = NULL;
+	const char *actualLocation = NULL;
 	long actualRevisionNr = 0l;
 	manifest_pt actualManifest = NULL;
 	array_list_pt actualHandles = NULL;
diff --git a/framework/private/test/bundle_test.cpp b/framework/private/test/bundle_test.cpp
index af23dbc..57ac1e2 100644
--- a/framework/private/test/bundle_test.cpp
+++ b/framework/private/test/bundle_test.cpp
@@ -321,6 +321,7 @@
 	LONGS_EQUAL(CELIX_SUCCESS, status);
 	POINTERS_EQUAL(expected, actual);
 
+    //free(actual);
 	free(bundle);
 }
 
@@ -634,7 +635,7 @@
 	bundle_pt bundle = (bundle_pt) malloc(sizeof(*bundle));
 	arrayList_create(&bundle->modules);
 	bundle_archive_pt actual_archive = (bundle_archive_pt) 0x02;
-	bundle_revision_pt actual_revision = (bundle_revision_pt) malloc(sizeof(actual_revision));
+	bundle_revision_pt actual_revision = (bundle_revision_pt) malloc(sizeof(*actual_revision));
 	manifest_pt actual_manifest = (manifest_pt) malloc(sizeof(*actual_manifest));
 	int actual_id = 666;
 	const char * actual_module_id = "666.0";
diff --git a/framework/private/test/capability_test.cpp b/framework/private/test/capability_test.cpp
index b3bd61f..f948ac3 100644
--- a/framework/private/test/capability_test.cpp
+++ b/framework/private/test/capability_test.cpp
@@ -130,7 +130,7 @@
 	char serviceName[] = "service";
 	capability->serviceName = serviceName;
 
-	char *actual = NULL;
+	const char *actual = NULL;
 	capability_getServiceName(capability, &actual);
 	STRCMP_EQUAL(serviceName, actual);
 
diff --git a/framework/private/test/filter_test.cpp b/framework/private/test/filter_test.cpp
index bf07fc6..c9b1ca5 100644
--- a/framework/private/test/filter_test.cpp
+++ b/framework/private/test/filter_test.cpp
@@ -544,7 +544,7 @@
 	char * filter_str = my_strdup("(&(test_attr1=attr1)(|(test_attr2=attr2)(test_attr3=attr3)))");
 	filter_pt filter = filter_create(filter_str);
 
-	char * get_str;
+	const char * get_str;
 	filter_getString(filter, &get_str);
 
 	//cleanup
diff --git a/framework/private/test/manifest_parser_test.cpp b/framework/private/test/manifest_parser_test.cpp
index 598b95a..d3fdbbf 100644
--- a/framework/private/test/manifest_parser_test.cpp
+++ b/framework/private/test/manifest_parser_test.cpp
@@ -151,7 +151,7 @@
 	version_pt get_version;
 	linked_list_pt get_caps;
 	linked_list_pt get_reqs;
-	char * get_bundle_name;
+	char* get_bundle_name;
 	celix_status_t status;
 
 	mock().expectOneCall("version_clone")
@@ -199,7 +199,7 @@
 	}
 
 
-	status = manifestParser_getSymbolicName(parser, &get_bundle_name);
+	status = manifestParser_getAndDuplicateSymbolicName(parser, &get_bundle_name);
 	LONGS_EQUAL(CELIX_SUCCESS, status);
 	STRCMP_EQUAL(bundle_name, get_bundle_name);
 
diff --git a/framework/private/test/manifest_test.cpp b/framework/private/test/manifest_test.cpp
index 7753c76..5138fa5 100644
--- a/framework/private/test/manifest_test.cpp
+++ b/framework/private/test/manifest_test.cpp
@@ -192,7 +192,7 @@
     properties_pt main = manifest_getMainAttributes(manifest);
     POINTERS_EQUAL(properties, main);
 
-    char *name = manifest_getValue(manifest, "Bundle-SymbolicName");
+    const char *name = manifest_getValue(manifest, "Bundle-SymbolicName");
     STRCMP_EQUAL("bsn", name);
 
     hash_map_pt map = NULL;
diff --git a/framework/private/test/properties_test.cpp b/framework/private/test/properties_test.cpp
index eaed3a3..3124fe7 100644
--- a/framework/private/test/properties_test.cpp
+++ b/framework/private/test/properties_test.cpp
@@ -63,10 +63,10 @@
 	properties = properties_load(propertiesFile);
 	LONGS_EQUAL(3, hashMap_size(properties));
 
-	char keyA[] = "a";
-	char *valueA = properties_get(properties, keyA);
+	const char keyA[] = "a";
+	const char *valueA = properties_get(properties, keyA);
 	STRCMP_EQUAL("b", valueA);
-	char keyB[] = "b";
+	const char keyB[] = "b";
 	STRCMP_EQUAL("c", properties_get(properties, keyB));
 
 	properties_destroy(properties);
@@ -95,9 +95,9 @@
 	properties_copy(properties, &copy);
 
 	char keyA[] = "a";
-	char *valueA = properties_get(copy, keyA);
+	const char *valueA = properties_get(copy, keyA);
 	STRCMP_EQUAL("b", valueA);
-	char keyB[] = "b";
+	const char keyB[] = "b";
 	STRCMP_EQUAL("c", properties_get(copy, keyB));
 
 	properties_destroy(properties);
diff --git a/framework/private/test/requirement_test.cpp b/framework/private/test/requirement_test.cpp
index ce25dca..d04bf2f 100644
--- a/framework/private/test/requirement_test.cpp
+++ b/framework/private/test/requirement_test.cpp
@@ -146,7 +146,7 @@
 	char targetName[] = "target";
 	requirement->targetName = targetName;
 
-	char *actual = NULL;
+	const char *actual = NULL;
 	requirement_getTargetName(requirement, &actual);
 	STRCMP_EQUAL(targetName, actual);
 
diff --git a/framework/private/test/service_reference_test.cpp b/framework/private/test/service_reference_test.cpp
index 25165cc..0d49f18 100644
--- a/framework/private/test/service_reference_test.cpp
+++ b/framework/private/test/service_reference_test.cpp
@@ -326,7 +326,7 @@
 	properties_pt props = (properties_pt) 0x20;
 	char * key = my_strdup("key");
 	char * value = my_strdup("value");
-	char * get_value = (char*) NULL;
+	const char * get_value = (char*) NULL;
 
 	//test getting a property
 	mock().expectOneCall("serviceRegistration_getProperties")
@@ -718,6 +718,7 @@
 	reference->registration = registration;
 	service_registry_pt registry = (service_registry_pt) 0x20;
 	registry_callback_t callback;
+	memset(&callback,0,sizeof(registry_callback_t));
 	callback.getUsingBundles = serviceReferenceTest_getUsingBundles;
 	callback.handle = registry;
 	reference->callback = callback;
diff --git a/framework/private/test/service_registration_test.cpp b/framework/private/test/service_registration_test.cpp
index b388de3..4f37c2f 100644
--- a/framework/private/test/service_registration_test.cpp
+++ b/framework/private/test/service_registration_test.cpp
@@ -100,7 +100,7 @@
 	callback.handle = registry;
 	char * name = my_strdup("sevice_name");
 	bundle_pt bundle = (bundle_pt) 0x20;
-	long serviceId = 1l;
+	unsigned long serviceId = 1UL;
 	void *service = (void *) 0x30;
 
 	service_registration_pt registration = serviceRegistration_create(callback, bundle, name, serviceId, service, NULL);
@@ -108,14 +108,15 @@
 	STRCMP_EQUAL(name, registration->className);
 	POINTERS_EQUAL(bundle, registration->bundle);
 	POINTERS_EQUAL(service, registration->svcObj);
-	LONGS_EQUAL(serviceId, registration->serviceId);
+	UNSIGNED_LONGS_EQUAL(serviceId, registration->serviceId);
+
 	LONGS_EQUAL(0, registration->isUnregistering);
 	LONGS_EQUAL(0, registration->isServiceFactory);
 	POINTERS_EQUAL(NULL, registration->serviceFactory);
 	POINTERS_EQUAL(NULL, registration->services);
 	LONGS_EQUAL(0, registration->nrOfServices);
 
-	char* get;
+	const char* get;
 	get = properties_get(registration->properties, (char*)"service.id");
 	STRCMP_EQUAL("1", get);
 
@@ -132,7 +133,7 @@
 	callback.handle = registry;
 	char * name = my_strdup("sevice_name");
 	bundle_pt bundle = (bundle_pt) 0x20;
-	long serviceId = 1l;
+	unsigned long serviceId = 1UL;
 	void *service = (void *) 0x30;
 
 	service_registration_pt registration = serviceRegistration_createServiceFactory(callback, bundle, name, serviceId, service, NULL);
@@ -140,14 +141,14 @@
 	STRCMP_EQUAL(name, registration->className);
 	POINTERS_EQUAL(bundle, registration->bundle);
 	POINTERS_EQUAL(service, registration->svcObj);
-	LONGS_EQUAL(serviceId, registration->serviceId);
+	UNSIGNED_LONGS_EQUAL(serviceId, registration->serviceId);
 	LONGS_EQUAL(0, registration->isUnregistering);
 	LONGS_EQUAL(1, registration->isServiceFactory);
 	POINTERS_EQUAL(service, registration->serviceFactory);
 	POINTERS_EQUAL(NULL, registration->services);
 	LONGS_EQUAL(0, registration->nrOfServices);
 
-	char* get;
+	const char* get;
 	get = properties_get(registration->properties, (char*)"service.id");
 	STRCMP_EQUAL("1", get);
 
@@ -264,7 +265,7 @@
 	void *service = (void *) 0x20;
 	service_registration_pt registration = serviceRegistration_create(callback, bundle, name, 0, service, NULL);
 
-	void *actual = NULL;
+	const void *actual = NULL;
 	celix_status_t status = serviceRegistration_getService(registration, bundle, &actual);
 	LONGS_EQUAL(CELIX_SUCCESS, status);
 	POINTERS_EQUAL(service, actual);
@@ -289,7 +290,7 @@
 			.withParameter("registration", registration)
 			.withOutputParameterReturning("service", &service, sizeof(service));
 
-	void *actual = NULL;
+	const void *actual = NULL;
 	celix_status_t status = serviceRegistration_getService(registration, bundle, &actual);
 	LONGS_EQUAL(CELIX_SUCCESS, status);
 	POINTERS_EQUAL(service, actual);
@@ -316,7 +317,7 @@
 			.withParameter("registration", registration)
 			.withOutputParameterReturning("service", &service, sizeof(service));
 
-	void *actual = NULL;
+	const void *actual = NULL;
 	celix_status_t status = serviceRegistration_ungetService(registration, bundle, &actual);
 	LONGS_EQUAL(CELIX_SUCCESS, status);
 	POINTERS_EQUAL(service, actual);
@@ -336,7 +337,7 @@
 	celix_status_t status = serviceRegistration_getProperties(registration, &actual);
 	LONGS_EQUAL(CELIX_SUCCESS, status);
 
-	char* get;
+	const char* get;
 	get = properties_get(registration->properties, (char*)"service.id");
 	STRCMP_EQUAL("5", get);
 
@@ -400,7 +401,7 @@
 	char * name = my_strdup("sevice_name");
 	service_registration_pt registration = serviceRegistration_create(callback, NULL, name, 0, NULL, NULL);
 
-	char *actual = NULL;
+	const char *actual = NULL;
 	celix_status_t status = serviceRegistration_getServiceName(registration, &actual);
 	LONGS_EQUAL(CELIX_SUCCESS, status);
 	STRCMP_EQUAL(name, actual);
@@ -413,7 +414,7 @@
 	registry_callback_t callback;
 	char * name = my_strdup("sevice_name");
 	service_registration_pt registration = serviceRegistration_create(callback, NULL, name, 0, NULL, NULL);
-	char *actual = (char *) 0x01;
+	const char *actual = (char *) 0x01;
 
 	mock().expectOneCall("framework_logCode")
 			.withParameter("code", CELIX_ILLEGAL_ARGUMENT);
diff --git a/framework/private/test/service_registry_test.cpp b/framework/private/test/service_registry_test.cpp
index 7db6476..87e7998 100644
--- a/framework/private/test/service_registry_test.cpp
+++ b/framework/private/test/service_registry_test.cpp
@@ -38,6 +38,7 @@
 #include "listener_hook_service.h"
 #include "service_registry.h"
 #include "service_registry_private.h"
+#include "service_registration_private.h"
 #include "celix_log.h"
 
 framework_logger_pt logger = (framework_logger_pt) 0x42;
@@ -112,7 +113,7 @@
 
 	POINTERS_EQUAL(framework, registry->framework);
 	POINTERS_EQUAL(serviceRegistryTest_serviceChanged, registry->serviceChanged);
-	LONGS_EQUAL(1l, registry->currentServiceId);
+	UNSIGNED_LONGS_EQUAL(1UL, registry->currentServiceId);
 	CHECK(registry->listenerHooks != NULL);
 	CHECK(registry->serviceReferences != NULL);
 	CHECK(registry->serviceRegistrations != NULL);
@@ -126,14 +127,15 @@
 	serviceRegistry_create(framework,serviceRegistryTest_serviceChanged, &registry);
 	array_list_pt registrations = NULL;
 	arrayList_create(&registrations);
-	service_registration_pt reg = (service_registration_pt) 0x10;
+	service_registration_pt reg = (service_registration_pt) calloc(1,sizeof(struct serviceRegistration));
+	reg->serviceId = 10UL;
 	arrayList_add(registrations, reg);
 	bundle_pt bundle = (bundle_pt) 0x20;
 	hashMap_put(registry->serviceRegistrations, bundle, registrations);
 
 	hash_map_pt usages = hashMap_create(NULL, NULL, NULL, NULL);
 	service_reference_pt ref = (service_reference_pt) 0x30;
-	hashMap_put(usages, reg, ref);
+	hashMap_put(usages, (void*)reg->serviceId, ref);
 	hashMap_put(registry->serviceReferences, bundle, usages);
 
 	mock()
@@ -153,6 +155,7 @@
 	arrayList_destroy(registrations);
 	hashMap_remove(registry->serviceRegistrations, bundle);
 	serviceRegistry_destroy(registry);
+	free(reg);
 	hashMap_destroy(usages, false, false);
 }
 
@@ -297,7 +300,8 @@
 	framework_pt framework = (framework_pt) 0x01;
 	serviceRegistry_create(framework,serviceRegistryTest_serviceChanged, &registry);
 	bundle_pt bundle = (bundle_pt) 0x10;
-	service_registration_pt registration = (service_registration_pt) 0x20;
+	service_registration_pt registration = (service_registration_pt) calloc(1,sizeof(struct serviceRegistration));
+	registration->serviceId = 20UL;
 
 	array_list_pt registrations = NULL;
 	arrayList_create(&registrations);
@@ -306,7 +310,7 @@
 	service_reference_pt reference = (service_reference_pt) 0x30;
 	hash_map_pt references = hashMap_create(NULL, NULL, NULL, NULL);
 
-	hashMap_put(references, registration, reference);
+	hashMap_put(references, (void*)registration->serviceId, reference);
 	hashMap_put(registry->serviceReferences, bundle, references);
 	properties_pt properties = (properties_pt) 0x40;
 
@@ -343,6 +347,7 @@
 
 	serviceRegistry_unregisterService(registry, bundle, registration);
 	hashMap_destroy(references, false,false);
+	free(registration);
 	serviceRegistry_destroy(registry);
 }
 
@@ -408,11 +413,12 @@
 	serviceRegistry_create(framework,serviceRegistryTest_serviceChanged, &registry);
 
 	bundle_pt bundle = (bundle_pt) 0x10;
-	service_registration_pt registration = (service_registration_pt) 0x20;
+	service_registration_pt registration = (service_registration_pt) calloc(1,sizeof(struct serviceRegistration));
+	registration->serviceId = 20UL;
 	service_reference_pt reference = (service_reference_pt) 0x50;
 
 	hash_map_pt references = hashMap_create(NULL, NULL, NULL, NULL);
-	hashMap_put(references, registration, reference);
+	hashMap_put(references, (void*)registration->serviceId, reference);
 	hashMap_put(registry->serviceReferences, bundle, references);
 
 	mock().expectOneCall("serviceReference_retain")
@@ -424,6 +430,7 @@
 	POINTERS_EQUAL(reference, get_reference);
 
 	hashMap_destroy(references, false, false);
+	free(registration);
 	serviceRegistry_destroy(registry);
 }
 
@@ -433,7 +440,8 @@
 	serviceRegistry_create(framework,serviceRegistryTest_serviceChanged, &registry);
 
 	bundle_pt bundle = (bundle_pt) 0x10;
-	service_registration_pt registration = (service_registration_pt) 0x20;
+	service_registration_pt registration = (service_registration_pt) calloc(1,sizeof(struct serviceRegistration));
+	registration->serviceId = 20UL;
 	service_reference_pt reference = (service_reference_pt) 0x50;
 
 	//test getting ref from bundle without refs
@@ -456,6 +464,7 @@
 	//cleanup
 	hash_map_pt del = (hash_map_pt) hashMap_remove(registry->serviceReferences, bundle);
 	hashMap_destroy(del, false, false);
+	free(registration);
 	serviceRegistry_destroy(registry);
 }
 
@@ -465,7 +474,9 @@
 	serviceRegistry_create(framework,serviceRegistryTest_serviceChanged, &registry);
 
 	bundle_pt bundle = (bundle_pt) 0x10;
-	service_registration_pt registration = (service_registration_pt) 0x20;
+	service_registration_pt registration = (service_registration_pt) calloc(1,sizeof(struct serviceRegistration));
+	registration->serviceId = 20UL;
+
 	array_list_pt registrations = NULL;
 	arrayList_create(&registrations);
 	arrayList_add(registrations, registration);
@@ -476,7 +487,7 @@
 
 	hash_map_pt references = hashMap_create(NULL, NULL, NULL, NULL);
 	service_reference_pt reference = (service_reference_pt) 0x50;
-	hashMap_put(references, registration, reference);
+	hashMap_put(references, (void*)registration->serviceId, reference);
 	hashMap_put(registry->serviceReferences, bundle, references);
 
 	mock()
@@ -522,6 +533,7 @@
 	arrayList_destroy(actual);
 	arrayList_destroy(registrations);
 	hashMap_remove(registry->serviceRegistrations, bundle);
+	free(registration);
 	serviceRegistry_destroy(registry);
 }
 
@@ -531,7 +543,9 @@
 	serviceRegistry_create(framework,serviceRegistryTest_serviceChanged, &registry);
 
 	bundle_pt bundle = (bundle_pt) 0x10;
-	service_registration_pt registration = (service_registration_pt) 0x20;
+	service_registration_pt registration = (service_registration_pt) calloc(1,sizeof(struct serviceRegistration));
+	registration->serviceId = 20UL;
+
 	array_list_pt registrations = NULL;
 	arrayList_create(&registrations);
 	arrayList_add(registrations, registration);
@@ -541,7 +555,7 @@
 
 	hash_map_pt references = hashMap_create(NULL, NULL, NULL, NULL);
 	service_reference_pt reference = (service_reference_pt) 0x50;
-	hashMap_put(references, registration, reference);
+	hashMap_put(references, (void*)registration->serviceId, reference);
 	hashMap_put(registry->serviceReferences, bundle, references);
 
 	mock()
@@ -576,6 +590,7 @@
 	arrayList_destroy(actual);
 	arrayList_destroy(registrations);
 	hashMap_remove(registry->serviceRegistrations, bundle);
+	free(registration);
 	serviceRegistry_destroy(registry);
 }
 
@@ -632,6 +647,7 @@
 	service_reference_pt reference3 = (service_reference_pt) 0x60;
 	bundle_pt bundle = (bundle_pt) 0x70;
 	bundle_pt bundle2 = (bundle_pt) 0x80;
+    module_pt module = (module_pt) 0x90;
 
 	hash_map_pt references = hashMap_create(NULL, NULL, NULL, NULL);
 	hashMap_put(references, registration, reference);
@@ -677,13 +693,21 @@
 	destroyed = true;
 	count = 5;
 
+    const char* mod_name = "mod name";
+    const char* srv_name = "srv name";
 	mock().expectOneCall("serviceReference_getUsageCount")
 			.withParameter("reference", reference)
 			.withOutputParameterReturning("count", &count, sizeof(count));
 	mock().expectOneCall("serviceReference_release")
 			.withParameter("ref", reference)
 			.withOutputParameterReturning("destroyed", &destroyed, sizeof(destroyed));
-	mock().expectOneCall("framework_log");
+    mock().expectNCalls(1, "bundle_getCurrentModule")
+            .withParameter("bundle", bundle)
+			.withOutputParameterReturning("module", &module, sizeof(module));
+    mock().expectNCalls(1, "module_getSymbolicName")
+            .withParameter("module", module)
+			.withOutputParameterReturning("symbolicName", &mod_name, sizeof(mod_name));
+	mock().expectNCalls(2, "framework_log");
 
 	serviceRegistry_ungetServiceReference(registry, bundle, reference);
 
@@ -717,27 +741,25 @@
 	serviceRegistry_destroy(registry);
 }
 
-TEST(service_registry, clearReferencesFor){
+TEST(service_registry, clearReferencesFor_1){
 	service_registry_pt registry = NULL;
 	framework_pt framework = (framework_pt) 0x01;
 	serviceRegistry_create(framework,serviceRegistryTest_serviceChanged, &registry);
 
 	service_registration_pt registration = (service_registration_pt) 0x10;
-	service_registration_pt registration2 = (service_registration_pt) 0x20;
 	service_reference_pt reference = (service_reference_pt) 0x40;
-	service_reference_pt reference2 = (service_reference_pt) 0x50;
 	bundle_pt bundle = (bundle_pt) 0x70;
+	module_pt module = (module_pt) 0x80;
+	const char* modName = "mod name";
 
 	hash_map_pt references = hashMap_create(NULL, NULL, NULL, NULL);
 	hashMap_put(references, registration, reference);
-	hashMap_put(references, registration2, reference2);
 	hashMap_put(registry->serviceReferences, bundle, references);
 
 	size_t useCount = 0;
 	size_t refCount = 0;
 	bool destroyed = true;
 	hashMap_put(registry->deletedServiceReferences, reference, (void*) false);
-	hashMap_put(registry->deletedServiceReferences, reference2, (void*) false);
 
 	//expected calls for removing reference1
 	mock().expectOneCall("serviceReference_getUsageCount")
@@ -750,23 +772,62 @@
 			.withParameter("ref", reference)
 			.withOutputParameterReturning("destroyed", &destroyed, sizeof(destroyed));
 
+	serviceRegistry_clearReferencesFor(registry, bundle);
+
+	serviceRegistry_destroy(registry);
+}
+
+TEST(service_registry, clearReferencesFor_2){
+	service_registry_pt registry = NULL;
+	framework_pt framework = (framework_pt) 0x01;
+	serviceRegistry_create(framework,serviceRegistryTest_serviceChanged, &registry);
+
+	service_registration_pt registration = (service_registration_pt) 0x10;
+	service_reference_pt reference = (service_reference_pt) 0x40;
+	bundle_pt bundle = (bundle_pt) 0x70;
+	module_pt module = (module_pt) 0x80;
+	const char* modName = "mod name";
+    const char* srvName = "srv name";
+
+	hash_map_pt references = hashMap_create(NULL, NULL, NULL, NULL);
+	hashMap_put(references, registration, reference);
+	hashMap_put(registry->serviceReferences, bundle, references);
+
 	//expected calls for removing reference2 (including count error logging)
-	size_t useCount2 = 1;
-	size_t refCount2 = 1;
+	size_t useCount = 1;
+	size_t refCount = 1;
+    bool destroyed = true;
 	mock().expectOneCall("serviceReference_getUsageCount")
-			.withParameter("reference", reference2)
-			.withOutputParameterReturning("count", &useCount2, sizeof(useCount2));
+			.withParameter("reference", reference)
+			.withOutputParameterReturning("count", &useCount, sizeof(useCount));
 	mock().expectOneCall("serviceReference_getReferenceCount")
-			.withParameter("reference", reference2)
-			.withOutputParameterReturning("count", &refCount2, sizeof(refCount2));
+			.withParameter("reference", reference)
+			.withOutputParameterReturning("count", &refCount, sizeof(refCount));
 	mock().expectNCalls(2, "framework_log");
 	size_t updatedUseCount = 0;
 	mock().expectOneCall("serviceReference_decreaseUsage")
-			.withParameter("ref", reference2)
+			.withParameter("ref", reference)
 			.withOutputParameterReturning("updatedCount", &updatedUseCount, sizeof(updatedUseCount));
-	mock().expectOneCall("serviceReference_release")
-			.withParameter("ref", reference2)
+	mock().expectNCalls(1, "serviceReference_release")
+			.withParameter("ref", reference)
 			.withOutputParameterReturning("destroyed", &destroyed, sizeof(destroyed));
+	mock().expectNCalls(2, "bundle_getCurrentModule")
+			.withParameter("bundle", bundle)
+			.withOutputParameterReturning("module", &module, sizeof(module));
+	mock().expectNCalls(2, "module_getSymbolicName")
+			.withParameter("module", module)
+			.withOutputParameterReturning("symbolicName", &modName, sizeof(modName));
+    mock().expectOneCall("serviceReference_getProperty")
+            .withParameter("reference", reference)
+            .withParameter("key", OSGI_FRAMEWORK_OBJECTCLASS)
+			.withOutputParameterReturning("value", &srvName, sizeof(srvName));
+    mock().expectOneCall("serviceReference_getServiceRegistration")
+            .withParameter("reference", reference)
+			.withOutputParameterReturning("registration", &registration, sizeof(registration));
+    mock().expectOneCall("serviceRegistration_getBundle")
+            .withParameter("registration", registration)
+			.withOutputParameterReturning("bundle", &bundle, sizeof(bundle));
+	mock().expectOneCall("framework_log");
 
 	serviceRegistry_clearReferencesFor(registry, bundle);
 
@@ -795,7 +856,7 @@
 	mock().expectOneCall("framework_log");
 
 
-	void *actual = (void*) 0x666;//generic non null pointer value
+	const void *actual = (void*) 0x666;//generic non null pointer value
 	celix_status_t status = serviceRegistry_getService(registry, bundle, reference, &actual);
 	LONGS_EQUAL(CELIX_BUNDLE_EXCEPTION, status);
 	//test reference with invalid registration
@@ -928,12 +989,13 @@
 	framework_pt framework = (framework_pt) 0x01;
 	serviceRegistry_create(framework,serviceRegistryTest_serviceChanged, &registry);
 	bundle_pt bundle = (bundle_pt) 0x10;
-	service_registration_pt registration = (service_registration_pt) 0x20;
+	service_registration_pt registration = (service_registration_pt) calloc(1,sizeof(struct serviceRegistration));
+	registration->serviceId = 20UL;
 	arrayList_add(registry->listenerHooks, registration);
 
 	hash_map_pt usages = hashMap_create(NULL, NULL, NULL, NULL);
 	service_reference_pt reference = (service_reference_pt) 0x30;
-	hashMap_put(usages, registration, reference);
+	hashMap_put(usages, (void*)registration->serviceId, reference);
 	hashMap_put(registry->serviceReferences, bundle, usages);
 
 	mock()
@@ -954,6 +1016,7 @@
 	hashMap_destroy(usages, false, false);
 	arrayList_destroy(hooks);
 	arrayList_remove(registry->listenerHooks, 0);
+	free(registration);
 	serviceRegistry_destroy(registry);
 }
 
@@ -980,10 +1043,16 @@
 	framework_pt framework = (framework_pt) 0x01;
 	serviceRegistry_create(framework,serviceRegistryTest_serviceChanged, &registry);
 
-	service_registration_pt registration = (service_registration_pt) 0x10;
-	service_registration_pt registration2 = (service_registration_pt) 0x20;
-	service_registration_pt registration3 = (service_registration_pt) 0x30;
-	service_registration_pt registration4 = (service_registration_pt) 0x40;
+	service_registration_pt registration  = (service_registration_pt) calloc(1,sizeof(struct serviceRegistration));
+	service_registration_pt registration2 = (service_registration_pt) calloc(1,sizeof(struct serviceRegistration));
+	service_registration_pt registration3 = (service_registration_pt) calloc(1,sizeof(struct serviceRegistration));
+	service_registration_pt registration4 = (service_registration_pt) calloc(1,sizeof(struct serviceRegistration));
+
+	registration->serviceId  = 10UL;
+	registration2->serviceId = 20UL;
+	registration3->serviceId = 30UL;
+	registration4->serviceId = 40UL;
+
 	service_reference_pt reference = (service_reference_pt) 0x50;
 	service_reference_pt reference2 = (service_reference_pt) 0x60;
 	service_reference_pt reference3 = (service_reference_pt) 0x70;
@@ -996,19 +1065,19 @@
 
 	//only contains registration1
 	hash_map_pt references = hashMap_create(NULL, NULL, NULL, NULL);
-	hashMap_put(references, registration, reference);
+	hashMap_put(references, (void*)registration->serviceId, reference);
 	hashMap_put(registry->serviceReferences, bundle, references);
 
 	//contains registration1 and one other
 	hash_map_pt references2 = hashMap_create(NULL, NULL, NULL, NULL);
-	hashMap_put(references2, registration, reference2);
-	hashMap_put(references2, registration2, reference3);
+	hashMap_put(references2, (void*)registration->serviceId, reference2);
+	hashMap_put(references2, (void*)registration2->serviceId, reference3);
 	hashMap_put(registry->serviceReferences, bundle2, references2);
 
 	//contains 2 registrations, but not registration1
 	hash_map_pt references3 = hashMap_create(NULL, NULL, NULL, NULL);
-	hashMap_put(references3, registration3, reference4);
-	hashMap_put(references3, registration4, reference5);
+	hashMap_put(references3, (void*)registration3->serviceId, reference4);
+	hashMap_put(references3, (void*)registration4->serviceId, reference5);
 	hashMap_put(registry->serviceReferences, bundle3, references3);
 
 	//call to getUsingBundles
@@ -1034,4 +1103,10 @@
 	hashMap_destroy(references2, false, false);
 	hashMap_destroy(references3, false, false);
 	serviceRegistry_destroy(registry);
+
+   free(registration);
+   free(registration2);
+   free(registration3);
+   free(registration4);
+
 }
diff --git a/framework/public/include/archive.h b/framework/public/include/archive.h
index fd418f3..ce9a395 100644
--- a/framework/public/include/archive.h
+++ b/framework/public/include/archive.h
@@ -41,7 +41,7 @@
  * 		- CELIX_SUCCESS when no errors are encountered.
  * 		- CELIX_FILE_IO_EXCEPTION If the zip file cannot be extracted.
  */
-celix_status_t extractBundle(char * bundleName, char * revisionRoot);
+celix_status_t extractBundle(const char* bundleName, const char* revisionRoot);
 
 #endif /* ARCHIVE_H_ */
 
diff --git a/framework/public/include/bundle.h b/framework/public/include/bundle.h
index 588e4cc..f18670b 100644
--- a/framework/public/include/bundle.h
+++ b/framework/public/include/bundle.h
@@ -54,11 +54,11 @@
 FRAMEWORK_EXPORT celix_status_t bundle_setActivator(bundle_pt bundle, activator_pt activator);
 FRAMEWORK_EXPORT celix_status_t bundle_getContext(bundle_pt bundle, bundle_context_pt *context);
 FRAMEWORK_EXPORT celix_status_t bundle_setContext(bundle_pt bundle, bundle_context_pt context);
-FRAMEWORK_EXPORT celix_status_t bundle_getEntry(bundle_pt bundle, char * name, char **entry);
+FRAMEWORK_EXPORT celix_status_t bundle_getEntry(bundle_pt bundle, const char* name, char** entry);
 
 FRAMEWORK_EXPORT celix_status_t bundle_start(bundle_pt bundle);
 FRAMEWORK_EXPORT celix_status_t bundle_startWithOptions(bundle_pt bundle, int options);
-FRAMEWORK_EXPORT celix_status_t bundle_update(bundle_pt bundle, char *inputFile);
+FRAMEWORK_EXPORT celix_status_t bundle_update(bundle_pt bundle, const char* inputFile);
 FRAMEWORK_EXPORT celix_status_t bundle_stop(bundle_pt bundle);
 FRAMEWORK_EXPORT celix_status_t bundle_stopWithOptions(bundle_pt bundle, int options);
 FRAMEWORK_EXPORT celix_status_t bundle_uninstall(bundle_pt bundle);
@@ -69,7 +69,7 @@
 
 FRAMEWORK_EXPORT void uninstallBundle(bundle_pt bundle);
 
-FRAMEWORK_EXPORT celix_status_t bundle_revise(bundle_pt bundle, char * location, char *inputFile);
+FRAMEWORK_EXPORT celix_status_t bundle_revise(bundle_pt bundle, const char* location, const char* inputFile);
 FRAMEWORK_EXPORT celix_status_t bundle_addModule(bundle_pt bundle, module_pt module);
 FRAMEWORK_EXPORT celix_status_t bundle_closeModules(bundle_pt bundle);
 
@@ -96,7 +96,7 @@
 FRAMEWORK_EXPORT celix_status_t bundle_setFramework(bundle_pt bundle, framework_pt framework);
 FRAMEWORK_EXPORT celix_status_t bundle_getFramework(bundle_pt bundle, framework_pt *framework);
 
-FRAMEWORK_EXPORT celix_status_t bundle_getBundleLocation(bundle_pt bundle, char **location);
+FRAMEWORK_EXPORT celix_status_t bundle_getBundleLocation(bundle_pt bundle, const char** location);
 
 
 #endif /* BUNDLE_H_ */
diff --git a/framework/public/include/bundle_archive.h b/framework/public/include/bundle_archive.h
index e5f22b3..bee4eb3 100644
--- a/framework/public/include/bundle_archive.h
+++ b/framework/public/include/bundle_archive.h
@@ -38,17 +38,17 @@
 
 typedef struct bundleArchive * bundle_archive_pt;
 
-celix_status_t bundleArchive_create(char * archiveRoot, long id, char * location, char *inputFile, bundle_archive_pt *bundle_archive);
+celix_status_t bundleArchive_create(const char* archiveRoot, long id, const char* location, const char* inputFile, bundle_archive_pt *bundle_archive);
 celix_status_t bundleArchive_createSystemBundleArchive(bundle_archive_pt *bundle_archive);
-celix_status_t bundleArchive_recreate(char * archiveRoot, bundle_archive_pt *bundle_archive);
+celix_status_t bundleArchive_recreate(const char* archiveRoot, bundle_archive_pt *bundle_archive);
 
 celix_status_t bundleArchive_destroy(bundle_archive_pt archive);
 
 FRAMEWORK_EXPORT celix_status_t bundleArchive_getId(bundle_archive_pt archive, long *id);
-FRAMEWORK_EXPORT celix_status_t bundleArchive_getLocation(bundle_archive_pt archive, char **location);
-FRAMEWORK_EXPORT celix_status_t bundleArchive_getArchiveRoot(bundle_archive_pt archive, char **archiveRoot);
+FRAMEWORK_EXPORT celix_status_t bundleArchive_getLocation(bundle_archive_pt archive, const char **location);
+FRAMEWORK_EXPORT celix_status_t bundleArchive_getArchiveRoot(bundle_archive_pt archive, const char **archiveRoot);
 
-FRAMEWORK_EXPORT celix_status_t bundleArchive_revise(bundle_archive_pt archive, char * location, char *inputFile);
+FRAMEWORK_EXPORT celix_status_t bundleArchive_revise(bundle_archive_pt archive, const char* location, const char* inputFile);
 FRAMEWORK_EXPORT celix_status_t bundleArchive_rollbackRevise(bundle_archive_pt archive, bool *rolledback);
 FRAMEWORK_EXPORT celix_status_t bundleArchive_getRevision(bundle_archive_pt archive, long revNr, bundle_revision_pt *revision);
 FRAMEWORK_EXPORT celix_status_t bundleArchive_getCurrentRevision(bundle_archive_pt archive, bundle_revision_pt *revision);
diff --git a/framework/public/include/bundle_context.h b/framework/public/include/bundle_context.h
index 6c885f5..55ab94a 100644
--- a/framework/public/include/bundle_context.h
+++ b/framework/public/include/bundle_context.h
@@ -47,12 +47,12 @@
 FRAMEWORK_EXPORT celix_status_t bundleContext_getBundle(bundle_context_pt context, bundle_pt *bundle);
 FRAMEWORK_EXPORT celix_status_t bundleContext_getFramework(bundle_context_pt context, framework_pt *framework);
 
-FRAMEWORK_EXPORT celix_status_t bundleContext_installBundle(bundle_context_pt context, char * location, bundle_pt *bundle);
-FRAMEWORK_EXPORT celix_status_t bundleContext_installBundle2(bundle_context_pt context, char * location, char *inputFile, bundle_pt *bundle);
+FRAMEWORK_EXPORT celix_status_t bundleContext_installBundle(bundle_context_pt context, const char* location, bundle_pt *bundle);
+FRAMEWORK_EXPORT celix_status_t bundleContext_installBundle2(bundle_context_pt context, const char* location, const char* inputFile, bundle_pt *bundle);
 
-FRAMEWORK_EXPORT celix_status_t bundleContext_registerService(bundle_context_pt context, char * serviceName, void * svcObj,
+FRAMEWORK_EXPORT celix_status_t bundleContext_registerService(bundle_context_pt context, const char* serviceName, const void * svcObj,
         properties_pt properties, service_registration_pt *service_registration);
-FRAMEWORK_EXPORT celix_status_t bundleContext_registerServiceFactory(bundle_context_pt context, char * serviceName, service_factory_pt factory,
+FRAMEWORK_EXPORT celix_status_t bundleContext_registerServiceFactory(bundle_context_pt context, const char* serviceName, service_factory_pt factory,
         properties_pt properties, service_registration_pt *service_registration);
 
 /**
@@ -64,7 +64,7 @@
  * @param service_reference _output_ The found service reference, or NULL when no service is found.
  * @return CELIX_SUCCESS on success
  */
-FRAMEWORK_EXPORT celix_status_t bundleContext_getServiceReference(bundle_context_pt context, char * serviceName, service_reference_pt *service_reference);
+FRAMEWORK_EXPORT celix_status_t bundleContext_getServiceReference(bundle_context_pt context, const char * serviceName, service_reference_pt *service_reference);
 
 /** Same as bundleContext_getServiceReference, but than for a optional serviceName combined with a optional filter.
  * The resulting array_list should be destroyed by the caller. For all service references return a unget should be called.
@@ -75,7 +75,7 @@
  * @param service_references _output_ a array list, can be size 0. 
  * @return CELIX_SUCCESS on success
  */
-FRAMEWORK_EXPORT celix_status_t bundleContext_getServiceReferences(bundle_context_pt context, const char * serviceName, char * filter, array_list_pt *service_references);
+FRAMEWORK_EXPORT celix_status_t bundleContext_getServiceReferences(bundle_context_pt context, const char * serviceName, const char * filter, array_list_pt *service_references);
 
 /**
  * Retains (increases the ref count) the provided service reference. Can be used to retain a service reference.
@@ -98,13 +98,13 @@
  */
 FRAMEWORK_EXPORT celix_status_t bundleContext_ungetServiceReference(bundle_context_pt context, service_reference_pt reference);
 
-FRAMEWORK_EXPORT celix_status_t bundleContext_getService(bundle_context_pt context, service_reference_pt reference, void **service_instance);
-FRAMEWORK_EXPORT celix_status_t bundleContext_ungetService(bundle_context_pt context, service_reference_pt reference, bool *result);
+FRAMEWORK_EXPORT celix_status_t bundleContext_getService(bundle_context_pt context, service_reference_pt reference, void** service_instance);
+FRAMEWORK_EXPORT celix_status_t bundleContext_ungetService(bundle_context_pt context, service_reference_pt reference, bool* result);
 
-FRAMEWORK_EXPORT celix_status_t bundleContext_getBundles(bundle_context_pt context, array_list_pt *bundles);
-FRAMEWORK_EXPORT celix_status_t bundleContext_getBundleById(bundle_context_pt context, long id, bundle_pt *bundle);
+FRAMEWORK_EXPORT celix_status_t bundleContext_getBundles(bundle_context_pt context, array_list_pt* bundles);
+FRAMEWORK_EXPORT celix_status_t bundleContext_getBundleById(bundle_context_pt context, long id, bundle_pt* bundle);
 
-FRAMEWORK_EXPORT celix_status_t bundleContext_addServiceListener(bundle_context_pt context, service_listener_pt listener, char * filter);
+FRAMEWORK_EXPORT celix_status_t bundleContext_addServiceListener(bundle_context_pt context, service_listener_pt listener, const char* filter);
 FRAMEWORK_EXPORT celix_status_t bundleContext_removeServiceListener(bundle_context_pt context, service_listener_pt listener);
 
 FRAMEWORK_EXPORT celix_status_t bundleContext_addBundleListener(bundle_context_pt context, bundle_listener_pt listener);
@@ -113,6 +113,7 @@
 FRAMEWORK_EXPORT celix_status_t bundleContext_addFrameworkListener(bundle_context_pt context, framework_listener_pt listener);
 FRAMEWORK_EXPORT celix_status_t bundleContext_removeFrameworkListener(bundle_context_pt context, framework_listener_pt listener);
 
-FRAMEWORK_EXPORT celix_status_t bundleContext_getProperty(bundle_context_pt context, const char *name, char **value);
+FRAMEWORK_EXPORT celix_status_t bundleContext_getProperty(bundle_context_pt context, const char* name, const char** value);
+FRAMEWORK_EXPORT celix_status_t bundleContext_getPropertyWithDefault(bundle_context_pt context, const char* name, const char* defaultValue, const char** value);
 
 #endif /* BUNDLE_CONTEXT_H_ */
diff --git a/framework/public/include/bundle_revision.h b/framework/public/include/bundle_revision.h
index 6537f64..7a1181a 100644
--- a/framework/public/include/bundle_revision.h
+++ b/framework/public/include/bundle_revision.h
@@ -62,7 +62,7 @@
  * 		- CELIX_SUCCESS when no errors are encountered.
  * 		- CELIX_ENOMEM If allocating memory for <code>bundle_revision</code> failed.
  */
-celix_status_t bundleRevision_create(char *root, char *location, long revisionNr, char *inputFile, bundle_revision_pt *bundle_revision);
+celix_status_t bundleRevision_create(const char* root, const char* location, long revisionNr, const char* inputFile, bundle_revision_pt *bundle_revision);
 
 celix_status_t bundleRevision_destroy(bundle_revision_pt revision);
 
@@ -88,7 +88,7 @@
  * 		- CELIX_SUCCESS when no errors are encountered.
  * 		- CELIX_ILLEGAL_ARGUMENT If <code>revision</code> is illegal.
  */
-celix_status_t bundleRevision_getLocation(bundle_revision_pt revision, char **location);
+celix_status_t bundleRevision_getLocation(bundle_revision_pt revision, const char** location);
 
 /**
  * Retrieves the root of the given revision.
@@ -100,7 +100,7 @@
  * 		- CELIX_SUCCESS when no errors are encountered.
  * 		- CELIX_ILLEGAL_ARGUMENT If <code>revision</code> is illegal.
  */
-celix_status_t bundleRevision_getRoot(bundle_revision_pt revision, char **root);
+celix_status_t bundleRevision_getRoot(bundle_revision_pt revision, const char** root);
 
 /**
  * Retrieves the manifest of the given revision.
diff --git a/framework/public/include/capability.h b/framework/public/include/capability.h
index e2dc33c..a041828 100644
--- a/framework/public/include/capability.h
+++ b/framework/public/include/capability.h
@@ -34,7 +34,7 @@
 
 celix_status_t capability_create(module_pt module, hash_map_pt directives, hash_map_pt attributes, capability_pt *capability);
 celix_status_t capability_destroy(capability_pt capability);
-celix_status_t capability_getServiceName(capability_pt capability, char **serviceName);
+celix_status_t capability_getServiceName(capability_pt capability, const char** serviceName);
 celix_status_t capability_getVersion(capability_pt capability, version_pt *version);
 celix_status_t capability_getModule(capability_pt capability, module_pt *module);
 
diff --git a/framework/public/include/celix_log.h b/framework/public/include/celix_log.h
index 50c2cc4..71f549a 100644
--- a/framework/public/include/celix_log.h
+++ b/framework/public/include/celix_log.h
@@ -46,7 +46,7 @@
 
 extern framework_logger_pt logger;
 
-typedef celix_status_t (*framework_log_function_pt)(framework_log_level_t level, const char *func, const char *file, int line, char *msg);
+typedef celix_status_t (*framework_log_function_pt)(framework_log_level_t level, const char* func, const char* file, int line, const char* msg);
 
 struct framework_logger {
     framework_log_function_pt logFunction;
@@ -63,8 +63,8 @@
         } \
     }
 
-FRAMEWORK_EXPORT celix_status_t frameworkLogger_log(framework_log_level_t level, const char *func, const char *file, int line, char *fmsg);
-FRAMEWORK_EXPORT void framework_log(framework_logger_pt logger, framework_log_level_t level, const char *func, const char *file, int line, char *fmsg, ...);
-FRAMEWORK_EXPORT void framework_logCode(framework_logger_pt logger, framework_log_level_t level, const char *func, const char *file, int line, celix_status_t code, char *fmsg, ...);
+FRAMEWORK_EXPORT celix_status_t frameworkLogger_log(framework_log_level_t level, const char *func, const char *file, int line, const char* fmsg);
+FRAMEWORK_EXPORT void framework_log(framework_logger_pt logger, framework_log_level_t level, const char *func, const char *file, int line, const char* fmsg, ...);
+FRAMEWORK_EXPORT void framework_logCode(framework_logger_pt logger, framework_log_level_t level, const char* func, const char* file, int line, celix_status_t code, const char* fmsg, ...);
 
 #endif /* CELIX_LOG_H_ */
diff --git a/framework/public/include/constants.h b/framework/public/include/constants.h
index 1064752..48eb376 100644
--- a/framework/public/include/constants.h
+++ b/framework/public/include/constants.h
@@ -33,6 +33,10 @@
 static const char * const OSGI_FRAMEWORK_SERVICE_RANKING = "service.ranking";
 
 static const char * const CELIX_FRAMEWORK_SERVICE_VERSION = "service.version";
+static const char * const CELIX_FRAMEWORK_SERVICE_LANGUAGE = "service.lang";
+static const char * const CELIX_FRAMEWORK_SERVICE_C_LANGUAGE = "C";
+static const char * const CELIX_FRAMEWORK_SERVICE_CXX_LANGUAGE = "C++";
+static const char * const CELIX_FRAMEWORK_SERVICE_SHARED_LANGUAGE = "shared"; //e.g. marker services
 
 static const char * const OSGI_FRAMEWORK_BUNDLE_ACTIVATOR = "Bundle-Activator";
 static const char * const OSGI_FRAMEWORK_BUNDLE_ACTIVATOR_CREATE = "bundleActivator_create";
diff --git a/framework/public/include/filter.h b/framework/public/include/filter.h
index 9e78192..27706a5 100644
--- a/framework/public/include/filter.h
+++ b/framework/public/include/filter.h
@@ -34,12 +34,12 @@
 
 typedef struct filter * filter_pt;
 
-FRAMEWORK_EXPORT filter_pt filter_create(char * filterString);
+FRAMEWORK_EXPORT filter_pt filter_create(const char * filterString);
 FRAMEWORK_EXPORT void filter_destroy(filter_pt filter);
 
 FRAMEWORK_EXPORT celix_status_t filter_match(filter_pt filter, properties_pt properties, bool *result);
 FRAMEWORK_EXPORT celix_status_t filter_match_filter(filter_pt src, filter_pt dest, bool *result);
 
-FRAMEWORK_EXPORT celix_status_t filter_getString(filter_pt filter, char **filterStr);
+FRAMEWORK_EXPORT celix_status_t filter_getString(filter_pt filter, const char** filterStr);
 
 #endif /* FILTER_H_ */
diff --git a/framework/public/include/manifest.h b/framework/public/include/manifest.h
index 634d675..398adfe 100644
--- a/framework/public/include/manifest.h
+++ b/framework/public/include/manifest.h
@@ -39,16 +39,16 @@
 typedef struct manifest * manifest_pt;
 
 FRAMEWORK_EXPORT celix_status_t manifest_create(manifest_pt *manifest);
-FRAMEWORK_EXPORT celix_status_t manifest_createFromFile(char *filename, manifest_pt *manifest);
+FRAMEWORK_EXPORT celix_status_t manifest_createFromFile(const char* filename, manifest_pt *manifest);
 FRAMEWORK_EXPORT celix_status_t manifest_destroy(manifest_pt manifest);
 
 FRAMEWORK_EXPORT void manifest_clear(manifest_pt manifest);
 FRAMEWORK_EXPORT properties_pt manifest_getMainAttributes(manifest_pt manifest);
 FRAMEWORK_EXPORT celix_status_t manifest_getEntries(manifest_pt manifest, hash_map_pt *map);
 
-FRAMEWORK_EXPORT celix_status_t manifest_read(manifest_pt manifest, char *filename);
-FRAMEWORK_EXPORT void manifest_write(manifest_pt manifest, char * filename);
+FRAMEWORK_EXPORT celix_status_t manifest_read(manifest_pt manifest, const char* filename);
+FRAMEWORK_EXPORT void manifest_write(manifest_pt manifest, const char*  filename);
 
-FRAMEWORK_EXPORT char * manifest_getValue(manifest_pt manifest, const char * name);
+FRAMEWORK_EXPORT const char* manifest_getValue(manifest_pt manifest, const char* name);
 
 #endif /* MANIFEST_H_ */
diff --git a/framework/public/include/module.h b/framework/public/include/module.h
index c6b7926..6d49a56 100644
--- a/framework/public/include/module.h
+++ b/framework/public/include/module.h
@@ -37,17 +37,17 @@
 #include "bundle.h"
 #include "framework_exports.h"
 
-module_pt module_create(manifest_pt headerMap, char * moduleId, bundle_pt bundle);
+module_pt module_create(manifest_pt headerMap, const char* moduleId, bundle_pt bundle);
 module_pt module_createFrameworkModule(bundle_pt bundle);
 void module_destroy(module_pt module);
 
 FRAMEWORK_EXPORT unsigned int module_hash(void * module);
 FRAMEWORK_EXPORT int module_equals(void * module, void * compare);
 
-FRAMEWORK_EXPORT wire_pt module_getWire(module_pt module, char * serviceName);
+FRAMEWORK_EXPORT wire_pt module_getWire(module_pt module, const char* serviceName);
 
 FRAMEWORK_EXPORT version_pt module_getVersion(module_pt module);
-FRAMEWORK_EXPORT celix_status_t module_getSymbolicName(module_pt module, char **symbolicName);
+FRAMEWORK_EXPORT celix_status_t module_getSymbolicName(module_pt module, const char** symbolicName);
 FRAMEWORK_EXPORT char * module_getId(module_pt module);
 FRAMEWORK_EXPORT linked_list_pt module_getWires(module_pt module);
 FRAMEWORK_EXPORT void module_setWires(module_pt module, linked_list_pt wires);
diff --git a/framework/public/include/properties.h b/framework/public/include/properties.h
index 9fa5f68..9a12a2a 100644
--- a/framework/public/include/properties.h
+++ b/framework/public/include/properties.h
@@ -37,14 +37,18 @@
 
 FRAMEWORK_EXPORT properties_pt properties_create(void);
 FRAMEWORK_EXPORT void properties_destroy(properties_pt properties);
-FRAMEWORK_EXPORT properties_pt properties_load(char * filename);
+FRAMEWORK_EXPORT properties_pt properties_load(const char* filename);
 FRAMEWORK_EXPORT properties_pt properties_loadWithStream(FILE *stream);
-FRAMEWORK_EXPORT void properties_store(properties_pt properties, char * file, char * header);
+FRAMEWORK_EXPORT void properties_store(properties_pt properties, const char* file, const char* header);
 
-FRAMEWORK_EXPORT char * properties_get(properties_pt properties, char * key);
-FRAMEWORK_EXPORT char * properties_getWithDefault(properties_pt properties, char * key, char * defaultValue);
-FRAMEWORK_EXPORT char * properties_set(properties_pt properties, char * key, char * value);
+FRAMEWORK_EXPORT const char* properties_get(properties_pt properties, const char* key);
+FRAMEWORK_EXPORT const char* properties_getWithDefault(properties_pt properties, const char* key, const char* defaultValue);
+FRAMEWORK_EXPORT void properties_set(properties_pt properties, const char* key, const char* value);
 
 FRAMEWORK_EXPORT celix_status_t properties_copy(properties_pt properties, properties_pt *copy);
 
+#define PROPERTIES_FOR_EACH(props, key) \
+	for(hash_map_iterator_t iter = hashMapIterator_construct(props); \
+		hashMapIterator_hasNext(&iter), (key) = (const char*)hashMapIterator_nextKey(&iter);) 
+
 #endif /* PROPERTIES_H_ */
diff --git a/framework/public/include/requirement.h b/framework/public/include/requirement.h
index 1b7c494..84d3a41 100644
--- a/framework/public/include/requirement.h
+++ b/framework/public/include/requirement.h
@@ -36,7 +36,7 @@
 celix_status_t requirement_create(hash_map_pt directives, hash_map_pt attributes, requirement_pt *requirement);
 celix_status_t requirement_destroy(requirement_pt requirement);
 celix_status_t requirement_getVersionRange(requirement_pt requirement, version_range_pt *range);
-celix_status_t requirement_getTargetName(requirement_pt requirement, char **targetName);
+celix_status_t requirement_getTargetName(requirement_pt requirement, const char** targetName);
 
 celix_status_t requirement_isSatisfied(requirement_pt requirement, capability_pt capability, bool *inRange);
 
diff --git a/framework/public/include/service_factory.h b/framework/public/include/service_factory.h
index 0793a40..655b368 100644
--- a/framework/public/include/service_factory.h
+++ b/framework/public/include/service_factory.h
@@ -27,7 +27,8 @@
 #ifndef SERVICE_FACTORY_H_
 #define SERVICE_FACTORY_H_
 
-typedef struct service_factory * service_factory_pt;
+typedef struct service_factory service_factory_t;
+typedef service_factory_t* service_factory_pt;
 
 #include "celix_errno.h"
 #include "service_registration.h"
diff --git a/framework/public/include/service_reference.h b/framework/public/include/service_reference.h
index f6cb9e5..cb67f24 100644
--- a/framework/public/include/service_reference.h
+++ b/framework/public/include/service_reference.h
@@ -37,16 +37,16 @@
 
 FRAMEWORK_EXPORT celix_status_t serviceReference_getBundle(service_reference_pt reference, bundle_pt *bundle);
 
-FRAMEWORK_EXPORT bool serviceReference_isAssignableTo(service_reference_pt reference, bundle_pt requester, char * serviceName);
+FRAMEWORK_EXPORT bool serviceReference_isAssignableTo(service_reference_pt reference, bundle_pt requester, const char* serviceName);
 
-FRAMEWORK_EXPORT celix_status_t serviceReference_getProperty(service_reference_pt reference, char *key, char **value);
+FRAMEWORK_EXPORT celix_status_t serviceReference_getProperty(service_reference_pt reference, const char* key, const char** value);
 FRAMEWORK_EXPORT celix_status_t serviceReference_getPropertyKeys(service_reference_pt reference, char **keys[], unsigned int *size);
 
 FRAMEWORK_EXPORT celix_status_t serviceReference_getServiceRegistration(service_reference_pt reference, service_registration_pt *registration);
 
 FRAMEWORK_EXPORT celix_status_t serviceReference_equals(service_reference_pt reference, service_reference_pt compareTo, bool *equal);
-FRAMEWORK_EXPORT unsigned int serviceReference_hashCode(void *referenceP);
-FRAMEWORK_EXPORT int serviceReference_equals2(void *reference1, void *reference2);
+FRAMEWORK_EXPORT unsigned int serviceReference_hashCode(const void* referenceP);
+FRAMEWORK_EXPORT int serviceReference_equals2(const void* reference1, const void* reference2);
 FRAMEWORK_EXPORT celix_status_t serviceReference_compareTo(service_reference_pt reference, service_reference_pt compareTo, int *compare);
 FRAMEWORK_EXPORT celix_status_t serviceReference_getUsingBundles(service_reference_pt ref, array_list_pt *out);
 
diff --git a/framework/public/include/service_registration.h b/framework/public/include/service_registration.h
index 7f0e17a..b981e48 100644
--- a/framework/public/include/service_registration.h
+++ b/framework/public/include/service_registration.h
@@ -40,6 +40,6 @@
 FRAMEWORK_EXPORT celix_status_t serviceRegistration_unregister(service_registration_pt registration);
 FRAMEWORK_EXPORT celix_status_t serviceRegistration_getProperties(service_registration_pt registration, properties_pt *properties);
 FRAMEWORK_EXPORT celix_status_t serviceRegistration_setProperties(service_registration_pt registration, properties_pt properties);
-FRAMEWORK_EXPORT celix_status_t serviceRegistration_getServiceName(service_registration_pt registration, char **serviceName);
+FRAMEWORK_EXPORT celix_status_t serviceRegistration_getServiceName(service_registration_pt registration, const char **serviceName);
 
 #endif /* SERVICE_REGISTRATION_H_ */
diff --git a/framework/public/include/service_registry.h b/framework/public/include/service_registry.h
index 506f2bf..940339f 100644
--- a/framework/public/include/service_registry.h
+++ b/framework/public/include/service_registry.h
@@ -44,8 +44,8 @@
 celix_status_t serviceRegistry_getRegisteredServices(service_registry_pt registry, bundle_pt bundle, array_list_pt *services);
 celix_status_t serviceRegistry_getServicesInUse(service_registry_pt registry, bundle_pt bundle, array_list_pt *services);
 
-celix_status_t serviceRegistry_registerService(service_registry_pt registry, bundle_pt bundle, char * serviceName, void * serviceObject, properties_pt dictionary, service_registration_pt *registration);
-celix_status_t serviceRegistry_registerServiceFactory(service_registry_pt registry, bundle_pt bundle, char * serviceName, service_factory_pt factory, properties_pt dictionary, service_registration_pt *registration);
+celix_status_t serviceRegistry_registerService(service_registry_pt registry, bundle_pt bundle, const char* serviceName, const void * serviceObject, properties_pt dictionary, service_registration_pt *registration);
+celix_status_t serviceRegistry_registerServiceFactory(service_registry_pt registry, bundle_pt bundle, const char* serviceName, service_factory_pt factory, properties_pt dictionary, service_registration_pt *registration);
 
 celix_status_t serviceRegistry_unregisterService(service_registry_pt registry, bundle_pt bundle, service_registration_pt registration);
 celix_status_t serviceRegistry_clearServiceRegistrations(service_registry_pt registry, bundle_pt bundle);
@@ -55,7 +55,7 @@
 celix_status_t serviceRegistry_retainServiceReference(service_registry_pt registry, bundle_pt bundle, service_reference_pt reference);
 celix_status_t serviceRegistry_ungetServiceReference(service_registry_pt registry, bundle_pt bundle, service_reference_pt reference);
 
-celix_status_t serviceRegistry_getService(service_registry_pt registry, bundle_pt bundle, service_reference_pt reference, void **service);
+celix_status_t serviceRegistry_getService(service_registry_pt registry, bundle_pt bundle, service_reference_pt reference, const void **service);
 celix_status_t serviceRegistry_ungetService(service_registry_pt registry, bundle_pt bundle, service_reference_pt reference, bool *result);
 
 celix_status_t serviceRegistry_clearReferencesFor(service_registry_pt registry, bundle_pt bundle);
diff --git a/framework/public/include/service_tracker.h b/framework/public/include/service_tracker.h
index 4ac8abb..415e96f 100644
--- a/framework/public/include/service_tracker.h
+++ b/framework/public/include/service_tracker.h
@@ -35,8 +35,8 @@
 
 typedef struct serviceTracker * service_tracker_pt;
 
-FRAMEWORK_EXPORT celix_status_t serviceTracker_create(bundle_context_pt context, char * service, service_tracker_customizer_pt customizer, service_tracker_pt *tracker);
-FRAMEWORK_EXPORT celix_status_t serviceTracker_createWithFilter(bundle_context_pt context, char * filter, service_tracker_customizer_pt customizer, service_tracker_pt *tracker);
+FRAMEWORK_EXPORT celix_status_t serviceTracker_create(bundle_context_pt context, const char* service, service_tracker_customizer_pt customizer, service_tracker_pt *tracker);
+FRAMEWORK_EXPORT celix_status_t serviceTracker_createWithFilter(bundle_context_pt context, const char* filter, service_tracker_customizer_pt customizer, service_tracker_pt *tracker);
 
 FRAMEWORK_EXPORT celix_status_t serviceTracker_open(service_tracker_pt tracker);
 FRAMEWORK_EXPORT celix_status_t serviceTracker_close(service_tracker_pt tracker);
diff --git a/framework/public/include/utils.h b/framework/public/include/utils.h
index 1ac2438..108bbdd 100644
--- a/framework/public/include/utils.h
+++ b/framework/public/include/utils.h
@@ -34,16 +34,16 @@
 #include "framework_exports.h"
 #include "celix_threads.h"
 
-FRAMEWORK_EXPORT unsigned int utils_stringHash(void * string);
-FRAMEWORK_EXPORT int utils_stringEquals(void * string, void * toCompare);
+FRAMEWORK_EXPORT unsigned int utils_stringHash(const void* string);
+FRAMEWORK_EXPORT int utils_stringEquals(const void* string, const void* toCompare);
 FRAMEWORK_EXPORT char * string_ndup(const char *s, size_t n);
 FRAMEWORK_EXPORT char * utils_stringTrim(char * string);
 FRAMEWORK_EXPORT bool utils_isStringEmptyOrNull(const char * const str);
 
-FRAMEWORK_EXPORT int utils_compareServiceIdsAndRanking(long servId, long servRank, long otherServId, long otherServRank);
+FRAMEWORK_EXPORT int utils_compareServiceIdsAndRanking(unsigned long servId, long servRank, unsigned long otherServId, long otherServRank);
 
 FRAMEWORK_EXPORT celix_status_t thread_equalsSelf(celix_thread_t thread, bool *equals);
 
-FRAMEWORK_EXPORT celix_status_t utils_isNumeric(char *number, bool *ret);
+FRAMEWORK_EXPORT celix_status_t utils_isNumeric(const char *number, bool *ret);
 
 #endif /* UTILS_H_ */
diff --git a/hessian/cmake/modules/FindCUnit.cmake b/hessian/cmake/modules/FindCUnit.cmake
deleted file mode 100644
index 3fce1b8..0000000
--- a/hessian/cmake/modules/FindCUnit.cmake
+++ /dev/null
@@ -1,65 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-if (NOT WIN32)
-	include(FindCurses)
-endif (NOT WIN32)
-
-FIND_PATH(CUNIT_INCLUDE_DIR Basic.h
-  /usr/local/include/CUnit
-  /usr/include/CUnit
-  /opt/local/include/CUnit  
-)
-
-FIND_PATH(CUNIT_SHARE_DIR CUnit-List.dtd
-	/usr/local/share/CUnit
-  	/usr/share/CUnit
-  	/opt/local/share/CUnit
-)
-
-# On unix system, debug and release have the same name
-FIND_LIBRARY(CUNIT_LIBRARY cunit
-             ${CUNIT_INCLUDE_DIR}/../../lib
-             /usr/local/lib
-             /usr/lib
-             )
-FIND_LIBRARY(CUNIT_DEBUG_LIBRARY cunit
-             ${CUNIT_INCLUDE_DIR}/../../lib
-             /usr/local/lib
-             /usr/lib
-             )
-
-IF(CUNIT_INCLUDE_DIR)
-  IF(CUNIT_LIBRARY)
-    SET(CUNIT_FOUND "YES")
-    if (WIN32)
-    	SET(CUNIT_LIBRARIES ${CUNIT_LIBRARY})
-	    SET(CUNIT_DEBUG_LIBRARIES ${CUNIT_DEBUG_LIBRARY})
-    else (WIN32)
-    	SET(CUNIT_LIBRARIES ${CUNIT_LIBRARY} ${CURSES_LIBRARY})
-	    SET(CUNIT_DEBUG_LIBRARIES ${CUNIT_DEBUG_LIBRARY} ${CURSES_DEBUG_LIBRARY})
-    endif (WIN32)
-  ENDIF(CUNIT_LIBRARY)
-  IF(CUNIT_INCLUDE_DIR)
-  	if (WIN32)
-    	SET(CUNIT_INCLUDE_DIRS ${CUNIT_INCLUDE_DIR})
-	else (WIN32)
-		MESSAGE(STATUS "Found CUNIT: ${CUNIT_INCLUDE_DIR}")
-		SET(CUNIT_INCLUDE_DIRS ${CUNIT_INCLUDE_DIR} ${CURSES_INCLUDE_DIR})
-	endif (WIN32)
-  ENDIF(CUNIT_INCLUDE_DIR)
-ENDIF(CUNIT_INCLUDE_DIR)
diff --git a/hessian/source/CMakeLists.txt b/hessian/source/CMakeLists.txt
deleted file mode 100644
index d6b0bcc..0000000
--- a/hessian/source/CMakeLists.txt
+++ /dev/null
@@ -1,87 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-cmake_minimum_required (VERSION 2.6)
-project (HessianC C)
-
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/../cmake/modules/")
-
-SET(CMAKE_BUILD_TYPE "Debug")
-SET(CMAKE_C_FLAGS "-D_GNU_SOURCE -std=gnu99 ${CMAKE_C_FLAGS}")
-
-MACRO(PARSE_ARGUMENTS prefix arg_names option_names)
-  SET(DEFAULT_ARGS)
-  FOREACH(arg_name ${arg_names})    
-    SET(${prefix}_${arg_name})
-  ENDFOREACH(arg_name)
-  FOREACH(option ${option_names})
-    SET(${prefix}_${option} FALSE)
-  ENDFOREACH(option)
-
-  SET(current_arg_name DEFAULT_ARGS)
-  SET(current_arg_list)
-  FOREACH(arg ${ARGN})            
-    SET(larg_names ${arg_names})    
-    LIST(FIND larg_names "${arg}" is_arg_name)                   
-    IF (is_arg_name GREATER -1)
-      SET(${prefix}_${current_arg_name} ${current_arg_list})
-      SET(current_arg_name ${arg})
-      SET(current_arg_list)
-    ELSE (is_arg_name GREATER -1)
-      SET(loption_names ${option_names})    
-      LIST(FIND loption_names "${arg}" is_option)            
-      IF (is_option GREATER -1)
-	     SET(${prefix}_${arg} TRUE)
-      ELSE (is_option GREATER -1)
-	     SET(current_arg_list ${current_arg_list} ${arg})
-      ENDIF (is_option GREATER -1)
-    ENDIF (is_arg_name GREATER -1)
-  ENDFOREACH(arg)
-  SET(${prefix}_${current_arg_name} ${current_arg_list})
-ENDMACRO(PARSE_ARGUMENTS)
-
-ADD_CUSTOM_TARGET(test)
-MACRO(run_test)
-    PARSE_ARGUMENTS(TEST "" "" ${ARGN})
-    LIST(GET TEST_DEFAULT_ARGS 0 EXEC)
-	
-	SET(__testTarget test_${EXEC})
-	
-	file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/test_results)
-		
-	add_custom_target(${__testTarget}
-		${EXEC} ${EXEC} 
-		COMMAND xsltproc --path ${CUNIT_SHARE_DIR} ${CUNIT_SHARE_DIR}/CUnit-Run.xsl ${PROJECT_BINARY_DIR}/test_results/${EXEC}-Results.xml > ${EXEC}-Results.html
-		COMMAND xsltproc --path ${CUNIT_SHARE_DIR} ${CUNIT_SHARE_DIR}/CUnit-List.xsl ${PROJECT_BINARY_DIR}/test_results/${EXEC}-Listing.xml > ${EXEC}-Listing.html
-		
-		WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/test_results
-	)
-	ADD_DEPENDENCIES(test ${__testTarget})
-ENDMACRO(run_test)
-
-include_directories("private/include")
-include_directories("public/include")
-
-add_library(hessian STATIC private/src/hessian_out private/src/hessian_in)
-
-include(FindCUnit)
-
-include_directories(${CUNIT_INCLUDE_DIRS})
-add_executable(test_hessian_out private/test/test_hessian_out.c)
-target_link_libraries(test_hessian_out hessian ${CUNIT_LIBRARIES})
-
-run_test(test_hessian_out)
diff --git a/hessian/source/private/src/hessian_in.c b/hessian/source/private/src/hessian_in.c
deleted file mode 100644
index 6a5f99c..0000000
--- a/hessian/source/private/src/hessian_in.c
+++ /dev/null
@@ -1,502 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * hessian_in.c
- *
- *  \date       Aug 1, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "hessian_2.0.h"
-
-static int END_OF_DATA = -2;
-
-int hessian_parseChar(hessian_in_pt in, char *c);
-int hessian_parseLong(hessian_in_pt in, long *value);
-int hessian_parseInt16(hessian_in_pt in, int *value);
-int hessian_parseInt(hessian_in_pt in, int *value);
-
-char hessian_read(hessian_in_pt in) {
-	return (in->buffer[in->offset++] & 0xFF);
-}
-
-int hessian_readBoolean(hessian_in_pt in, bool *value) {
-	char tag = hessian_read(in);
-
-	switch (tag) {
-		case 'T':
-			*value = true;
-			break;
-		case 'F':
-		default:
-			*value = false;
-			break;
-	}
-
-	return 0;
-}
-
-int hessian_readInt(hessian_in_pt in, int *value) {
-	unsigned char tag = hessian_read(in);
-
-	switch (tag) {
-		// direct integer
-		case 0x80: case 0x81: case 0x82: case 0x83:
-		case 0x84: case 0x85: case 0x86: case 0x87:
-		case 0x88: case 0x89: case 0x8a: case 0x8b:
-		case 0x8c: case 0x8d: case 0x8e: case 0x8f:
-
-		case 0x90: case 0x91: case 0x92: case 0x93:
-		case 0x94: case 0x95: case 0x96: case 0x97:
-		case 0x98: case 0x99: case 0x9a: case 0x9b:
-		case 0x9c: case 0x9d: case 0x9e: case 0x9f:
-
-		case 0xa0: case 0xa1: case 0xa2: case 0xa3:
-		case 0xa4: case 0xa5: case 0xa6: case 0xa7:
-		case 0xa8: case 0xa9: case 0xaa: case 0xab:
-		case 0xac: case 0xad: case 0xae: case 0xaf:
-
-		case 0xb0: case 0xb1: case 0xb2: case 0xb3:
-		case 0xb4: case 0xb5: case 0xb6: case 0xb7:
-		case 0xb8: case 0xb9: case 0xba: case 0xbb:
-		case 0xbc: case 0xbd: case 0xbe: case 0xbf:
-			*value = tag - INT_ZERO;
-			break;
-
-		/* byte int */
-		case 0xc0: case 0xc1: case 0xc2: case 0xc3:
-		case 0xc4: case 0xc5: case 0xc6: case 0xc7:
-		case 0xc8: case 0xc9: case 0xca: case 0xcb:
-		case 0xcc: case 0xcd: case 0xce: case 0xcf:
-			*value = ((tag - INT_BYTE_ZERO) << 8) + hessian_read(in);
-			break;
-
-		/* short int */
-		case 0xd0: case 0xd1: case 0xd2: case 0xd3:
-		case 0xd4: case 0xd5: case 0xd6: case 0xd7:
-			*value = ((tag - INT_SHORT_ZERO) << 16) + 256 * hessian_read(in) + hessian_read(in);
-			break;
-
-		case 'I':
-			hessian_readInt(in, value);
-			break;
-
-		default:
-			*value = 0;
-			break;
-	}
-
-	return 1;
-}
-
-int hessian_readLong(hessian_in_pt in, long *value) {
-	unsigned char tag = hessian_read(in);
-
-	switch (tag) {
-		// direct long
-		case 0xd8: case 0xd9: case 0xda: case 0xdb:
-		case 0xdc: case 0xdd: case 0xde: case 0xdf:
-
-		case 0xe0: case 0xe1: case 0xe2: case 0xe3:
-		case 0xe4: case 0xe5: case 0xe6: case 0xe7:
-		case 0xe8: case 0xe9: case 0xea: case 0xeb:
-		case 0xec: case 0xed: case 0xee: case 0xef:
-			*value = tag - LONG_ZERO;
-			break;
-
-		/* byte long */
-		case 0xf0: case 0xf1: case 0xf2: case 0xf3:
-		case 0xf4: case 0xf5: case 0xf6: case 0xf7:
-		case 0xf8: case 0xf9: case 0xfa: case 0xfb:
-		case 0xfc: case 0xfd: case 0xfe: case 0xff:
-			*value = ((tag - LONG_BYTE_ZERO) << 8) + hessian_read(in);
-			break;
-
-		/* short long */
-		case 0x38: case 0x39: case 0x3a: case 0x3b:
-		case 0x3c: case 0x3d: case 0x3e: case 0x3f:
-			*value = ((tag - LONG_SHORT_ZERO) << 16) + 256
-					* hessian_read(in) + hessian_read(in);
-			break;
-
-		case 'L':
-			hessian_parseLong(in, value);
-			break;
-		default:
-			return 0l;
-	}
-
-	return 0;
-}
-
-int hessian_readDouble(hessian_in_pt in, double *value) {
-	unsigned char tag = hessian_read(in);
-
-	long l;
-	int i;
-	double *d;
-	switch (tag) {
-		case 0x67:
-			*value = 0;
-			break;
-	    case 0x68:
-	    	*value = 1;
-	    	break;
-	    case 0x69:
-	    	*value = (double) hessian_read(in);
-	    	break;
-	    case 0x6a:
-	    	*value = (short) (256 * hessian_read(in) + hessian_read(in));
-	    	break;
-	    case 0x6b:
-	    	hessian_parseInt(in, &i);
-
-	    	*value = (double) *((float *) &i);
-	    	break;
-	    case 'D':
-	    	hessian_parseLong(in, &l);
-
-	    	d = (double *) &l;
-
-	    	*value = *d;
-	    	break;
-	}
-
-	return 0;
-}
-
-int hessian_readUTCDate(hessian_in_pt in, long *value) {
-	unsigned char tag = hessian_read(in);
-
-	if (tag == 'd') {
-		hessian_parseLong(in, value);
-	}
-
-	return 0;
-}
-
-int hessian_readNull(hessian_in_pt in) {
-	unsigned char tag = hessian_read(in);
-
-	switch (tag) {
-		case 'N':
-			break;
-		default:
-			break;
-	}
-
-	return 0;
-}
-
-int hessian_readChar(hessian_in_pt in, char *value) {
-	char *readC;
-	unsigned int read;
-	hessian_readNString(in, 0, 1, &readC, &read);
-	*value = readC[0];
-
-	return 0;
-}
-
-int hessian_readString(hessian_in_pt in, char **value, unsigned int *readLength) {
-	return hessian_readNString(in, 0, -1, value, readLength);
-}
-
-int hessian_readNString(hessian_in_pt in, int offset, int length, char **value, unsigned int *readLength) {
-	*readLength = 0;
-
-	bool done = false;
-	if (in->chunkLength == END_OF_DATA) {
-		done = true;
-	} else if (in->chunkLength == 0) {
-		unsigned char tag = hessian_read(in);
-
-		switch (tag) {
-			case 'N':
-				in->chunkLength = 0;
-				in->lastChunk = true;
-				break;
-			case 'S':
-			case 's':
-				in->lastChunk = tag == 'S';
-				hessian_parseInt16(in, &(in->chunkLength));
-				break;
-
-			case 0x00: case 0x01: case 0x02: case 0x03:
-			case 0x04: case 0x05: case 0x06: case 0x07:
-			case 0x08: case 0x09: case 0x0a: case 0x0b:
-			case 0x0c: case 0x0d: case 0x0e: case 0x0f:
-
-			case 0x10: case 0x11: case 0x12: case 0x13:
-			case 0x14: case 0x15: case 0x16: case 0x17:
-			case 0x18: case 0x19: case 0x1a: case 0x1b:
-			case 0x1c: case 0x1d: case 0x1e: case 0x1f:
-				in->chunkLength = tag - 0x00;
-				in->lastChunk = true;
-				break;
-
-			case 0x30: case 0x31: case 0x32: case 0x33:
-				in->chunkLength = (tag - 0x30) * 256 + hessian_read(in);
-				in->lastChunk = true;
-				break;
-
-			default:
-				in->chunkLength = 0;
-				in->lastChunk = true;
-				break;
-		}
-	}
-
-	while (!done) {
-		unsigned int newSize = *readLength + in->chunkLength + 1;
-		*value = realloc(*value, sizeof(char) * (*readLength + in->chunkLength + 1));
-
-		if (in->chunkLength > 0) {
-			char c;
-			hessian_parseChar(in, &c);
-			(*value)[(*readLength) + offset] = c;
-			(*value)[(*readLength) + offset + 1] = '\0';
-			in->chunkLength--;
-			(*readLength)++;
-			length--;
-
-			if (length == 0) {
-				done = true;
-			}
-
-		} else if (in->lastChunk) {
-			done = true;
-			if (*readLength != 0) {
-				in->chunkLength = END_OF_DATA;
-			}
-		} else {
-			unsigned char tag = hessian_read(in);
-			switch (tag) {
-				case 'S':
-				case 's':
-					done = tag == 'S';
-
-					hessian_parseInt16(in, &in->chunkLength);
-					break;
-
-				case 0x00: case 0x01: case 0x02: case 0x03:
-				case 0x04: case 0x05: case 0x06: case 0x07:
-				case 0x08: case 0x09: case 0x0a: case 0x0b:
-				case 0x0c: case 0x0d: case 0x0e: case 0x0f:
-
-				case 0x10: case 0x11: case 0x12: case 0x13:
-				case 0x14: case 0x15: case 0x16: case 0x17:
-				case 0x18: case 0x19: case 0x1a: case 0x1b:
-				case 0x1c: case 0x1d: case 0x1e: case 0x1f:
-					in->chunkLength = tag - 0x00;
-					in->lastChunk = true;
-					break;
-
-				case 0x30: case 0x31: case 0x32: case 0x33:
-					in->chunkLength = (tag - 0x30) * 256 + hessian_read(in);
-					in->lastChunk = true;
-					break;
-
-				default:
-					in->chunkLength = 0;
-					in->lastChunk = true;
-				break;
-			}
-		}
-	}
-
-	if (in->lastChunk && in->chunkLength == 0) {
-		in->chunkLength = END_OF_DATA;
-	}
-
-	return 0;
-}
-
-int hessian_readByte(hessian_in_pt in, unsigned char *value) {
-	unsigned char *readC;
-	unsigned int read;
-	hessian_readNBytes(in, 0, 1, &readC, &read);
-	*value = readC[0];
-
-	return 0;
-}
-
-int hessian_readBytes(hessian_in_pt in, unsigned char **value, unsigned int *readLength) {
-	return hessian_readNBytes(in, 0, -1, value, readLength);
-}
-
-int hessian_readNBytes(hessian_in_pt in, int offset, int length, unsigned char **value, unsigned int *readLength) {
-	*readLength = 0;
-
-	bool done = false;
-	if (in->chunkLength == END_OF_DATA) {
-		done = true;
-	} else if (in->chunkLength == 0) {
-		unsigned char tag = hessian_read(in);
-
-		switch (tag) {
-			case 'N':
-				in->chunkLength = 0;
-				in->lastChunk = true;
-				break;
-			case 'B':
-			case 'b':
-				in->lastChunk = tag == 'B';
-				hessian_parseInt16(in, &(in->chunkLength));
-				break;
-
-			case 0x20: case 0x21: case 0x22: case 0x23:
-			case 0x24: case 0x25: case 0x26: case 0x27:
-			case 0x28: case 0x29: case 0x2a: case 0x2b:
-			case 0x2c: case 0x2d: case 0x2e: case 0x2f:
-				in->chunkLength = tag - 0x20;
-				in->lastChunk = true;
-				break;
-
-			default:
-				in->chunkLength = 0;
-				in->lastChunk = true;
-				break;
-		}
-	}
-
-	while (!done) {
-		unsigned int newSize = *readLength + in->chunkLength;
-		*value = realloc(*value, sizeof(char) * (*readLength + in->chunkLength));
-
-		if (in->chunkLength > 0) {
-			unsigned char c = hessian_read(in);
-			(*value)[(*readLength) + offset] = c;
-			in->chunkLength--;
-			(*readLength)++;
-			length--;
-
-			if (length == 0) {
-				done = true;
-			}
-
-		} else if (in->lastChunk) {
-			done = true;
-			if (*readLength != 0) {
-				in->chunkLength = END_OF_DATA;
-			}
-		} else {
-			unsigned char tag = hessian_read(in);
-			switch (tag) {
-				case 'B':
-				case 'b':
-					done = tag == 'S';
-
-					hessian_parseInt16(in, &in->chunkLength);
-					break;
-
-				case 0x20: case 0x21: case 0x22: case 0x23:
-				case 0x24: case 0x25: case 0x26: case 0x27:
-				case 0x28: case 0x29: case 0x2a: case 0x2b:
-				case 0x2c: case 0x2d: case 0x2e: case 0x2f:
-					in->chunkLength = tag - 0x20;
-					in->lastChunk = true;
-					break;
-
-				default:
-					in->chunkLength = 0;
-					in->lastChunk = true;
-				break;
-			}
-		}
-	}
-
-	if (in->lastChunk && in->chunkLength == 0) {
-		in->chunkLength = END_OF_DATA;
-	}
-
-	return 0;
-}
-
-int hessian_parseChar(hessian_in_pt in, char *c) {
-	unsigned char ch = hessian_read(in);
-
-	if (ch < 0x80) {
-		*c = ch;
-	} else if ((ch & 0xe0) == 0xc0) {
-		char ch1 = hessian_read(in);
-
-		*c = ((ch & 0x1f) << 6) + (ch1 & 0x3f);
-	} else if ((ch & 0xf0) == 0xe0) {
-		char ch1 = hessian_read(in);
-		char ch2 = hessian_read(in);
-
-		*c = ((ch & 0x0f) << 12) + ((ch1 & 0x3f) << 6) + (ch2 & 0x3f);
-	} else {
-		*c = '\0';
-	}
-
-	return 0;
-}
-
-int hessian_parseInt16(hessian_in_pt in, int *value) {
-	int b16 = hessian_read(in) & 0xFF;
-	int b8 = hessian_read(in) & 0xFF;
-
-	*value = (b16 << 8)
-			+ b8;
-
-	return 0;
-}
-
-int hessian_parseInt(hessian_in_pt in, int *value) {
-	int b32 = hessian_read(in) & 0xFF;
-	int b24 = hessian_read(in) & 0xFF;
-	int b16 = hessian_read(in) & 0xFF;
-	int b8 = hessian_read(in) & 0xFF;
-
-	*value = (b32 << 24)
-			+ (b24 << 16)
-			+ (b16 << 8)
-			+ b8;
-
-	return 0;
-}
-
-int hessian_parseLong(hessian_in_pt in, long *value) {
-	long b64 = hessian_read(in) & 0xFF;
-	long b56 = hessian_read(in) & 0xFF;
-	long b48 = hessian_read(in) & 0xFF;
-	long b40 = hessian_read(in) & 0xFF;
-	long b32 = hessian_read(in) & 0xFF;
-	long b24 = hessian_read(in) & 0xFF;
-	long b16 = hessian_read(in) & 0xFF;
-	long b8 = hessian_read(in) & 0xFF;
-
-	long v = (b64 << 56)
-			+ (b56 << 48)
-			+ (b48 << 40)
-			+ (b40 << 32)
-			+ (b32 << 24)
-			+ (b24 << 16)
-			+ (b16 << 8)
-			+ b8;
-
-	*value = v;
-
-	return 0;
-}
diff --git a/hessian/source/private/src/hessian_out.c b/hessian/source/private/src/hessian_out.c
deleted file mode 100644
index ab044ff..0000000
--- a/hessian/source/private/src/hessian_out.c
+++ /dev/null
@@ -1,401 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * hessian_out.c
- *
- *  \date       Jul 31, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "hessian_2.0.h"
-
-void hessian_ensureCapacity(hessian_out_pt obj, int capacity);
-
-int hessian_printString(hessian_out_pt out, char *value);
-int hessian_printNString(hessian_out_pt out, char *value, int offset, int length);
-
-int hessian_writeType(hessian_out_pt out, char *type);
-
-int hessian_write(hessian_out_pt out, unsigned char byte);
-int hessian_writeP(hessian_out_pt out, unsigned char *byte);
-
-int hessian_writeBoolean(hessian_out_pt out, bool value) {
-	hessian_ensureCapacity(out, out->offset + 1);
-
-	if (value) {
-		char c = 'T';
-		hessian_writeP(out, &c);
-	} else {
-		out->buffer[out->offset++] = 'F';
-		out->length++;
-	}
-
-	return 0;
-}
-
-int hessian_writeInt(hessian_out_pt out, int value) {
-	hessian_ensureCapacity(out, out->offset + 5);
-
-	if (INT_DIRECT_MIN <= value && value <= INT_DIRECT_MAX)
-		hessian_write(out, (char) (value + INT_ZERO));
-	else if (INT_BYTE_MIN <= value && value <= INT_BYTE_MAX) {
-		hessian_write(out, (char) (INT_BYTE_ZERO + (value >> 8)));
-		hessian_write(out, (char) (value));
-	} else if (INT_SHORT_MIN <= value && value <= INT_SHORT_MAX) {
-		hessian_write(out, (char)(INT_SHORT_ZERO + (value >> 16)));
-		hessian_write(out, (char)(value >> 8));
-		hessian_write(out, (char)(value));
-	} else {
-		hessian_write(out, (char)('I'));
-		hessian_write(out, (char)(value >> 24));
-		hessian_write(out, (char)(value >> 16));
-		hessian_write(out, (char)(value >> 8));
-		hessian_write(out, (char)(value));
-	}
-
-	return 0;
-}
-
-int hessian_writeLong(hessian_out_pt out, long value) {
-	hessian_ensureCapacity(out, out->offset + 9);
-
-	if (LONG_DIRECT_MIN <= value && value <= LONG_DIRECT_MAX) {
-		hessian_write(out, (char)(value + LONG_ZERO));
-	} else if (LONG_BYTE_MIN <= value && value <= LONG_BYTE_MAX) {
-		hessian_write(out, (char)(LONG_BYTE_ZERO + (value >> 8)));
-		hessian_write(out, (char)(value));
-	} else if (LONG_SHORT_MIN <= value && value <= LONG_SHORT_MAX) {
-		hessian_write(out, (char)(LONG_SHORT_ZERO + (value >> 16)));
-		hessian_write(out, (char)(value >> 8));
-		hessian_write(out, (char)(value));
-	} else if (-0x80000000L <= value && value <= 0x7fffffffL) {
-		hessian_write(out, (char) LONG_INT);
-		hessian_write(out, (char)(value >> 24));
-		hessian_write(out, (char)(value >> 16));
-		hessian_write(out, (char)(value >> 8));
-		hessian_write(out, (char)(value));
-	} else {
-		hessian_write(out, (char) 'L');
-		hessian_write(out, (char)(value >> 56));
-		hessian_write(out, (char)(value >> 48));
-		hessian_write(out, (char)(value >> 40));
-		hessian_write(out, (char)(value >> 32));
-		hessian_write(out, (char)(value >> 24));
-		hessian_write(out, (char)(value >> 16));
-		hessian_write(out, (char)(value >> 8));
-		hessian_write(out, (char)(value));
-	}
-
-	return 0;
-}
-
-int hessian_writeDouble(hessian_out_pt out, double value) {
-	hessian_ensureCapacity(out, out->offset + 9);
-
-	int intValue = (int) value;
-
-	if (intValue == value) {
-		if (intValue == 0) {
-			hessian_write(out, (char) DOUBLE_ZERO);
-		} else if (intValue == 1) {
-			hessian_write(out, (char) DOUBLE_ONE);
-		} else if (-0x80 <= intValue && intValue < 0x80) {
-			hessian_write(out, (char) DOUBLE_BYTE);
-			hessian_write(out, (char) intValue);
-		} else if (-0x8000 <= intValue && intValue < 0x8000) {
-			hessian_write(out, (char) DOUBLE_SHORT);
-			hessian_write(out, (char) ((intValue >> 8) & 0xFF));
-			hessian_write(out, (char) (intValue & 0xFF));
-		}
-	} else {
-		float f = (float) value;
-
-		if (f == value) {
-			float f = value;
-			int bits = *((int *) &f);
-
-			hessian_write(out, (char)(DOUBLE_FLOAT));
-			hessian_write(out, (char)(bits >> 24));
-			hessian_write(out, (char)(bits >> 16));
-			hessian_write(out, (char)(bits >> 8));
-			hessian_write(out, (char)(bits));
-		} else {
-			long bits = *((long *) &value);
-
-			hessian_write(out, (char) 'D');
-			hessian_write(out, (char)(bits >> 56) & 0x00000000000000FF);
-			hessian_write(out, (char)(bits >> 48) & 0x00000000000000FF);
-			hessian_write(out, (char)(bits >> 40) & 0x00000000000000FF);
-			hessian_write(out, (char)(bits >> 32) & 0x00000000000000FF);
-			hessian_write(out, (char)(bits >> 24) & 0x00000000000000FF);
-			hessian_write(out, (char)(bits >> 16) & 0x00000000000000FF);
-			hessian_write(out, (char)(bits >> 8) & 0x00000000000000FF);
-			hessian_write(out, (char)(bits) & 0x00000000000000FF);
-		}
-	}
-
-	return 0;
-}
-
-int hessian_writeUTCDate(hessian_out_pt out, long value) {
-	hessian_ensureCapacity(out, out->offset + 9);
-
-	hessian_write(out, (int) ('d'));
-	hessian_write(out, ((int) (value >> 56)));
-	hessian_write(out, ((int) (value >> 48)));
-	hessian_write(out, ((int) (value >> 40)));
-	hessian_write(out, ((int) (value >> 32)));
-	hessian_write(out, ((int) (value >> 24)));
-	hessian_write(out, ((int) (value >> 16)));
-	hessian_write(out, ((int) (value >> 8)));
-	hessian_write(out, ((int) (value)));
-
-	return 0;
-}
-
-int hessian_writeNull(hessian_out_pt out) {
-	hessian_ensureCapacity(out, out->offset + 1);
-
-	hessian_write(out, (int) ('N'));
-
-	return 0;
-}
-
-int hessian_writeString(hessian_out_pt out, char *value) {
-	int length = strlen(value);
-	return hessian_writeNString(out, value, 0, length);
-}
-
-int hessian_writeNString(hessian_out_pt out, char *value, int offset, int length) {
-	if (value == NULL) {
-		hessian_writeNull(out);
-	} else {
-		while (length > 0x8000) {
-			int sublen = 0x8000;
-
-			// chunk can't end in high surrogate
-			int tail = value[offset + sublen - 1];
-
-			if (0xd800 <= tail && tail <= 0xdbff)
-				sublen--;
-
-			hessian_ensureCapacity(out, out->offset + 3);
-
-			hessian_write(out, (int) 's');
-			hessian_write(out, (int)(sublen >> 8));
-			hessian_write(out, (int)(sublen));
-
-			hessian_printNString(out, value, offset, sublen);
-
-			length -= sublen;
-			offset += sublen;
-		}
-
-		if (length <= STRING_DIRECT_MAX) {
-			hessian_ensureCapacity(out, out->offset + 2);
-
-			hessian_write(out, (int)(STRING_DIRECT + length));
-		} else {
-			hessian_ensureCapacity(out, out->offset + 3);
-
-			hessian_write(out, (int)('S'));
-			hessian_write(out, (int)(length >> 8));
-			hessian_write(out, (int)(length));
-		}
-
-		hessian_printNString(out, value, offset, length);
-	}
-
-	return 0;
-}
-
-int hessian_writeBytes(hessian_out_pt out, unsigned char value[], int length) {
-	return hessian_writeNBytes(out, value, 0, length);
-}
-
-int hessian_writeNBytes(hessian_out_pt out, unsigned char value[], int offset, int length) {
-	if (value == NULL) {
-		hessian_writeNull(out);
-	} else {
-		while (length > 0x8000) {
-			int sublen = 0x8000;
-
-			hessian_ensureCapacity(out, out->offset + 3);
-
-			hessian_write(out, (int) 'b');
-			hessian_write(out, (int)(sublen >> 8));
-			hessian_write(out, (int) sublen);
-
-			hessian_ensureCapacity(out, out->offset + sublen);
-			memcpy(out->buffer+out->offset, value+offset, sublen);
-			out->offset += sublen;
-
-			length -= sublen;
-			offset += sublen;
-		}
-
-		if (length < 0x10) {
-			hessian_ensureCapacity(out, out->offset + 1);
-			hessian_write(out, (int)(BYTES_DIRECT + length));
-		} else {
-			hessian_ensureCapacity(out, out->offset + 3);
-			hessian_write(out, (int) 'B');
-			hessian_write(out, (int)(length >> 8));
-			hessian_write(out, (int)(length));
-		}
-
-		hessian_ensureCapacity(out, out->offset + length);
-		memcpy(out->buffer+out->offset, value+offset, length);
-
-		out->offset += length;
-	}
-
-	return 0;
-}
-
-int hessian_writeListBegin(hessian_out_pt out, int length, char *type) {
-	hessian_ensureCapacity(out, out->offset + 1);
-	if (length < 0) {
-		if (type != NULL) {
-			hessian_write(out, (char) BC_LIST_VARIABLE);
-			hessian_writeType(out, type);
-		} else {
-			hessian_write(out, (char) BC_LIST_VARIABLE_UNTYPED);
-		}
-
-		return true;
-	} else if (length <= LIST_DIRECT_MAX) {
-		if (type != NULL) {
-			hessian_write(out, (char)(BC_LIST_DIRECT + length));
-			hessian_writeType(out, type);
-		} else {
-			hessian_write(out, (char)(BC_LIST_DIRECT_UNTYPED + length));
-		}
-
-		return false;
-	} else {
-		if (type != NULL) {
-			hessian_write(out, (char) BC_LIST_FIXED);
-			hessian_writeType(out, type);
-		} else {
-			hessian_write(out, (char) BC_LIST_FIXED_UNTYPED);
-		}
-
-		hessian_writeInt(out, length);
-
-		return false;
-	}
-
-	return 0;
-}
-
-int hessian_writeListEnd(hessian_out_pt out) {
-	hessian_ensureCapacity(out, out->offset + 1);
-	hessian_write(out, (char) BC_END);
-
-	return 0;
-}
-
-int hessian_writeType(hessian_out_pt out, char *type) {
-	int len = strlen(type);
-	if (len == 0) {
-		return 1;
-	}
-
-	// Do something with refs here
-	return hessian_writeString(out, type);
-}
-
-int hessian_startCall(hessian_out_pt out, char *method, int length) {
-	hessian_ensureCapacity(out, out->offset + 1);
-	hessian_write(out, 'C');
-
-	hessian_writeString(out, method);
-	hessian_writeInt(out, length);
-
-	return 0;
-}
-
-int hessian_completeCall(hessian_out_pt out) {
-	return 0;
-}
-
-int hessian_printString(hessian_out_pt out, char *value) {
-	return hessian_printNString(out, value, 0, strlen(value));
-}
-
-int hessian_printNString(hessian_out_pt out, char *value, int offset, int length) {
-	hessian_ensureCapacity(out, out->offset + length);
-
-	for (int i = 0; i < length; i++) {
-		int ch = value[i + offset];
-
-		if (ch < 0x80) {
-			hessian_write(out, (int)(ch));
-			out->length++;
-		} else if (ch < 0x800) {
-			hessian_write(out, (int)(0xc0 + ((ch >> 6) & 0x1f)));
-			out->length++;
-			hessian_write(out, (int)(0x80 + (ch & 0x3f)));
-			out->length++;
-		} else {
-			hessian_write(out, (int)(0xe0 + ((ch >> 12) & 0xf)));
-			out->length++;
-			hessian_write(out, (int)(0x80 + ((ch >> 6) & 0x3f)));
-			out->length++;
-			hessian_write(out, (int)(0x80 + (ch & 0x3f)));
-			out->length++;
-		}
-	}
-
-	return 0;
-}
-
-void hessian_ensureCapacity(hessian_out_pt obj, int capacity) {
-	char *newArray;
-	int oldCapacity;
-	oldCapacity = obj->capacity;
-	if (capacity > oldCapacity) {
-		int newCapacity = (oldCapacity * 3) / 2 + 1;
-		if (newCapacity < capacity) {
-			newCapacity = capacity;
-		}
-		newArray = (char *) realloc(obj->buffer, sizeof(char *) * newCapacity);
-		obj->capacity = newCapacity;
-		obj->buffer = newArray;
-	}
-}
-
-int hessian_write(hessian_out_pt out, unsigned char byte) {
-	out->buffer[out->offset++] = byte;
-	out->length++;
-
-	return 0;
-}
-
-int hessian_writeP(hessian_out_pt out, unsigned char *byte) {
-	out->buffer[out->offset++] = *byte;
-	out->length++;
-
-	return 0;
-}
diff --git a/hessian/source/private/test/test_hessian_out.c b/hessian/source/private/test/test_hessian_out.c
deleted file mode 100644
index 0c07401..0000000
--- a/hessian/source/private/test/test_hessian_out.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * test_hessian_out.c
- *
- *  \date       Aug 4, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <Automated.h>
-
-#include "hessian_2.0_out.h"
-
-hessian_out_pt out;
-
-int setup() {
-	out = malloc(sizeof(*out));
-
-	return 0;
-}
-
-void test_hessian_writeBoolean() {
-	out = malloc(sizeof(*out));
-	out->offset = 0;
-	out->buffer = NULL;
-	out->capacity = 0;
-	out->chunkLength = 0;
-	out->lastChunk = false;
-	out->length = 0;
-
-	hessian_writeBoolean(out, true);
-
-	CU_ASSERT_EQUAL(out->length, 1);
-	CU_ASSERT_EQUAL(out->buffer[0], 'T');
-}
-
-void test_hessian_writeInt() {
-	out = malloc(sizeof(*out));
-	out->offset = 0;
-	out->buffer = NULL;
-	out->capacity = 0;
-	out->chunkLength = 0;
-	out->lastChunk = false;
-	out->length = 0;
-
-	hessian_writeInt(out, 0);
-
-	unsigned char c1 = out->buffer[0];
-	unsigned char expect = 0x90;
-	CU_ASSERT_EQUAL(out->length, 1);
-	CU_ASSERT_EQUAL(c1, expect);
-
-	hessian_writeInt(out, -256);
-
-	unsigned char c2[] =  { out->buffer[1], out->buffer[2] };
-	unsigned char expect2[] = { 0xC7, 0x00 };
-	CU_ASSERT_EQUAL(out->length, 3);
-	// CU_ASSERT_EQUAL(c2, expect2);
-}
-
-int main (int argc, char** argv) {
-	CU_pSuite pSuite = NULL;
-
-	/* initialize the CUnit test registry */
-	if (CUE_SUCCESS != CU_initialize_registry())
-	  return CU_get_error();
-
-	/* add a suite to the registry */
-	pSuite = CU_add_suite("Hessian output", setup, NULL);
-	if (NULL == pSuite) {
-	  CU_cleanup_registry();
-	  return CU_get_error();
-	}
-
-	/* add the tests to the suite */
-	if (
-			NULL == CU_add_test(pSuite, "test boolean", test_hessian_writeBoolean)
-			|| NULL == CU_add_test(pSuite, "test int", test_hessian_writeInt)
-		) {
-		CU_cleanup_registry();
-		return CU_get_error();
-	}
-
-	CU_set_output_filename(argv[1]);
-	CU_list_tests_to_file();
-	CU_automated_run_tests();
-	CU_cleanup_registry();
-	return CU_get_error();
-}
diff --git a/hessian/source/private/test/test_service.h b/hessian/source/private/test/test_service.h
deleted file mode 100644
index e1967e1..0000000
--- a/hessian/source/private/test/test_service.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * test_service.h
- *
- *  \date       Aug 5, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-#ifndef TEST_SERVICE_H_
-#define TEST_SERVICE_H_
-
-typedef struct test_service *test_service_pt;
-
-void testService_sayHello(test_service_pt testService, char *message);
-
-
-#endif /* TEST_SERVICE_H_ */
diff --git a/hessian/source/private/test/test_service_skeleton.c b/hessian/source/private/test/test_service_skeleton.c
deleted file mode 100644
index 736fbd4..0000000
--- a/hessian/source/private/test/test_service_skeleton.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * test_service_skeleton.c
- *
- *  \date       Aug 5, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stddef.h>
-#include <stdio.h>
-
-#include "hessian_2.0_in.h"
-
-void testServiceSkeleton_sayHello(hessian_in_pt in);
-
-void testServiceSkeleton_handleData(hessian_in_pt in) {
-	char *method = NULL;
-	hessian_readCall(in, &method);
-
-	switch (method) {
-		case "sayHello":
-			testServiceSkeleton_sayHello(in);
-			break;
-		default:
-			break;
-	}
-}
-
-void testServiceSkeleton_sayHello(hessian_in_pt in) {
-	char *message = NULL;
-	int read;
-	hessian_readString(in, &message, &read);
-
-	testService_sayHello(NULL, message);
-}
diff --git a/hessian/source/public/include/hessian_2.0.h b/hessian/source/public/include/hessian_2.0.h
deleted file mode 100644
index 29dc052..0000000
--- a/hessian/source/public/include/hessian_2.0.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * hessian_2.0.h
- *
- *  \date       Aug 1, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-#ifndef HESSIAN_2_0_H_
-#define HESSIAN_2_0_H_
-
-#include "hessian_2.0_in.h"
-#include "hessian_2.0_out.h"
-
-#include "hessian_constants.h"
-
-struct hessian {
-	long offset;
-	long length;
-	long capacity;
-
-	unsigned char *buffer;
-
-	bool lastChunk;
-	unsigned int chunkLength;
-};
-
-#endif /* HESSIAN_2_0_H_ */
diff --git a/hessian/source/public/include/hessian_2.0_in.h b/hessian/source/public/include/hessian_2.0_in.h
deleted file mode 100644
index f39a1f6..0000000
--- a/hessian/source/public/include/hessian_2.0_in.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * hessian_2.0_in.h
- *
- *  \date       Aug 1, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-#ifndef HESSIAN_2_0_IN_H_
-#define HESSIAN_2_0_IN_H_
-
-#include <stdbool.h>
-
-#include "hessian_2.0.h"
-
-typedef struct hessian * hessian_in_pt;
-
-int hessian_readBoolean(hessian_in_pt in, bool *value);
-int hessian_readInt(hessian_in_pt in, int *value);
-int hessian_readLong(hessian_in_pt in, long *value);
-int hessian_readDouble(hessian_in_pt in, double *value);
-int hessian_readUTCDate(hessian_in_pt in, long *value);
-int hessian_readNull(hessian_in_pt in);
-int hessian_readChar(hessian_in_pt in, char *value);
-int hessian_readString(hessian_in_pt in, char **value, unsigned int *readLength);
-int hessian_readNString(hessian_in_pt in, int offset, int length, char **value, unsigned int *readLength);
-int hessian_readByte(hessian_in_pt in, unsigned char *value);
-int hessian_readBytes(hessian_in_pt in, unsigned char **value, unsigned int *readLength);
-int hessian_readNBytes(hessian_in_pt in, int offset, int length, unsigned char **value, unsigned int *readLength);
-
-
-#endif /* HESSIAN_2_0_IN_H_ */
diff --git a/hessian/source/public/include/hessian_2.0_out.h b/hessian/source/public/include/hessian_2.0_out.h
deleted file mode 100644
index c1ccba5..0000000
--- a/hessian/source/public/include/hessian_2.0_out.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * hessian_2.0_out.h
- *
- *  \date       Jul 31, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-#ifndef HESSIAN_2_0_OUT_H_
-#define HESSIAN_2_0_OUT_H_
-
-#include <stdbool.h>
-
-//#include "linked_list.h"
-//#include "array_list.h"
-#include "hessian_2.0.h"
-
-typedef struct hessian * hessian_out_pt;
-
-int hessian_writeBoolean(hessian_out_pt out, bool value);
-int hessian_writeInt(hessian_out_pt out, int value);
-int hessian_writeLong(hessian_out_pt out, long value);
-int hessian_writeDouble(hessian_out_pt out, double value);
-int hessian_writeUTCDate(hessian_out_pt out, long value);
-int hessian_writeNull(hessian_out_pt out);
-int hessian_writeString(hessian_out_pt out, char *value);
-int hessian_writeNString(hessian_out_pt out, char *value, int offset, int length);
-int hessian_writeBytes(hessian_out_pt out, unsigned char value[], int length);
-int hessian_writeNBytes(hessian_out_pt out, unsigned char value[], int offset, int length);
-
-int hessian_writeListBegin(hessian_out_pt out, int size, char *type);
-int hessian_writeListEnd(hessian_out_pt out);
-
-int hessian_writeObjectBegin(hessian_out_pt out, char *type);
-int hessian_writeObjectDefinition(hessian_out_pt out, char **fieldNames, int fields);
-int hessian_writeObjectEnd(hessian_out_pt out);
-
-int hessian_startCall(hessian_out_pt out, char *method, int length);
-int hessian_completeCall(hessian_out_pt out);
-
-
-
-#endif /* HESSIAN_2_0_OUT_H_ */
diff --git a/hessian/source/public/include/hessian_constants.h b/hessian/source/public/include/hessian_constants.h
deleted file mode 100644
index cf29fee..0000000
--- a/hessian/source/public/include/hessian_constants.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * hessian_constants.h
- *
- *  \date       Jul 31, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-#ifndef HESSIAN_CONSTANTS_H_
-#define HESSIAN_CONSTANTS_H_
-
-static int INT_DIRECT_MIN = -0x10;
-static int INT_DIRECT_MAX = 0x2f;
-static int INT_ZERO = 0x90;
-
-static int INT_BYTE_MIN = -0x800;
-static int INT_BYTE_MAX = 0x7ff;
-static int INT_BYTE_ZERO = 0xc8;
-
-static int INT_SHORT_MIN = -0x40000;
-static int INT_SHORT_MAX = 0x3ffff;
-static int INT_SHORT_ZERO = 0xd4;
-
-static long LONG_DIRECT_MIN = -0x08;
-static long LONG_DIRECT_MAX =  0x0f;
-static int LONG_ZERO = 0xe0;
-
-static long LONG_BYTE_MIN = -0x800;
-static long LONG_BYTE_MAX =  0x7ff;
-static int LONG_BYTE_ZERO = 0xf8;
-
-static int LONG_SHORT_MIN = -0x40000;
-static int LONG_SHORT_MAX = 0x3ffff;
-static int LONG_SHORT_ZERO = 0x3c;
-
-static int STRING_DIRECT_MAX = 0x1f;
-static int STRING_DIRECT = 0x00;
-
-static int BYTES_DIRECT_MAX = 0x0f;
-static int BYTES_DIRECT = 0x20;
-  // 0x30-0x37 is reserved
-
-static int LONG_INT = 0x77;
-
-static int DOUBLE_ZERO = 0x67;
-static int DOUBLE_ONE = 0x68;
-static int DOUBLE_BYTE = 0x69;
-static int DOUBLE_SHORT = 0x6a;
-static int DOUBLE_FLOAT = 0x6b;
-
-static int BC_END = 'Z';
-
-static int BC_LIST_VARIABLE = 0x55;
-static int BC_LIST_FIXED = 'V';
-static int BC_LIST_VARIABLE_UNTYPED = 0x57;
-static int BC_LIST_FIXED_UNTYPED = 0x58;
-
-static int BC_LIST_DIRECT = 0x70;
-static int BC_LIST_DIRECT_UNTYPED = 0x78;
-static int LIST_DIRECT_MAX = 0x7;
-
-static int REF_BYTE = 0x4a;
-static int REF_SHORT = 0x4b;
-
-static int TYPE_REF = 0x75;
-
-#endif /* HESSIAN_CONSTANTS_H_ */
diff --git a/hessian/source/test.c b/hessian/source/test.c
deleted file mode 100644
index c19e4f7..0000000
--- a/hessian/source/test.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * test.c
- *
- *  \date       Jul 31, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "hessian_2.0_out.h"
-#include "hessian_2.0_in.h"
-
-int main(int argc, char **argv) {
-	hessian_out_pt out = malloc(sizeof(*out));
-
-//	hessian_writeDouble(out, 12.25);
-//	hessian_writeUTCDate(out, 894621091000l);
-//	hessian_writeLong(out, 1324123l);
-//	hessian_writeString(out, "hello");
-	unsigned char b[22];
-	int i = 0;
-	b[i++] = 'a';b[i++] = 'b';b[i++] = 'c';b[i++] = 'd';b[i++] = 'e';b[i++] = 'f';b[i++] = 'g';b[i++] = 'h';b[i++] = 'i';b[i++] = 'j';b[i++] = 'k';
-	b[i++] = 'l';b[i++] = 'm';b[i++] = 'n';b[i++] = 'o';b[i++] = 'p';b[i++] = 'q';b[i++] = 'r';b[i++] = 's';b[i++] = 't';b[i++] = 'u';b[i++] = 'v';
-
-	hessian_writeBytes(out, b, 22);
-//	hessian_writeListBegin(out, 1, "string");
-//	hessian_writeString(out, "test");
-//	hessian_writeListEnd(out);
-
-	//4832798725635008448
-
-	double d = 81273459184.123;
-	char *langeString = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
-			"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz";
-
-//	printf("Stringl: %d\n", strlen(langeString));
-
-//	hessian_writeString(out, langeString);
-
-
-	for (i = 0; i < out->offset; i++) {
-		printf("%X ", out->buffer[i]);
-	}
-	printf("\n");
-
-
-	FILE *fp = fopen("mybinfile.ttt", "wb");
-
-	//the string length + 1 for the null terminator
-	fwrite(out->buffer, sizeof(char), out->offset, fp);
-
-	fclose(fp);
-
-	out->offset = 0;
-	unsigned char *rb = NULL;
-	int read;
-	rb = NULL;
-	hessian_readNBytes(out, 0, 10, &rb, &read);
-	printf("Read: %s\n", rb);
-	char ch;
-	hessian_readByte(out, &ch);
-	printf("Read: %c\n", ch);
-	hessian_readByte(out, &ch);
-		printf("Read: %c\n", ch);
-		hessian_readByte(out, &ch);
-			printf("Read: %c\n", ch);
-			hessian_readByte(out, &ch);
-				printf("Read: %c\n", ch);
-				rb = NULL;
-					hessian_readNBytes(out, 0, 10, &rb, &read);
-					printf("Read: %s\n", rb);
-	printf("Read: %d\n", read);
-}
-
diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt
index e1f9a9c..920d4c0 100644
--- a/launcher/CMakeLists.txt
+++ b/launcher/CMakeLists.txt
@@ -18,20 +18,22 @@
 if (LAUNCHER) 
     find_package(CURL REQUIRED)
 
-    SET(CMAKE_SKIP_BUILD_RPATH  FALSE) #TODO needed?
-    SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) #TODO needed?
-    SET(CMAKE_INSTALL_RPATH "${PROJECT_BINARY_DIR}/framework" "${PROJECT_BINARY_DIR}/utils")
-
     include_directories(public/include)
     
     add_executable(celix
         private/src/main
     )
+
+    set_target_properties(celix PROPERTIES "INSTALL_RPATH" "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
     
     target_link_libraries(celix celix_framework ${CURL_LIBRARIES})
+    if (NOT ANDROID)
+        target_link_libraries(celix celix_dfi) #note not strictly needed, but ensure libdfi is a dep for the framework, useful when create docker images
+    endif()
+
     include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
     include_directories("${PROJECT_SOURCE_DIR}/framework/public/include")
     include_directories("${CURL_INCLUDE_DIRS}")
     
-    install(TARGETS celix RUNTIME DESTINATION bin COMPONENT framework)
-endif (LAUNCHER) 
\ No newline at end of file
+    install(TARGETS celix RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT framework)
+endif (LAUNCHER) 
diff --git a/log_service/private/src/log.c b/log_service/private/src/log.c
index a6c3887..5b29318 100644
--- a/log_service/private/src/log.c
+++ b/log_service/private/src/log.c
@@ -252,8 +252,8 @@
 celix_status_t log_removeLogListener(log_pt logger, log_listener_pt listener) {
 	celix_status_t status = CELIX_SUCCESS;
 
-    status = CELIX_DO_IF(status, celixThreadMutex_lock(&logger->deliverLock));
-    status = CELIX_DO_IF(status, celixThreadMutex_lock(&logger->listenerLock));
+    status += celixThreadMutex_lock(&logger->deliverLock);
+    status += celixThreadMutex_lock(&logger->listenerLock);
 
 	if (status == CELIX_SUCCESS) {
 	    bool last = false;
@@ -264,11 +264,11 @@
 			last = true;
 		}
 
-        status = CELIX_DO_IF(status, celixThreadMutex_unlock(&logger->listenerLock));
-        status = CELIX_DO_IF(status, celixThreadMutex_unlock(&logger->deliverLock));
+        status += celixThreadMutex_unlock(&logger->listenerLock);
+        status += celixThreadMutex_unlock(&logger->deliverLock);
 
 		if (last) {
-		    status = CELIX_DO_IF(status, celixThread_join(logger->listenerThread, NULL));
+		    status += celixThread_join(logger->listenerThread, NULL);
 		}
 	}
 
diff --git a/log_service/private/src/log_entry.c b/log_service/private/src/log_entry.c
index 8870c3b..3a8603a 100644
--- a/log_service/private/src/log_entry.c
+++ b/log_service/private/src/log_entry.c
@@ -32,7 +32,7 @@
 #include "log_service.h"
 #include "log_entry.h"
 
-celix_status_t logEntry_create(long bundleId, char* bundleSymbolicName , service_reference_pt reference,
+celix_status_t logEntry_create(long bundleId, const char* bundleSymbolicName , service_reference_pt reference,
         log_level_t level, char *message, int errorCode,
         log_entry_pt *entry) {
     celix_status_t status = CELIX_SUCCESS;
@@ -63,7 +63,7 @@
     return CELIX_SUCCESS;
 }
 
-celix_status_t logEntry_getBundleSymbolicName(log_entry_pt entry, char **bundleSymbolicName) {
+celix_status_t logEntry_getBundleSymbolicName(log_entry_pt entry, const char** bundleSymbolicName) {
     *bundleSymbolicName = entry->bundleSymbolicName;
     return CELIX_SUCCESS;
 }
@@ -83,7 +83,7 @@
     return CELIX_SUCCESS;
 }
 
-celix_status_t logEntry_getMessage(log_entry_pt entry, char **message) {
+celix_status_t logEntry_getMessage(log_entry_pt entry, const char **message) {
     *message = entry->message;
     return CELIX_SUCCESS;
 }
diff --git a/log_service/private/src/log_reader_service_impl.c b/log_service/private/src/log_reader_service_impl.c
index cddb2a8..2a46ea7 100644
--- a/log_service/private/src/log_reader_service_impl.c
+++ b/log_service/private/src/log_reader_service_impl.c
@@ -39,7 +39,7 @@
 
     *reader = (log_reader_data_pt) calloc(1, sizeof(**reader));
 
-    if (reader == NULL) {
+    if (*reader == NULL) {
         status = CELIX_ENOMEM;
     } else {
         (*reader)->log = log;
diff --git a/log_service/private/src/log_service_activator.c b/log_service/private/src/log_service_activator.c
index ce3cbb7..8c72fb1 100644
--- a/log_service/private/src/log_service_activator.c
+++ b/log_service/private/src/log_service_activator.c
@@ -26,6 +26,7 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <constants.h>
 
 #include "bundle_activator.h"
 #include "log_service_impl.h"
@@ -107,7 +108,11 @@
 
     logFactory_create(activator->logger, &activator->factory);
 
-    bundleContext_registerServiceFactory(context, (char *) OSGI_LOGSERVICE_NAME, activator->factory, NULL, &activator->logServiceFactoryReg);
+	properties_pt props = properties_create();
+	properties_set(props, CELIX_FRAMEWORK_SERVICE_LANGUAGE, CELIX_FRAMEWORK_SERVICE_C_LANGUAGE);
+
+
+	bundleContext_registerServiceFactory(context, (char *) OSGI_LOGSERVICE_NAME, activator->factory, props, &activator->logServiceFactoryReg);
 
     logReaderService_create(activator->logger, &activator->reader);
 
@@ -118,7 +123,10 @@
     activator->reader_service->removeLogListener = logReaderService_removeLogListener;
     activator->reader_service->removeAllLogListener = logReaderService_removeAllLogListener;
 
-    bundleContext_registerService(context, (char *) OSGI_LOGSERVICE_READER_SERVICE_NAME, activator->reader_service, NULL, &activator->logReaderServiceReg);
+	props = properties_create();
+	properties_set(props, CELIX_FRAMEWORK_SERVICE_LANGUAGE, CELIX_FRAMEWORK_SERVICE_C_LANGUAGE);
+
+    bundleContext_registerService(context, (char *) OSGI_LOGSERVICE_READER_SERVICE_NAME, activator->reader_service, props, &activator->logReaderServiceReg);
 
     return status;
 }
@@ -158,7 +166,7 @@
 static celix_status_t bundleActivator_getMaxSize(struct logActivator *activator, int *max_size) {
 	celix_status_t status = CELIX_SUCCESS;
 
-	char *max_size_str = NULL;
+	const char *max_size_str = NULL;
 
 	*max_size = DEFAULT_MAX_SIZE;
 
@@ -173,7 +181,7 @@
 static celix_status_t bundleActivator_getStoreDebug(struct logActivator *activator, bool *store_debug) {
 	celix_status_t status = CELIX_SUCCESS;
 
-	char *store_debug_str = NULL;
+	const char *store_debug_str = NULL;
 
 	*store_debug = DEFAULT_STORE_DEBUG;
 
diff --git a/log_service/private/src/log_service_impl.c b/log_service/private/src/log_service_impl.c
index ad6313b..a77e9ad 100644
--- a/log_service/private/src/log_service_impl.c
+++ b/log_service/private/src/log_service_impl.c
@@ -66,7 +66,7 @@
     bundle_pt bundle = logger->bundle;
     bundle_archive_pt archive = NULL;
     module_pt module = NULL;
-    char *symbolicName = NULL;
+    const char *symbolicName = NULL;
     long bundleId = -1;
 
     if (reference != NULL) {
@@ -87,8 +87,10 @@
         }
     }
 
-    logEntry_create(bundleId, symbolicName, reference, level, message, 0, &entry);
-    log_addEntry(logger->log, entry);
+    if(status == CELIX_SUCCESS && symbolicName != NULL && message != NULL){
+	status = logEntry_create(bundleId, symbolicName, reference, level, message, 0, &entry);
+	log_addEntry(logger->log, entry);
+    }
 
-    return CELIX_SUCCESS;
+    return status;
 }
diff --git a/log_service/public/include/log_entry.h b/log_service/public/include/log_entry.h
index b5b9c7e..e588774 100644
--- a/log_service/public/include/log_entry.h
+++ b/log_service/public/include/log_entry.h
@@ -41,15 +41,15 @@
 
 typedef struct log_entry * log_entry_pt;
 
-celix_status_t logEntry_create(long bundleId, char* bundleSymbolicName , service_reference_pt reference,
+celix_status_t logEntry_create(long bundleId, const char* bundleSymbolicName , service_reference_pt reference,
         log_level_t level, char *message, int errorCode,
         log_entry_pt *entry);
 celix_status_t logEntry_destroy(log_entry_pt *entry);
-celix_status_t logEntry_getBundleSymbolicName(log_entry_pt entry, char **bundleSymbolicName);
+celix_status_t logEntry_getBundleSymbolicName(log_entry_pt entry, const char** bundleSymbolicName);
 celix_status_t logEntry_getBundleId(log_entry_pt entry, long *bundleId);
 celix_status_t logEntry_getErrorCode(log_entry_pt entry, int *errorCode);
 celix_status_t logEntry_getLevel(log_entry_pt entry, log_level_t *level);
-celix_status_t logEntry_getMessage(log_entry_pt entry, char **message);
+celix_status_t logEntry_getMessage(log_entry_pt entry, const char** message);
 celix_status_t logEntry_getTime(log_entry_pt entry, time_t *time);
 
 #endif /* LOG_ENTRY_H_ */
diff --git a/log_service/public/include/log_listener.h b/log_service/public/include/log_listener.h
index 6d13d9e..b726994 100644
--- a/log_service/public/include/log_listener.h
+++ b/log_service/public/include/log_listener.h
@@ -35,7 +35,8 @@
     celix_status_t (*logged)(struct log_listener *listener, log_entry_pt entry);
 };
 
-typedef struct log_listener * log_listener_pt;
+typedef struct log_listener log_listener_t;
+typedef log_listener_t* log_listener_pt;
 
 celix_status_t logListener_logged(log_listener_pt listener, log_entry_pt entry);
 
diff --git a/log_service/public/include/log_reader_service.h b/log_service/public/include/log_reader_service.h
index 538f0d2..6815123 100644
--- a/log_service/public/include/log_reader_service.h
+++ b/log_service/public/include/log_reader_service.h
@@ -34,7 +34,8 @@
 
 static const char * const OSGI_LOGSERVICE_READER_SERVICE_NAME = "log_reader_service";
 
-typedef struct log_reader_data * log_reader_data_pt;
+typedef struct log_reader_data log_reader_data_t;
+typedef log_reader_data_t* log_reader_data_pt;
 
 struct log_reader_service {
     log_reader_data_pt reader;
diff --git a/log_service/public/include/log_service.h b/log_service/public/include/log_service.h
index cd3fdef..2691e35 100644
--- a/log_service/public/include/log_service.h
+++ b/log_service/public/include/log_service.h
@@ -50,7 +50,8 @@
     celix_status_t (*logSr)(log_service_data_pt logger, service_reference_pt reference, log_level_t level, char * message);
 };
 
-typedef struct log_service *log_service_pt;
+typedef struct log_service log_service_t;
+typedef log_service_t* log_service_pt;
 
 
 
diff --git a/log_service/public/src/log_helper.c b/log_service/public/src/log_helper.c
index 91554a9..7fcb172 100644
--- a/log_service/public/src/log_helper.c
+++ b/log_service/public/src/log_helper.c
@@ -64,7 +64,7 @@
 	}
 	else
 	{
-		char* stdOutFallbackStr = NULL;
+		const char* stdOutFallbackStr = NULL;
 		(*loghelper)->bundleContext = context;
 		(*loghelper)->logServiceTracker = NULL;
 		(*loghelper)->stdOutFallback = false;
@@ -162,27 +162,25 @@
     msg[0] = '\0';
     bool logged = false;
 
+    if(loghelper == NULL){
+	return CELIX_ILLEGAL_ARGUMENT;
+    }
+
 	va_start(listPointer, message);
 	vsnprintf(msg, 1024, message, listPointer);
 
-	if (loghelper != NULL) {
-		pthread_mutex_lock(&loghelper->logListLock);
+	pthread_mutex_lock(&loghelper->logListLock);
 
-		int i = 0;
-
-		for (; i < arrayList_size(loghelper->logServices); i++) {
-
-			log_service_pt logService = arrayList_get(loghelper->logServices, i);
-
-			if (logService != NULL) {
-				(logService->log)(logService->logger, level, msg);
-				logged = true;
-			}
+	int i = 0;
+	for (; i < arrayList_size(loghelper->logServices); i++) {
+		log_service_pt logService = arrayList_get(loghelper->logServices, i);
+		if (logService != NULL) {
+			(logService->log)(logService->logger, level, msg);
+			logged = true;
 		}
-
-		pthread_mutex_unlock(&loghelper->logListLock);
 	}
 
+	pthread_mutex_unlock(&loghelper->logListLock);
 
     if (!logged && loghelper->stdOutFallback) {
         char *levelStr = NULL;
@@ -206,6 +204,7 @@
         printf("%s: %s\n", levelStr, msg);
     }
 
+    va_end(listPointer);
 
 	return status;
 }
diff --git a/rat-excludes.txt b/rat-excludes.txt
index b9109e8..45c1e75 100644
--- a/rat-excludes.txt
+++ b/rat-excludes.txt
@@ -30,10 +30,6 @@
    
  Todo: Why doesn't RAT exclude these files when using a full path?
 
-cmake/config.properties.in
-cmake/run.sh.in
-cmake/RunConfig.in
-
 Doxyfile.in
 
  Workaround to exclude .in files.
diff --git a/remote_services/README.md b/remote_services/README.md
index 669f3c4..2afcb81 100644
--- a/remote_services/README.md
+++ b/remote_services/README.md
@@ -1,8 +1,149 @@
-## Remote Services
+Title: Apache Celix Remote Service Admin Service
 
-Celix Remote Services contains several implementations of the OSGi Remote Services and Enterprise Remote Service Admin Service Specification:
+## Introduction
 
-* **Remote Service Admin** implements functionality to import/export services through a set of configuration types. The Remote Service Admin service is a passive Distribution Provider, not taking any action to export or import itself.
-* **Topology Manager** provides the policy for importing and exporting services
-through the Remote Service Admin service.
-* **Discovery** provides detection of exported services through some discovery protocol.
+The Remote Service Admin Service subproject contains an adapted implementation of the OSGi Enterprise Remote Service Admin Service Specification. The subproject consists of three parts, each described in more detail in the following sections.
+
+### Topology Manager
+
+The topology manager decides which services should be imported and exported according to a defined policy. Currently, only one policy is implemented in Celix, the *promiscuous* policy, which simply imports and exports all services.
+
+| **Bundle** | `topology_manager.zip` |
+|--|--|
+| **Configuration** | *None* |
+
+### Remote Service Admin
+
+The Remote Service Admin (RSA) provides the mechanisms to import and export services when instructed to do so by the Topology Manager. 
+
+#### Endpoints and proxies
+
+To delegate a *received* method call to the actual service implementation, the RSA uses an "endpoint" bundle, which has all the knowledge about the marshalling and unmarshalling of data for the service. This endpoint bundle is specific to the used RSA implementation, and as such cannot be reused between various RSA implementations.
+
+Invoking a *remote* method is done by using "proxy" bundles. Similar as to endpoints, proxy bundles encapsulate all knowledge to marshall and unmarshall data for a remote method call and as such can not be shared between RSA implementations.
+
+Both proxy and endpoint bundles are loaded on demand when a service is imported or exported by the RSA. As such, these bundles **must** not be added to the list of "auto started" bundles, but placed in a separate location. By default, `endpoints` is used as location for locating proxy and/or endpoint bundles.
+
+Note that since endpoints and proxies need to be created manually, one has full control about the handling of specifics of marshalling and unmarshalling data and dealing with exceptions. 
+
+#### HTTP/JSON
+
+Provides a RSA implementation that uses JSON to marshal requests and HTTP as transport mechanism for its remote method invocation. It is compatible with the *Remote Service Admin HTTP* implementation provided by [Amdatu Remote](https://amdatu.atlassian.net/wiki/display/AMDATUDEV/Amdatu+Remote).
+
+| **Bundle** | `remote_service_admin_http.zip` |
+|--|--|
+| **Configuration** | `RSA_PORT`: defines the port on which the HTTP server should listen for incoming requests. Defaults to port `8888`; |
+| | `ENDPOINTS`: defines the location in which service endpoints and/or proxies can be found. Defaults to `endpoints` in the current working directory |
+
+#### Shared memory (SHM)
+
+Provides a RSA implementation that uses shared memory for its remote method invocation. Note that this only works when all remote services are located on the same machine.
+
+| **Bundle** | `remote_service_admin_shm.zip` |
+|--|--|
+| **Configuration** | `ENDPOINTS`: defines the location in which service endpoints and/or proxies can be found. Defaults to `endpoints` in the current working directory |
+
+### Discovery
+
+Actively discovers the presence of remote exported services and provides information about local exported services, as given by the Topology Manager, to others.
+
+#### Shared memory (SHM) based discovery
+
+Provides service discovery for the RSA SHM implementation.
+
+| **Bundle** | `discovery_shm.zip` |
+|--|--|
+| **Configuration** | *None* |
+
+#### Configured discovery
+
+Provides a service discovery with preconfigured discovery endpoints, allowing a static mesh of nodes for remote service invocation to be created. The configured discovery bundle in Celix is compatible with the configured discovery implementation provided by [Amdatu Remote](https://amdatu.atlassian.net/wiki/display/AMDATUDEV/Amdatu+Remote).
+
+| **Bundle** | `discovery_configured.zip` |
+|--|--|
+| **Configuration** | `DISCOVERY_CFG_POLL_ENDPOINTS`: defines a comma-separated list of discovery endpoints that should be used to query for remote services. Defaults to `http://localhost:9999/org.apache.celix.discovery.configured`; |
+| | `DISCOVERY_CFG_POLL_INTERVAL`: defines the interval (in seconds) in which the discovery endpoints should be polled. Defaults to `10` seconds. |
+| | `DISCOVERY_CFG_SERVER_PORT`: defines the port on which the HTTP server should listen for incoming requests from other configured discovery endpoints. Defaults to port `9999`; |
+| | `DISCOVERY_CFG_SERVER_PATH`: defines the path on which the HTTP server should accept requests from other configured discovery endpoints. Defaults to `/org.apache.celix.discovery.configured`. |
+
+Note that for configured discovery, the "Endpoint Description Extender" XML format defined in the OSGi Remote Service Admin specification (section 122.8 of OSGi Enterprise 5.0.0) is used.
+
+See [etcd discovery](discovery_etcd/README.md)
+
+#### etcd discovery 
+
+| **Bundle** | `discovery_etcd.zip` |
+
+Provides a service discovery using etcd distributd key/value store. 
+
+See [etcd discovery](discovery_etcd/README.md)
+
+## Usage
+
+To develop for the Remote Service Admin implementation of Celix, one needs the following:
+
+1. A service **interface**, describes the actual service and methods[^1] that can be called. The service interface is needed at development time to allow a consistent definition;
+2. A service **implementation**, when exporting it as remote service. A service endpoint is needed to delegate remote requests to your service implementation;
+3. A service **endpoint**, which will be installed by Celix when exporting a local service. The endpoint is responsible for calling the actual Celix service. Endpoint bundles are not needed when *only* importing services in Celix;
+4. A service **proxy**, which will be installed by Celix when importing a remote service. The proxy is responsible for marshalling and unmarshalling method invocations. Proxy bundles are not needed when *only* exposing services from Celix;
+5. A service **client** or user, which invokes methods on the local or remote service. The client is oblivious to the fact whether the service is running locally or remote.
+
+The Celix source repository provides a simple calculator example that shows all of the described parts:
+
+1. [The calculator service interface](http://svn.apache.org/repos/asf/celix/trunk/remote_services/calculator_service/public/include/calculator_service.h), providing three methods: one for adding two numbers, one for subtracting two numbers, and lastly, a method that calculates the square root of a number;
+2. [A calculator service implementation](http://svn.apache.org/repos/asf/celix/trunk/remote_services/calculator_service/private/src/calculator_impl.c) that simply implements the three previously described functions. To mark this service as "remote service", you need to add the `service.exported.interfaces` service property to its service registration. This way, the RSA implementation can expose it as remote service to others;
+3. [A service endpoint](http://svn.apache.org/repos/asf/celix/trunk/remote_services/calculator_endpoint/private/src/calculator_endpoint_impl.c), which is called by the RSA implementation to delegate a method invocation to an actual method in the service implementation. The service endpoint should be registered as `remote_endpoint` service, along with the `remote.interface` service property denoting which service interface this endpoint is capable of handling;
+4. [A service proxy (factory)](http://svn.apache.org/repos/asf/celix/trunk/remote_services/calculator_proxy/private/src/calculator_proxy_impl.c), called by the service client when it wants to invoke a method on a remoted service. The service proxy should be registered as `remote_proxy_factory` service along with the `proxy.interface` service property denoting which service interface the service proxy is capable of handling;
+5. [A service client](http://svn.apache.org/repos/asf/celix/trunk/remote_services/calculator_shell/private/src/add_command.c), that exposes the three calculator methods to as Celix shell commands. The implementation simply retrieves the calculator service as it would do with any other Celix service.
+
+If you have access to the Celix source repository, you can run the calculator example using various discovery implementations by invoking the `deploy` target. You can find the example deployments in the `CELIX_BUILD/deploy` directory. For example, to run the calculator example using the configured discovery mechanism, you should open two terminals. In the first terminal, type:
+
+    remote-service-cfg$ export RSA_PORT=18888
+    remote-service-cfg$ sh run.sh
+    ...
+    RSA: Export services (org.apache.celix.calc.api.Calculator)
+    ...
+    -> _
+
+In the second terminal, type:
+
+    remote-service-cfg-client$ export RSA_PORT=28888
+    remote-service-cfg-client$ sh run.sh
+    ...
+    RSA: Import service org.apache.celix.calc.api.Calculator
+    ...
+    -> _
+
+Now, if all went well, the client (second terminal) has three new shell commands, `add`, `sub` and `sqrt`, which you can use to invoke the calculator service:
+
+    -> add 3 5
+    CALCULATOR_SHELL: Add: 3.000000 + 5.000000 = 8.000000
+    -> _
+
+On the server side (first terminal), you can follow each invocation as well:
+
+    CALCULATOR_ENDPOINT: Handle request "add(DD)D" with data "{"m": "add(DD)D", "a": [3.0, 5.0]}"
+    CALCULATOR: Add: 3.000000 + 5.000000 = 8.000000
+
+Note that the `RSA_PORT` property needs to be unique for at least the client in order to communicate correctly when running the examples on the same machine. 
+
+## Building
+
+To build the Remote Service Admin Service the CMake build option "`BUILD_REMOTE_SERVICE_ADMIN`" has to be enabled.
+
+## Dependencies
+
+The Remote Service Admin Service depends on the following subprojects:
+
+- Framework
+- Utils
+
+Also the following libraries are required for building and/or using the Remote Service Admin Service subproject:
+
+- Jansson (build and runtime)
+- cURL (build and runtime)
+
+
+## Notes
+
+[^1]: Although C does not use the term "method", we use this term to align with the terminology used in the RSA specification. 
diff --git a/remote_services/discovery/private/include/discovery.h b/remote_services/discovery/private/include/discovery.h
index 9695a3c..ee79caf 100644
--- a/remote_services/discovery/private/include/discovery.h
+++ b/remote_services/discovery/private/include/discovery.h
@@ -38,6 +38,7 @@
 #define DISCOVERY_SERVER_PORT 		"DISCOVERY_CFG_SERVER_PORT"
 #define DISCOVERY_SERVER_PATH 		"DISCOVERY_CFG_SERVER_PATH"
 #define DISCOVERY_POLL_ENDPOINTS 	"DISCOVERY_CFG_POLL_ENDPOINTS"
+#define DISCOVERY_SERVER_MAX_EP	"DISCOVERY_CFG_SERVER_MAX_EP"
 
 typedef struct discovery *discovery_pt;
 
diff --git a/remote_services/discovery/private/src/discovery.c b/remote_services/discovery/private/src/discovery.c
index e2415b4..e40a887 100644
--- a/remote_services/discovery/private/src/discovery.c
+++ b/remote_services/discovery/private/src/discovery.c
@@ -70,10 +70,10 @@
 	celix_status_t status = CELIX_SUCCESS;
 	discovery_pt discovery = handle;
 
-	char *discoveryListener = NULL;
+	const char *discoveryListener = NULL;
 	serviceReference_getProperty(reference, "DISCOVERY", &discoveryListener);
-	char *scope = NULL;
-	serviceReference_getProperty(reference, (char *) OSGI_ENDPOINT_LISTENER_SCOPE, &scope);
+	const char *scope = NULL;
+	serviceReference_getProperty(reference, OSGI_ENDPOINT_LISTENER_SCOPE, &scope);
 
 	filter_pt filter = filter_create(scope);
 
@@ -157,8 +157,8 @@
                 service_reference_pt reference = hashMapEntry_getKey(entry);
                 endpoint_listener_pt listener = NULL;
 
-                char *scope = NULL;
-                serviceReference_getProperty(reference, (char *) OSGI_ENDPOINT_LISTENER_SCOPE, &scope);
+                const char* scope = NULL;
+                serviceReference_getProperty(reference, OSGI_ENDPOINT_LISTENER_SCOPE, &scope);
 
                 filter_pt filter = filter_create(scope);
                 bool matchResult = false;
@@ -170,11 +170,11 @@
                         if (endpointAdded) {
                             logHelper_log(discovery->loghelper, OSGI_LOGSERVICE_INFO, "Adding service (%s)", endpoint->service);
 
-                            listener->endpointAdded(listener->handle, endpoint, scope);
+                            listener->endpointAdded(listener->handle, endpoint, (char*)scope);
                         } else {
                             logHelper_log(discovery->loghelper, OSGI_LOGSERVICE_INFO, "Removing service (%s)", endpoint->service);
 
-                            listener->endpointRemoved(listener->handle, endpoint, scope);
+                            listener->endpointRemoved(listener->handle, endpoint, (char*)scope);
                         }
                     }
 
diff --git a/remote_services/discovery/private/src/discovery_activator.c b/remote_services/discovery/private/src/discovery_activator.c
index 95e23df..3267d25 100644
--- a/remote_services/discovery/private/src/discovery_activator.c
+++ b/remote_services/discovery/private/src/discovery_activator.c
@@ -38,147 +38,149 @@
 #include "remote_constants.h"
 
 struct activator {
-    bundle_context_pt context;
-    discovery_pt discovery;
-    log_helper_pt loghelper;
+	bundle_context_pt context;
+	discovery_pt discovery;
+	log_helper_pt loghelper;
 
-    service_tracker_pt endpointListenerTracker;
-    endpoint_listener_pt endpointListener;
-    service_registration_pt endpointListenerService;
+	service_tracker_pt endpointListenerTracker;
+	endpoint_listener_pt endpointListener;
+	service_registration_pt endpointListenerService;
 };
 
 celix_status_t bundleActivator_createEPLTracker(struct activator *activator, service_tracker_pt *tracker) {
-    celix_status_t status;
+	celix_status_t status;
 
-    service_tracker_customizer_pt customizer = NULL;
+	service_tracker_customizer_pt customizer = NULL;
 
-    status = serviceTrackerCustomizer_create(activator->discovery, discovery_endpointListenerAdding, discovery_endpointListenerAdded, discovery_endpointListenerModified,
-            discovery_endpointListenerRemoved, &customizer);
+	status = serviceTrackerCustomizer_create(activator->discovery, discovery_endpointListenerAdding, discovery_endpointListenerAdded, discovery_endpointListenerModified,
+			discovery_endpointListenerRemoved, &customizer);
 
-    if (status == CELIX_SUCCESS) {
-        status = serviceTracker_create(activator->context, (char *) OSGI_ENDPOINT_LISTENER_SERVICE, customizer, tracker);
-    }
+	if (status == CELIX_SUCCESS) {
+		status = serviceTracker_create(activator->context, (char *) OSGI_ENDPOINT_LISTENER_SERVICE, customizer, tracker);
+	}
 
-    return status;
+	return status;
 }
 
 celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
-    celix_status_t status;
+	celix_status_t status;
 
-    struct activator* activator = malloc(sizeof(struct activator));
-    if (!activator) {
-        return CELIX_ENOMEM;
-    }
+	struct activator* activator = calloc(1,sizeof(struct activator));
+	if (!activator) {
+		return CELIX_ENOMEM;
+	}
 
-    status = discovery_create(context, &activator->discovery);
-    if (status != CELIX_SUCCESS) {
-        return status;
-    }
+	status = discovery_create(context, &activator->discovery);
+	if (status == CELIX_SUCCESS) {
+		activator->context = context;
 
-    activator->context = context;
-    activator->endpointListenerTracker = NULL;
-    activator->endpointListener = NULL;
-    activator->endpointListenerService = NULL;
+		logHelper_create(context, &activator->loghelper);
 
-    logHelper_create(context, &activator->loghelper);
+		status = bundleActivator_createEPLTracker(activator, &activator->endpointListenerTracker);
+		if(status==CELIX_SUCCESS){
+			*userData = activator;
+		}
+		else{
+			bundleActivator_destroy(activator,context);
+		}
+	}
+	else{
+		free(activator);
+	}
 
-    status = bundleActivator_createEPLTracker(activator, &activator->endpointListenerTracker);
-
-    *userData = activator;
-
-    return status;
+	return status;
 }
 
 celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
-    celix_status_t status;
-    struct activator *activator = userData;
-    char *uuid = NULL;
+	celix_status_t status;
+	struct activator *activator = userData;
+	const char *uuid = NULL;
 
-    logHelper_start(activator->loghelper);
+	logHelper_start(activator->loghelper);
 
-    status = bundleContext_getProperty(context, OSGI_FRAMEWORK_FRAMEWORK_UUID, &uuid);
-    if (!uuid) {
-        logHelper_log(activator->loghelper, OSGI_LOGSERVICE_DEBUG, "no framework UUID defined?!");
-        return CELIX_ILLEGAL_STATE;
-    }
+	status = bundleContext_getProperty(context, OSGI_FRAMEWORK_FRAMEWORK_UUID, &uuid);
+	if (!uuid) {
+		logHelper_log(activator->loghelper, OSGI_LOGSERVICE_DEBUG, "no framework UUID defined?!");
+		return CELIX_ILLEGAL_STATE;
+	}
 
-    size_t len = 11 + strlen(OSGI_FRAMEWORK_OBJECTCLASS) + strlen(OSGI_RSA_ENDPOINT_FRAMEWORK_UUID) + strlen(uuid);
-    char *scope = malloc(len + 1);
-    if (!scope) {
-        return CELIX_ENOMEM;
-    }
+	size_t len = 11 + strlen(OSGI_FRAMEWORK_OBJECTCLASS) + strlen(OSGI_RSA_ENDPOINT_FRAMEWORK_UUID) + strlen(uuid);
+	char *scope = malloc(len + 1);
+	if (!scope) {
+		return CELIX_ENOMEM;
+	}
 
-    sprintf(scope, "(&(%s=*)(%s=%s))", OSGI_FRAMEWORK_OBJECTCLASS, OSGI_RSA_ENDPOINT_FRAMEWORK_UUID, uuid);
-    scope[len] = 0;
+	sprintf(scope, "(&(%s=*)(%s=%s))", OSGI_FRAMEWORK_OBJECTCLASS, OSGI_RSA_ENDPOINT_FRAMEWORK_UUID, uuid);
+	scope[len] = 0;
 
-    logHelper_log(activator->loghelper, OSGI_LOGSERVICE_DEBUG, "using scope %s.", scope);
+	logHelper_log(activator->loghelper, OSGI_LOGSERVICE_DEBUG, "using scope %s.", scope);
 
-    properties_pt props = properties_create();
-    properties_set(props, "DISCOVERY", "true");
-    properties_set(props, (char *) OSGI_ENDPOINT_LISTENER_SCOPE, scope);
+	properties_pt props = properties_create();
+	properties_set(props, "DISCOVERY", "true");
+	properties_set(props, (char *) OSGI_ENDPOINT_LISTENER_SCOPE, scope);
 
-    if (status == CELIX_SUCCESS) {
-        status = serviceTracker_open(activator->endpointListenerTracker);
-    }
+	if (status == CELIX_SUCCESS) {
+		status = serviceTracker_open(activator->endpointListenerTracker);
+	}
 
-    if (status == CELIX_SUCCESS) {
-        status = discovery_start(activator->discovery);
-    }
+	if (status == CELIX_SUCCESS) {
+		status = discovery_start(activator->discovery);
+	}
 
-    if (status == CELIX_SUCCESS) {
-        endpoint_listener_pt endpointListener = calloc(1, sizeof(struct endpoint_listener));
+	if (status == CELIX_SUCCESS) {
+		endpoint_listener_pt endpointListener = calloc(1, sizeof(struct endpoint_listener));
 
-        if (endpointListener) {
-            endpointListener->handle = activator->discovery;
-            endpointListener->endpointAdded = discovery_endpointAdded;
-            endpointListener->endpointRemoved = discovery_endpointRemoved;
+		if (endpointListener) {
+			endpointListener->handle = activator->discovery;
+			endpointListener->endpointAdded = discovery_endpointAdded;
+			endpointListener->endpointRemoved = discovery_endpointRemoved;
 
-            status = bundleContext_registerService(context, (char *) OSGI_ENDPOINT_LISTENER_SERVICE, endpointListener, props, &activator->endpointListenerService);
+			status = bundleContext_registerService(context, (char *) OSGI_ENDPOINT_LISTENER_SERVICE, endpointListener, props, &activator->endpointListenerService);
 
-            if (status == CELIX_SUCCESS) {
-                activator->endpointListener = endpointListener;
-            }
-        }
-    }
-    // We can release the scope, as properties_set makes a copy of the key & value...
-    free(scope);
+			if (status == CELIX_SUCCESS) {
+				activator->endpointListener = endpointListener;
+			}
+		}
+	}
+	// We can release the scope, as properties_set makes a copy of the key & value...
+	free(scope);
 
-    return status;
+	return status;
 }
 
 celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
-    celix_status_t status;
-    struct activator *activator = userData;
+	celix_status_t status;
+	struct activator *activator = userData;
 
-    status = discovery_stop(activator->discovery);
+	status = discovery_stop(activator->discovery);
 
-    status = serviceTracker_close(activator->endpointListenerTracker);
+	status = serviceTracker_close(activator->endpointListenerTracker);
 
-    status = serviceRegistration_unregister(activator->endpointListenerService);
-    free(activator->endpointListener);
+	status = serviceRegistration_unregister(activator->endpointListenerService);
+	free(activator->endpointListener);
 
-    logHelper_stop(activator->loghelper);
+	logHelper_stop(activator->loghelper);
 
-    return status;
+	return status;
 }
 
 celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
-    celix_status_t status;
-    struct activator *activator = userData;
+	celix_status_t status;
+	struct activator *activator = userData;
 
-    status = serviceTracker_destroy(activator->endpointListenerTracker);
+	status = serviceTracker_destroy(activator->endpointListenerTracker);
 
-    status = discovery_destroy(activator->discovery);
+	status = discovery_destroy(activator->discovery);
 
-    logHelper_destroy(&activator->loghelper);
+	logHelper_destroy(&activator->loghelper);
 
-    activator->loghelper = NULL;
-    activator->endpointListenerTracker = NULL;
-    activator->endpointListenerService = NULL;
-    activator->discovery = NULL;
-    activator->context = NULL;
+	activator->loghelper = NULL;
+	activator->endpointListenerTracker = NULL;
+	activator->endpointListenerService = NULL;
+	activator->discovery = NULL;
+	activator->context = NULL;
 
-    free(activator);
+	free(activator);
 
-    return status;
+	return status;
 }
diff --git a/remote_services/discovery/private/src/endpoint_descriptor_reader.c b/remote_services/discovery/private/src/endpoint_descriptor_reader.c
index 2f30d9e..d8139bc 100644
--- a/remote_services/discovery/private/src/endpoint_descriptor_reader.c
+++ b/remote_services/discovery/private/src/endpoint_descriptor_reader.c
@@ -203,8 +203,9 @@
                 } else if (xmlStrcmp(localname, ENDPOINT_DESCRIPTION) == 0) {
                     endpoint_description_pt endpointDescription = NULL;
                     // Completely parsed endpoint description, add it to our list of results...
-                    endpointDescription_create(endpointProperties, &endpointDescription);
-                    arrayList_add(endpointDescriptions, endpointDescription);
+                    if(endpointDescription_create(endpointProperties, &endpointDescription) == CELIX_SUCCESS){
+			arrayList_add(endpointDescriptions, endpointDescription);
+                    }
 
                     endpointProperties = properties_create();
                 } else if (xmlStrcmp(localname, PROPERTY) == 0) {
@@ -357,7 +358,7 @@
 		printf("\nEndpoint description #%d:\n", (i+1));
 		endpoint_description_pt edp = arrayList_get(list, i);
 		printf("Id: %s\n", edp->id);
-		printf("Service Id: %ld\n", edp->serviceId);
+		printf("Service Id: %lu\n", edp->serviceId);
 		printf("Framework UUID: %s\n", edp->frameworkUUID);
 		printf("Service: %s\n", edp->service);
 
diff --git a/remote_services/discovery/private/src/endpoint_discovery_poller.c b/remote_services/discovery/private/src/endpoint_discovery_poller.c
index b6e8455..0abbded 100644
--- a/remote_services/discovery/private/src/endpoint_discovery_poller.c
+++ b/remote_services/discovery/private/src/endpoint_discovery_poller.c
@@ -47,39 +47,39 @@
 static void *endpointDiscoveryPoller_performPeriodicPoll(void *data);
 celix_status_t endpointDiscoveryPoller_poll(endpoint_discovery_poller_pt poller, char *url, array_list_pt currentEndpoints);
 static celix_status_t endpointDiscoveryPoller_getEndpoints(endpoint_discovery_poller_pt poller, char *url, array_list_pt *updatedEndpoints);
-static celix_status_t endpointDiscoveryPoller_endpointDescriptionEquals(void *endpointPtr, void *comparePtr, bool *equals);
+static celix_status_t endpointDiscoveryPoller_endpointDescriptionEquals(const void *endpointPtr, const void *comparePtr, bool *equals);
 
 /**
  * Allocates memory and initializes a new endpoint_discovery_poller instance.
  */
 celix_status_t endpointDiscoveryPoller_create(discovery_pt discovery, bundle_context_pt context, endpoint_discovery_poller_pt *poller) {
-    celix_status_t status;
+	celix_status_t status;
 
-    *poller = malloc(sizeof(struct endpoint_discovery_poller));
-    if (!*poller) {
-        return CELIX_ENOMEM;
-    }
+	*poller = malloc(sizeof(struct endpoint_discovery_poller));
+	if (!*poller) {
+		return CELIX_ENOMEM;
+	}
 
-    (*poller)->loghelper = &discovery->loghelper;
+	(*poller)->loghelper = &discovery->loghelper;
 
 	status = celixThreadMutex_create(&(*poller)->pollerLock, NULL);
 	if (status != CELIX_SUCCESS) {
 		return status;
 	}
 
-	char* interval = NULL;
+	const char* interval = NULL;
 	status = bundleContext_getProperty(context, DISCOVERY_POLL_INTERVAL, &interval);
 	if (!interval) {
 		interval = DEFAULT_POLL_INTERVAL;
 	}
 
-	char* endpoints = NULL;
-	status = bundleContext_getProperty(context, DISCOVERY_POLL_ENDPOINTS, &endpoints);
-	if (!endpoints) {
-		endpoints = DEFAULT_POLL_ENDPOINTS;
+	const char* endpointsProp = NULL;
+	status = bundleContext_getProperty(context, DISCOVERY_POLL_ENDPOINTS, &endpointsProp);
+	if (!endpointsProp) {
+		endpointsProp = DEFAULT_POLL_ENDPOINTS;
 	}
 	// we're going to mutate the string with strtok, so create a copy...
-	endpoints = strdup(endpoints);
+	char* endpoints = strdup(endpointsProp);
 
 	(*poller)->poll_interval = atoi(interval);
 	(*poller)->discovery = discovery;
@@ -96,35 +96,34 @@
 	// Clean up after ourselves...
 	free(endpoints);
 
-    status = celixThreadMutex_lock(&(*poller)->pollerLock);
-    if (status != CELIX_SUCCESS) {
-        return CELIX_BUNDLE_EXCEPTION;
-    }
+	status = celixThreadMutex_lock(&(*poller)->pollerLock);
+	if (status != CELIX_SUCCESS) {
+		return CELIX_BUNDLE_EXCEPTION;
+	}
 
 	(*poller)->running = true;
 
-	status = celixThread_create(&(*poller)->pollerThread, NULL, endpointDiscoveryPoller_performPeriodicPoll, *poller);
-	if (status != CELIX_SUCCESS) {
-		return status;
+	status += celixThread_create(&(*poller)->pollerThread, NULL, endpointDiscoveryPoller_performPeriodicPoll, *poller);
+	status += celixThreadMutex_unlock(&(*poller)->pollerLock);
+
+	if(status != CELIX_SUCCESS){
+		status = CELIX_BUNDLE_EXCEPTION;
 	}
 
-
-    status = celixThreadMutex_unlock(&(*poller)->pollerLock);
-
-    return status;
+	return status;
 }
 
 /**
  * Destroys and frees up memory for a given endpoint_discovery_poller struct.
  */
 celix_status_t endpointDiscoveryPoller_destroy(endpoint_discovery_poller_pt poller) {
-    celix_status_t status;
+	celix_status_t status;
 
-    poller->running = false;
+	poller->running = false;
 
-    celixThread_join(poller->pollerThread, NULL);
+	celixThread_join(poller->pollerThread, NULL);
 
-    hash_map_iterator_pt iterator = hashMapIterator_create(poller->entries);
+	hash_map_iterator_pt iterator = hashMapIterator_create(poller->entries);
 	while (hashMapIterator_hasNext(iterator)) {
 		hash_map_entry_pt entry = hashMapIterator_nextEntry(iterator);
 
@@ -143,32 +142,32 @@
 
 	hashMap_destroy(poller->entries, true, false);
 
-    status = celixThreadMutex_unlock(&poller->pollerLock);
+	status = celixThreadMutex_unlock(&poller->pollerLock);
 
-    poller->loghelper = NULL;
+	poller->loghelper = NULL;
 
-    free(poller);
+	free(poller);
 
 	return status;
 }
 
 
 celix_status_t endpointDiscoveryPoller_getDiscoveryEndpoints(endpoint_discovery_poller_pt poller, array_list_pt urls) {
-    celixThreadMutex_lock(&(poller)->pollerLock);
+	celixThreadMutex_lock(&(poller)->pollerLock);
 
-    hash_map_iterator_pt iterator = hashMapIterator_create(poller->entries);
+	hash_map_iterator_pt iterator = hashMapIterator_create(poller->entries);
 
-    while(hashMapIterator_hasNext(iterator))  {
-        hash_map_entry_pt entry = hashMapIterator_nextEntry(iterator);
-        char* toAdd = strdup((char*) hashMapEntry_getKey(entry));
-        arrayList_add(urls, toAdd);
-    }
+	while(hashMapIterator_hasNext(iterator))  {
+		hash_map_entry_pt entry = hashMapIterator_nextEntry(iterator);
+		char* toAdd = strdup((char*) hashMapEntry_getKey(entry));
+		arrayList_add(urls, toAdd);
+	}
 
-    hashMapIterator_destroy(iterator);
+	hashMapIterator_destroy(iterator);
 
-    celixThreadMutex_unlock(&(poller)->pollerLock);
+	celixThreadMutex_unlock(&(poller)->pollerLock);
 
-    return CELIX_SUCCESS;
+	return CELIX_SUCCESS;
 }
 
 /**
@@ -219,14 +218,13 @@
 
 			array_list_pt entries = hashMap_remove(poller->entries, url);
 
-			for (unsigned int i = arrayList_size(entries); i > 0; i--) {
-				endpoint_description_pt endpoint = arrayList_get(entries, i - 1);
-				discovery_removeDiscoveredEndpoint(poller->discovery, endpoint);
-				arrayList_remove(entries, i - 1);
-				endpointDescription_destroy(endpoint);
-			}
-
 			if (entries != NULL) {
+				for (unsigned int i = arrayList_size(entries); i > 0; i--) {
+					endpoint_description_pt endpoint = arrayList_get(entries, i - 1);
+					discovery_removeDiscoveredEndpoint(poller->discovery, endpoint);
+					arrayList_remove(entries, i - 1);
+					endpointDescription_destroy(endpoint);
+				}
 				arrayList_destroy(entries);
 			}
 
@@ -250,7 +248,7 @@
 	status = endpointDiscoveryPoller_getEndpoints(poller, url, &updatedEndpoints);
 
 	if (status != CELIX_SUCCESS) {
-		status = celixThreadMutex_unlock(&poller->pollerLock);
+		celixThreadMutex_unlock(&poller->pollerLock);
 	} else {
 		if (updatedEndpoints) {
 			for (unsigned int i = arrayList_size(currentEndpoints); i > 0; i--) {
@@ -275,10 +273,10 @@
 				}
 			}
 		}
+	}
 
-		if (updatedEndpoints) {
-			arrayList_destroy(updatedEndpoints);
-		}
+	if (updatedEndpoints) {
+		arrayList_destroy(updatedEndpoints);
 	}
 
 	return status;
@@ -322,86 +320,86 @@
 
 
 struct MemoryStruct {
-  char *memory;
-  size_t size;
+	char *memory;
+	size_t size;
 };
 
 static size_t endpointDiscoveryPoller_writeMemory(void *contents, size_t size, size_t nmemb, void *memoryPtr) {
-    size_t realsize = size * nmemb;
-    struct MemoryStruct *mem = (struct MemoryStruct *)memoryPtr;
+	size_t realsize = size * nmemb;
+	struct MemoryStruct *mem = (struct MemoryStruct *)memoryPtr;
 
-    mem->memory = realloc(mem->memory, mem->size + realsize + 1);
-    if(mem->memory == NULL) {
-    	printf("ENDPOINT_POLLER: not enough memory (realloc returned NULL)!");
-        return 0;
-    }
+	mem->memory = realloc(mem->memory, mem->size + realsize + 1);
+	if(mem->memory == NULL) {
+		printf("ENDPOINT_POLLER: not enough memory (realloc returned NULL)!");
+		return 0;
+	}
 
-    memcpy(&(mem->memory[mem->size]), contents, realsize);
-    mem->size += realsize;
-    mem->memory[mem->size] = 0;
+	memcpy(&(mem->memory[mem->size]), contents, realsize);
+	mem->size += realsize;
+	mem->memory[mem->size] = 0;
 
-    return realsize;
+	return realsize;
 }
 
 static celix_status_t endpointDiscoveryPoller_getEndpoints(endpoint_discovery_poller_pt poller, char *url, array_list_pt *updatedEndpoints) {
-    celix_status_t status = CELIX_SUCCESS;
+	celix_status_t status = CELIX_SUCCESS;
 
 
-    CURL *curl = NULL;
-    CURLcode res = CURLE_OK;
+	CURL *curl = NULL;
+	CURLcode res = CURLE_OK;
 
-    struct MemoryStruct chunk;
-    chunk.memory = malloc(1);
-    chunk.size = 0;
+	struct MemoryStruct chunk;
+	chunk.memory = malloc(1);
+	chunk.size = 0;
 
-    curl = curl_easy_init();
-    if (!curl) {
-        status = CELIX_ILLEGAL_STATE;
-    } else {
-        curl_easy_setopt(curl, CURLOPT_URL, url);
-        curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
-        curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, endpointDiscoveryPoller_writeMemory);
-        curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&chunk);
-        curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 5L);
-        curl_easy_setopt(curl, CURLOPT_TIMEOUT, 10L);
-        res = curl_easy_perform(curl);
+	curl = curl_easy_init();
+	if (!curl) {
+		status = CELIX_ILLEGAL_STATE;
+	} else {
+		curl_easy_setopt(curl, CURLOPT_URL, url);
+		curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
+		curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, endpointDiscoveryPoller_writeMemory);
+		curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&chunk);
+		curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 5L);
+		curl_easy_setopt(curl, CURLOPT_TIMEOUT, 10L);
+		res = curl_easy_perform(curl);
 
-        curl_easy_cleanup(curl);
-    }
+		curl_easy_cleanup(curl);
+	}
 
-    // process endpoints file
-    if (res == CURLE_OK) {
-        endpoint_descriptor_reader_pt reader = NULL;
+	// process endpoints file
+	if (res == CURLE_OK) {
+		endpoint_descriptor_reader_pt reader = NULL;
 
-    	status = endpointDescriptorReader_create(poller, &reader);
-    	if (status == CELIX_SUCCESS) {
+		status = endpointDescriptorReader_create(poller, &reader);
+		if (status == CELIX_SUCCESS) {
 			status = endpointDescriptorReader_parseDocument(reader, chunk.memory, updatedEndpoints);
-    	}
+		}
 
-    	if (reader) {
+		if (reader) {
 			endpointDescriptorReader_destroy(reader);
-    	}
-    } else {
-    	logHelper_log(*poller->loghelper, OSGI_LOGSERVICE_ERROR, "ENDPOINT_POLLER: unable to read endpoints from %s, reason: %s", url, curl_easy_strerror(res));
-    }
+		}
+	} else {
+		logHelper_log(*poller->loghelper, OSGI_LOGSERVICE_ERROR, "ENDPOINT_POLLER: unable to read endpoints from %s, reason: %s", url, curl_easy_strerror(res));
+	}
 
-    // clean up endpoints file
-    if (chunk.memory) {
-        free(chunk.memory);
-    }
+	// clean up endpoints file
+	if (chunk.memory) {
+		free(chunk.memory);
+	}
 
-    return status;
+	return status;
 }
 
-static celix_status_t endpointDiscoveryPoller_endpointDescriptionEquals(void *endpointPtr, void *comparePtr, bool *equals) {
-    endpoint_description_pt endpoint = (endpoint_description_pt) endpointPtr;
-    endpoint_description_pt compare = (endpoint_description_pt) comparePtr;
+static celix_status_t endpointDiscoveryPoller_endpointDescriptionEquals(const void *endpointPtr, const void *comparePtr, bool *equals) {
+	endpoint_description_pt endpoint = (endpoint_description_pt) endpointPtr;
+	endpoint_description_pt compare = (endpoint_description_pt) comparePtr;
 
-    if (strcmp(endpoint->id, compare->id) == 0) {
-        *equals = true;
-    } else {
-        *equals = false;
-    }
+	if (strcmp(endpoint->id, compare->id) == 0) {
+		*equals = true;
+	} else {
+		*equals = false;
+	}
 
-    return CELIX_SUCCESS;
+	return CELIX_SUCCESS;
 }
diff --git a/remote_services/discovery/private/src/endpoint_discovery_server.c b/remote_services/discovery/private/src/endpoint_discovery_server.c
index 818d239..f5f82af 100644
--- a/remote_services/discovery/private/src/endpoint_discovery_server.c
+++ b/remote_services/discovery/private/src/endpoint_discovery_server.c
@@ -40,33 +40,33 @@
 #include "endpoint_descriptor_writer.h"
 
 // defines how often the webserver is restarted (with an increased port number)
-#define MAX_NUMBER_OF_RESTARTS 	5
+#define MAX_NUMBER_OF_RESTARTS 	15
 #define DEFAULT_SERVER_THREADS "1"
 
 #define CIVETWEB_REQUEST_NOT_HANDLED 0
 #define CIVETWEB_REQUEST_HANDLED 1
 
 static const char *response_headers =
-  "HTTP/1.1 200 OK\r\n"
-  "Cache: no-cache\r\n"
-  "Content-Type: application/xml;charset=utf-8\r\n"
-  "\r\n";
+		"HTTP/1.1 200 OK\r\n"
+		"Cache: no-cache\r\n"
+		"Content-Type: application/xml;charset=utf-8\r\n"
+		"\r\n";
 
 struct endpoint_discovery_server {
 	log_helper_pt* loghelper;
-    hash_map_pt entries; // key = endpointId, value = endpoint_descriptor_pt
+	hash_map_pt entries; // key = endpointId, value = endpoint_descriptor_pt
 
-    celix_thread_mutex_t serverLock;
+	celix_thread_mutex_t serverLock;
 
-    const char* path;
-    const char *port;
-    const char* ip;
-    struct mg_context* ctx;
+	const char* path;
+	const char *port;
+	const char* ip;
+	struct mg_context* ctx;
 };
 
 // Forward declarations...
 static int endpointDiscoveryServer_callback(struct mg_connection *conn);
-static char* format_path(char* path);
+static char* format_path(const char* path);
 
 #ifndef ANDROID
 static celix_status_t endpointDiscoveryServer_getIpAdress(char* interface, char** ip);
@@ -75,10 +75,13 @@
 celix_status_t endpointDiscoveryServer_create(discovery_pt discovery, bundle_context_pt context, endpoint_discovery_server_pt *server) {
 	celix_status_t status;
 
-	char *port = 0;
-	char *ip = NULL;
+	const char *port = NULL;
+	const char *ip = NULL;
 	char *detectedIp = NULL;
-	char *path = NULL;
+	const char *path = NULL;
+	const char *retries = NULL;
+
+	int max_ep_num = MAX_NUMBER_OF_RESTARTS;
 
 	*server = malloc(sizeof(struct endpoint_discovery_server));
 	if (!*server) {
@@ -97,12 +100,12 @@
 	}
 
 	bundleContext_getProperty(context, DISCOVERY_SERVER_IP, &ip);
-	#ifndef ANDROID
+#ifndef ANDROID
 	if (ip == NULL) {
-		char *interface = NULL;
+		const char *interface = NULL;
 
 		bundleContext_getProperty(context, DISCOVERY_SERVER_INTERFACE, &interface);
-		if ((interface != NULL) && (endpointDiscoveryServer_getIpAdress(interface, &detectedIp) != CELIX_SUCCESS)) {
+		if ((interface != NULL) && (endpointDiscoveryServer_getIpAdress((char*)interface, &detectedIp) != CELIX_SUCCESS)) {
 			logHelper_log(*(*server)->loghelper, OSGI_LOGSERVICE_WARNING, "Could not retrieve IP adress for interface %s", interface);
 		}
 
@@ -112,7 +115,7 @@
 
 		ip = detectedIp;
 	}
-	#endif
+#endif
 
 	if (ip != NULL) {
 		logHelper_log(*(*server)->loghelper, OSGI_LOGSERVICE_INFO, "Using %s for service annunciation", ip);
@@ -137,20 +140,29 @@
 		path = DEFAULT_SERVER_PATH;
 	}
 
+	bundleContext_getProperty(context, DISCOVERY_SERVER_MAX_EP, &retries);
+	if (retries != NULL) {
+		errno=0;
+		max_ep_num = strtol(retries,NULL,10);
+		if(errno!=0 || max_ep_num<=0){
+			max_ep_num=MAX_NUMBER_OF_RESTARTS;
+		}
+	}
+
 	(*server)->path = format_path(path);
 
 	const struct mg_callbacks callbacks = {
-		.begin_request = endpointDiscoveryServer_callback,
+			.begin_request = endpointDiscoveryServer_callback,
 	};
 
 	unsigned int port_counter = 0;
+	char newPort[10];
 
 	do {
-		char newPort[10];
 		const char *options[] = {
-			"listening_ports", port,
-			"num_threads", DEFAULT_SERVER_THREADS,
-			NULL
+				"listening_ports", port,
+				"num_threads", DEFAULT_SERVER_THREADS,
+				NULL
 		};
 
 		(*server)->ctx = mg_start(&callbacks, (*server), options);
@@ -161,14 +173,14 @@
 		}
 		else {
 			errno = 0;
-	        char* endptr = port;
-	        long currentPort = strtol(port, &endptr, 10);
+			char* endptr = (char*)port;
+			long currentPort = strtol(port, &endptr, 10);
 
-	        if (*endptr || errno != 0) {
-	            currentPort = strtol(DEFAULT_SERVER_PORT, NULL, 10);
-	        }
+			if (*endptr || errno != 0) {
+				currentPort = strtol(DEFAULT_SERVER_PORT, NULL, 10);
+			}
 
-	        port_counter++;
+			port_counter++;
 			snprintf(&newPort[0], 10,  "%ld", (currentPort+1));
 
 			logHelper_log(discovery->loghelper, OSGI_LOGSERVICE_ERROR, "Error while starting discovery server on port %s - retrying on port %s...", port, newPort);
@@ -176,7 +188,7 @@
 
 		}
 
-	} while(((*server)->ctx == NULL) && (port_counter < MAX_NUMBER_OF_RESTARTS));
+	} while(((*server)->ctx == NULL) && (port_counter < max_ep_num));
 
 	(*server)->port = strdup(port);
 
@@ -273,8 +285,9 @@
 	return status;
 }
 
-static char* format_path(char* path) {
-	char* result = strdup(utils_stringTrim(path));
+static char* format_path(const char* path) {
+	char* result = strdup(path);
+	result = utils_stringTrim(result);
 	// check whether the path starts with a leading slash...
 	if (result[0] != '/') {
 		size_t len = strlen(result);
@@ -313,23 +326,27 @@
 
 static int endpointDiscoveryServer_writeEndpoints(struct mg_connection* conn, array_list_pt endpoints) {
 	celix_status_t status;
+	int rv = CIVETWEB_REQUEST_NOT_HANDLED;
 
-    endpoint_descriptor_writer_pt writer = NULL;
-    status = endpointDescriptorWriter_create(&writer);
-    if (status != CELIX_SUCCESS) {
-    	return CIVETWEB_REQUEST_NOT_HANDLED;
-    }
+	endpoint_descriptor_writer_pt writer = NULL;
+	status = endpointDescriptorWriter_create(&writer);
+	if (status == CELIX_SUCCESS) {
 
-    char *buffer = NULL;
-    status = endpointDescriptorWriter_writeDocument(writer, endpoints, &buffer);
-    if (buffer) {
-    	mg_write(conn, response_headers, strlen(response_headers));
-    	mg_write(conn, buffer, strlen(buffer));
-    }
+		char *buffer = NULL;
+		status = endpointDescriptorWriter_writeDocument(writer, endpoints, &buffer);
+		if (buffer) {
+			mg_write(conn, response_headers, strlen(response_headers));
+			mg_write(conn, buffer, strlen(buffer));
+		}
 
-    status = endpointDescriptorWriter_destroy(writer);
+		rv = CIVETWEB_REQUEST_HANDLED;
+	}
 
-	return CIVETWEB_REQUEST_HANDLED;
+	if(writer!=NULL){
+		endpointDescriptorWriter_destroy(writer);
+	}
+
+	return rv;
 }
 
 // returns all endpoints as XML...
@@ -338,17 +355,17 @@
 
 	array_list_pt endpoints = NULL;
 
-    if (celixThreadMutex_lock(&server->serverLock) == CELIX_SUCCESS) {
-        endpointDiscoveryServer_getEndpoints(server, NULL, &endpoints);
-        if (endpoints) {
-            status = endpointDiscoveryServer_writeEndpoints(conn, endpoints);
+	if (celixThreadMutex_lock(&server->serverLock) == CELIX_SUCCESS) {
+		endpointDiscoveryServer_getEndpoints(server, NULL, &endpoints);
+		if (endpoints) {
+			status = endpointDiscoveryServer_writeEndpoints(conn, endpoints);
 
-            arrayList_destroy(endpoints);
-        }
+			arrayList_destroy(endpoints);
+		}
 
 
-        celixThreadMutex_unlock(&server->serverLock);
-    }
+		celixThreadMutex_unlock(&server->serverLock);
+	}
 
 	return status;
 }
@@ -360,14 +377,14 @@
 	array_list_pt endpoints = NULL;
 
 	if (celixThreadMutex_lock(&server->serverLock) == CELIX_SUCCESS) {
-        endpointDiscoveryServer_getEndpoints(server, endpoint_id, &endpoints);
-        if (endpoints) {
-            status = endpointDiscoveryServer_writeEndpoints(conn, endpoints);
+		endpointDiscoveryServer_getEndpoints(server, endpoint_id, &endpoints);
+		if (endpoints) {
+			status = endpointDiscoveryServer_writeEndpoints(conn, endpoints);
 
-            arrayList_destroy(endpoints);
-        }
+			arrayList_destroy(endpoints);
+		}
 
-        celixThreadMutex_unlock(&server->serverLock);
+		celixThreadMutex_unlock(&server->serverLock);
 	}
 
 	return status;
@@ -404,10 +421,10 @@
 	celix_status_t status = CELIX_BUNDLE_EXCEPTION;
 
 	struct ifaddrs *ifaddr, *ifa;
-    char host[NI_MAXHOST];
+	char host[NI_MAXHOST];
 
-    if (getifaddrs(&ifaddr) != -1)
-    {
+	if (getifaddrs(&ifaddr) != -1)
+	{
 		for (ifa = ifaddr; ifa != NULL && status != CELIX_SUCCESS; ifa = ifa->ifa_next)
 		{
 			if (ifa->ifa_addr == NULL)
@@ -426,8 +443,8 @@
 		}
 
 		freeifaddrs(ifaddr);
-    }
+	}
 
-    return status;
+	return status;
 }
 #endif
diff --git a/remote_services/discovery_etcd/private/include/etcd.h b/remote_services/discovery_etcd/private/include/etcd.h
index f5624d0..2ba09de 100644
--- a/remote_services/discovery_etcd/private/include/etcd.h
+++ b/remote_services/discovery_etcd/private/include/etcd.h
@@ -48,12 +48,14 @@
 #define ETCD_JSON_KEY			"key"
 #define ETCD_JSON_VALUE			"value"
 #define ETCD_JSON_MODIFIEDINDEX	"modifiedIndex"
+#define ETCD_ERROR_INDICATION   "errorCode"
+#define ETCD_INDEX				"index"
 
 celix_status_t etcd_init(char* server, int port);
 bool etcd_get(char* key, char* value, char*action, int* modifiedIndex);
 bool etcd_getNodes(char* directory, char** nodeNames, int* size);
 bool etcd_set(char* key, char* value, int ttl, bool prevExist);
 bool etcd_del(char* key);
-bool etcd_watch(char* key, int index, char* action, char* prevValue, char* value, char* rkey, int *modifiedIndex);
+bool etcd_watch(char* key, int index, char* action, char* prevValue, char* value, char* rkey, int *modifiedIndex, int *error);
 
 #endif /* ETCD_H_ */
diff --git a/remote_services/discovery_etcd/private/src/discovery_impl.c b/remote_services/discovery_etcd/private/src/discovery_impl.c
index 00ab9a6..8087d95 100644
--- a/remote_services/discovery_etcd/private/src/discovery_impl.c
+++ b/remote_services/discovery_etcd/private/src/discovery_impl.c
@@ -109,8 +109,8 @@
 
 celix_status_t discovery_start(discovery_pt discovery) {
     celix_status_t status = CELIX_SUCCESS;
-	char *port = NULL;
-	char *path = NULL;
+	const char *port = NULL;
+	const char *path = NULL;
 
 	logHelper_start(discovery->loghelper);
 
@@ -138,7 +138,6 @@
     if (status != CELIX_SUCCESS) {
     	return CELIX_BUNDLE_EXCEPTION;
     }
-
     return status;
 }
 
diff --git a/remote_services/discovery_etcd/private/src/etcd.c b/remote_services/discovery_etcd/private/src/etcd.c
index ed06fb7..1b74f66 100644
--- a/remote_services/discovery_etcd/private/src/etcd.c
+++ b/remote_services/discovery_etcd/private/src/etcd.c
@@ -310,7 +310,7 @@
 
 ///watch
 
-bool etcd_watch(char* key, int index, char* action, char* prevValue, char* value, char* rkey, int* modifiedIndex) {
+bool etcd_watch(char* key, int index, char* action, char* prevValue, char* value, char* rkey, int* modifiedIndex, int* errorCode) {
     json_error_t error;
     json_t* js_root = NULL;
     json_t* js_node = NULL;
@@ -320,7 +320,9 @@
     json_t* js_rkey = NULL;
     json_t* js_prevValue = NULL;
     json_t* js_modIndex = NULL;
+    json_t* js_error = NULL;	// used to indicate valid json response with ETCD error indication
     bool retVal = false;
+    *errorCode = 0;
     char url[MAX_URL_LENGTH];
     int res;
     struct MemoryStruct reply;
@@ -343,6 +345,7 @@
             js_action = json_object_get(js_root, ETCD_JSON_ACTION);
             js_node = json_object_get(js_root, ETCD_JSON_NODE);
             js_prevNode = json_object_get(js_root, ETCD_JSON_PREVNODE);
+            js_error = json_object_get(js_root, ETCD_ERROR_INDICATION);
         }
         if (js_prevNode != NULL) {
             js_prevValue = json_object_get(js_prevNode, ETCD_JSON_VALUE);
@@ -373,6 +376,13 @@
 
             retVal = true;
         }
+        if ((js_error != NULL) && (json_is_integer(js_error))) {
+		*errorCode = json_integer_value(js_error);
+		js_modIndex = json_object_get(js_root, ETCD_INDEX);
+		if ((js_modIndex != NULL) && (json_is_integer(js_modIndex))) {
+		    *modifiedIndex = json_integer_value(js_modIndex);
+		}
+        }
         if (js_root != NULL) {
             json_decref(js_root);
         }
diff --git a/remote_services/discovery_etcd/private/src/etcd_watcher.c b/remote_services/discovery_etcd/private/src/etcd_watcher.c
index 915f420..a7bcc2e 100644
--- a/remote_services/discovery_etcd/private/src/etcd_watcher.c
+++ b/remote_services/discovery_etcd/private/src/etcd_watcher.c
@@ -68,7 +68,7 @@
 // note that the rootNode shouldn't have a leading slash
 static celix_status_t etcdWatcher_getRootPath(bundle_context_pt context, char* rootNode) {
 	celix_status_t status = CELIX_SUCCESS;
-	char* rootPath = NULL;
+	const char* rootPath = NULL;
 
 	if (((bundleContext_getProperty(context, CFG_ETCD_ROOT_PATH, &rootPath)) != CELIX_SUCCESS) || (!rootPath)) {
 		strcpy(rootNode, DEFAULT_ETCD_ROOTPATH);
@@ -84,7 +84,7 @@
 static celix_status_t etcdWatcher_getLocalNodePath(bundle_context_pt context, char* localNodePath) {
 	celix_status_t status = CELIX_SUCCESS;
 	char rootPath[MAX_ROOTNODE_LENGTH];
-    char* uuid = NULL;
+    const char* uuid = NULL;
 
     if ((etcdWatcher_getRootPath(context, &rootPath[0]) != CELIX_SUCCESS)) {
 		status = CELIX_ILLEGAL_STATE;
@@ -159,7 +159,7 @@
  	char url[MAX_VALUE_LENGTH];
     int modIndex;
     char* endpoints = NULL;
-    char* ttlStr = NULL;
+    const char* ttlStr = NULL;
     int ttl;
 
 	bundle_context_pt context = watcher->discovery->context;
@@ -181,7 +181,7 @@
     }
     else
     {
-        char* endptr = ttlStr;
+        char* endptr = (char*)ttlStr;
         errno = 0;
         ttl =  strtol(ttlStr, &endptr, 10);
         if (*endptr || errno != 0) {
@@ -264,6 +264,7 @@
 	time_t timeBeforeWatch = time(NULL);
 	static char rootPath[MAX_ROOTNODE_LENGTH];
 	int highestModified = 0;
+	int errorCode=0;
 
 	bundle_context_pt context = watcher->discovery->context;
 
@@ -276,24 +277,35 @@
 		char value[MAX_VALUE_LENGTH];
 		char preValue[MAX_VALUE_LENGTH];
 		char action[MAX_ACTION_LENGTH];
-        int modIndex;
+        int modIndex=0;
 
-		if (etcd_watch(rootPath, highestModified + 1, &action[0], &preValue[0], &value[0], &rkey[0], &modIndex) == true) {
-			if (strcmp(action, "set") == 0) {
-				etcdWatcher_addEntry(watcher, &rkey[0], &value[0]);
-			} else if (strcmp(action, "delete") == 0) {
-				etcdWatcher_removeEntry(watcher, &rkey[0], &value[0]);
-			} else if (strcmp(action, "expire") == 0) {
-				etcdWatcher_removeEntry(watcher, &rkey[0], &value[0]);
-			} else if (strcmp(action, "update") == 0) {
-				etcdWatcher_addEntry(watcher, &rkey[0], &value[0]);
-			} else {
-				logHelper_log(*watcher->loghelper, OSGI_LOGSERVICE_INFO, "Unexpected action: %s", action);
-			}
-
-			highestModified = modIndex;
+        if (etcd_watch(rootPath, highestModified + 1, &action[0], &preValue[0], &value[0], &rkey[0], &modIndex, &errorCode) == true) {
+		if (strcmp(action, "set") == 0) {
+			etcdWatcher_addEntry(watcher, &rkey[0], &value[0]);
+		} else if (strcmp(action, "delete") == 0) {
+			etcdWatcher_removeEntry(watcher, &rkey[0], &value[0]);
+		} else if (strcmp(action, "expire") == 0) {
+			etcdWatcher_removeEntry(watcher, &rkey[0], &value[0]);
+		} else if (strcmp(action, "update") == 0) {
+			etcdWatcher_addEntry(watcher, &rkey[0], &value[0]);
+		} else {
+			logHelper_log(*watcher->loghelper, OSGI_LOGSERVICE_INFO, "Unexpected action: %s", action);
 		}
 
+		highestModified = modIndex;
+        }
+        /* prevent busy waiting, in case etcd_watch returns false */
+        else {
+		switch (errorCode) {
+		case 401:
+			// Etcd can store at most 1000 events
+			highestModified = modIndex;
+			break;
+		default:
+			break;
+		}
+        }
+
 		// update own framework uuid
 		if (time(NULL) - timeBeforeWatch > (DEFAULT_ETCD_TTL/2)) {
 			etcdWatcher_addOwnFramework(watcher);
@@ -313,8 +325,8 @@
 {
 	celix_status_t status = CELIX_SUCCESS;
 
-	char* etcd_server = NULL;
-	char* etcd_port_string = NULL;
+	const char* etcd_server = NULL;
+	const char* etcd_port_string = NULL;
 	int etcd_port = 0;
 
 	if (discovery == NULL) {
@@ -341,7 +353,7 @@
 	}
 	else
 	{
-		char* endptr = etcd_port_string;
+		char* endptr = (char*)etcd_port_string;
 		errno = 0;
 		etcd_port =  strtol(etcd_port_string, &endptr, 10);
 		if (*endptr || errno != 0) {
@@ -349,7 +361,7 @@
 		}
 	}
 
-    status = etcd_init(etcd_server, etcd_port);
+    status = etcd_init((char*)etcd_server, etcd_port);
 
     printf(" ININT\n");
     if (status == CELIX_SUCCESS) {
diff --git a/remote_services/discovery_shm/private/src/discovery_shm.c b/remote_services/discovery_shm/private/src/discovery_shm.c
index 9567401..1b1170e 100644
--- a/remote_services/discovery_shm/private/src/discovery_shm.c
+++ b/remote_services/discovery_shm/private/src/discovery_shm.c
@@ -125,8 +125,13 @@
         status = CELIX_BUNDLE_EXCEPTION;
     }
 
-    if (((*data) = shmat(shmId, 0, 0)) < 0) {
-        status = CELIX_BUNDLE_EXCEPTION;
+    /* shmat has a curious return value of (void*)-1 in case of error */
+    void *mem=shmat(shmId, 0, 0);
+    if(mem==((void*)-1)){
+	status = CELIX_BUNDLE_EXCEPTION;
+    }
+    else{
+	(*data)=mem;
     }
 
     return status;
@@ -166,7 +171,7 @@
         for (i = 0; i < data->numOfEntries; i++) {
             shmEntry entry = data->entries[i];
 
-            if (entry.key) {
+            if (strlen(entry.key)>0) {
                 snprintf(keys[i], SHM_ENTRY_MAX_KEY_LENGTH, "%s", entry.key);
             }
         }
diff --git a/remote_services/discovery_shm/private/src/discovery_shmWatcher.c b/remote_services/discovery_shm/private/src/discovery_shmWatcher.c
index e69edfc..6460de8 100644
--- a/remote_services/discovery_shm/private/src/discovery_shmWatcher.c
+++ b/remote_services/discovery_shm/private/src/discovery_shmWatcher.c
@@ -60,7 +60,7 @@
 static celix_status_t discoveryShmWatcher_getLocalNodePath(bundle_context_pt context, char* localNodePath) {
     celix_status_t status;
     char rootPath[MAX_ROOTNODE_LENGTH];
-    char* uuid = NULL;
+    const char* uuid = NULL;
 
     status = discoveryShmWatcher_getRootPath(&rootPath[0]);
 
@@ -196,24 +196,19 @@
         if (status == CELIX_SUCCESS) {
             discovery->watcher = watcher;
         }
+        else{
+        	discovery->watcher = NULL;
+        	free(watcher);
+        }
 
     }
 
     if (status == CELIX_SUCCESS) {
-        status = celixThreadMutex_create(&watcher->watcherLock, NULL);
-    }
-
-    if (status == CELIX_SUCCESS) {
-        status = celixThreadMutex_lock(&watcher->watcherLock);
-    }
-
-    if (status == CELIX_SUCCESS) {
-    	watcher->running = true;
-        status = celixThread_create(&watcher->watcherThread, NULL, discoveryShmWatcher_run, discovery);
-    }
-
-    if (status == CELIX_SUCCESS) {
-        status = celixThreadMutex_unlock(&watcher->watcherLock);
+        status += celixThreadMutex_create(&watcher->watcherLock, NULL);
+        status += celixThreadMutex_lock(&watcher->watcherLock);
+        watcher->running = true;
+        status += celixThread_create(&watcher->watcherThread, NULL, discoveryShmWatcher_run, discovery);
+        status += celixThreadMutex_unlock(&watcher->watcherLock);
     }
 
     return status;
@@ -224,7 +219,9 @@
     shm_watcher_pt watcher = discovery->watcher;
     char localNodePath[MAX_LOCALNODE_LENGTH];
 
+    celixThreadMutex_lock(&watcher->watcherLock);
     watcher->running = false;
+    celixThreadMutex_unlock(&watcher->watcherLock);
 
     celixThread_join(watcher->watcherThread, NULL);
 
diff --git a/remote_services/examples/calculator_shell/private/src/add_command.c b/remote_services/examples/calculator_shell/private/src/add_command.c
index b003a5b..b2520ae 100644
--- a/remote_services/examples/calculator_shell/private/src/add_command.c
+++ b/remote_services/examples/calculator_shell/private/src/add_command.c
@@ -52,37 +52,36 @@
     if (status == CELIX_SUCCESS) {
     	char *token = line;
     	strtok_r(line, " ", &token);
-		char *aStr = strtok_r(NULL, " ", &token);
-		bool numeric;
-		addCommand_isNumeric(aStr, &numeric);
-		if (aStr != NULL && numeric) {
-			char *bStr = strtok_r(NULL, " ", &token);
-			addCommand_isNumeric(bStr, &numeric);
-			if (bStr != NULL && numeric) {
-				calculator_service_pt calculator = NULL;
-				status = bundleContext_getService(context, calculatorService, (void *) &calculator);
-                if (status == CELIX_SUCCESS && calculator != NULL) {
-					double a = atof(aStr);
-					double b = atof(bStr);
-					double result = 0;
-					status = calculator->add(calculator->calculator, a, b, &result);
-					if (status == CELIX_SUCCESS) {
-						fprintf(out, "CALCULATOR_SHELL: Add: %f + %f = %f\n", a, b, result);
-					} else {
-						fprintf(err, "ADD: Unexpected exception in Calc service\n");
-					}
+	char *aStr = strtok_r(NULL, " ", &token);
+	char *bStr = strtok_r(NULL, " ", &token);
+	bool aNumeric, bNumeric;
+	if (aStr != NULL && bStr != NULL) {
+		addCommand_isNumeric(aStr, &aNumeric);
+		addCommand_isNumeric(bStr, &bNumeric);
+		if(aNumeric && bNumeric){
+			calculator_service_pt calculator = NULL;
+			status = bundleContext_getService(context, calculatorService, (void *) &calculator);
+			if (status == CELIX_SUCCESS && calculator != NULL) {
+				double a = atof(aStr);
+				double b = atof(bStr);
+				double result = 0;
+				status = calculator->add(calculator->calculator, a, b, &result);
+				if (status == CELIX_SUCCESS) {
+					fprintf(out, "CALCULATOR_SHELL: Add: %f + %f = %f\n", a, b, result);
 				} else {
-					fprintf(err, "No calc service available\n");
+					fprintf(err, "ADD: Unexpected exception in Calc service\n");
 				}
 			} else {
-				fprintf(err, "ADD: Requires 2 numerical parameter\n");
+				fprintf(err, "No calc service available\n");
 			}
 		} else {
 			fprintf(err, "ADD: Requires 2 numerical parameter\n");
-			status = CELIX_ILLEGAL_ARGUMENT;
 		}
+	} else {
+		fprintf(err, "ADD: Requires 2 numerical parameter\n");
+	}
     } else {
-		fprintf(err, "No calc service available\n");
+	fprintf(err, "No calc service available\n");
     }
 
     //return status;
diff --git a/remote_services/examples/calculator_shell/private/src/sqrt_command.c b/remote_services/examples/calculator_shell/private/src/sqrt_command.c
index 8c53896..2e7238c 100644
--- a/remote_services/examples/calculator_shell/private/src/sqrt_command.c
+++ b/remote_services/examples/calculator_shell/private/src/sqrt_command.c
@@ -51,26 +51,29 @@
     	char *token = line;
     	strtok_r(line, " ", &token);
 		char *aStr = strtok_r(NULL, " ", &token);
-		bool numeric;
-		sqrtCommand_isNumeric(aStr, &numeric);
-		if (aStr != NULL && numeric) {
-			calculator_service_pt calculator = NULL;
-			status = bundleContext_getService(context, calculatorService, (void *) &calculator);
-			if (status == CELIX_SUCCESS && calculator != NULL) {
-				double a = atof(aStr);
-				double result = 0;
-				status = calculator->sqrt(calculator->calculator, a, &result);
-				if (status == CELIX_SUCCESS) {
-					fprintf(out, "CALCULATOR_SHELL: Sqrt: %f = %f\n", a, result);
+		if(aStr != NULL){
+			bool numeric;
+			sqrtCommand_isNumeric(aStr, &numeric);
+			if (numeric) {
+				calculator_service_pt calculator = NULL;
+				status = bundleContext_getService(context, calculatorService, (void *) &calculator);
+				if (status == CELIX_SUCCESS && calculator != NULL) {
+					double a = atof(aStr);
+					double result = 0;
+					status = calculator->sqrt(calculator->calculator, a, &result);
+					if (status == CELIX_SUCCESS) {
+						fprintf(out, "CALCULATOR_SHELL: Sqrt: %f = %f\n", a, result);
+					} else {
+						fprintf(err, "SQRT: Unexpected exception in Calc service\n");
+					}
 				} else {
-					fprintf(err, "SQRT: Unexpected exception in Calc service\n");
+					fprintf(err, "No calc service available\n");
 				}
 			} else {
-				fprintf(err, "No calc service available\n");
+				fprintf(err, "SQRT: Requires 1 numerical parameter\n");
 			}
 		} else {
 			fprintf(err, "SQRT: Requires 1 numerical parameter\n");
-			status = CELIX_ILLEGAL_ARGUMENT;
 		}
     } else {
 		fprintf(err, "No calc service available\n");
diff --git a/remote_services/examples/calculator_shell/private/src/sub_command.c b/remote_services/examples/calculator_shell/private/src/sub_command.c
index 7cdc394..672ea4c 100644
--- a/remote_services/examples/calculator_shell/private/src/sub_command.c
+++ b/remote_services/examples/calculator_shell/private/src/sub_command.c
@@ -51,12 +51,12 @@
     	char *token = line;
     	strtok_r(line, " ", &token);
 		char *aStr = strtok_r(NULL, " ", &token);
-		bool numeric;
-		subCommand_isNumeric(aStr, &numeric);
-		if (aStr != NULL && numeric) {
-			char *bStr = strtok_r(NULL, " ", &token);
-			subCommand_isNumeric(bStr, &numeric);
-			if (bStr != NULL && numeric) {
+		char *bStr = strtok_r(NULL, " ", &token);
+		if(aStr != NULL && bStr != NULL ){
+			bool aNumeric, bNumeric;
+			subCommand_isNumeric(aStr, &aNumeric);
+			subCommand_isNumeric(bStr, &bNumeric);
+			if (aNumeric && bNumeric) {
 				calculator_service_pt calculator = NULL;
 				status = bundleContext_getService(context, calculatorService, (void *) &calculator);
 				if (status == CELIX_SUCCESS && calculator != NULL) {
@@ -77,7 +77,6 @@
 			}
 		} else {
 			fprintf(err, "SUB: Requires 2 numerical parameter\n");
-			status = CELIX_ILLEGAL_ARGUMENT;
 		}
     } else {
 		fprintf(err, "No calc service available\n");
diff --git a/remote_services/remote_service_admin/private/src/endpoint_description.c b/remote_services/remote_service_admin/private/src/endpoint_description.c
index 1803159..0d8b684 100644
--- a/remote_services/remote_service_admin/private/src/endpoint_description.c
+++ b/remote_services/remote_service_admin/private/src/endpoint_description.c
@@ -24,6 +24,7 @@
  *  \copyright  Apache License, Version 2.0
  */
 #include <stdlib.h>
+#include <string.h>
 
 #include "celix_errno.h"
 #include "celix_log.h"
@@ -32,47 +33,56 @@
 #include "remote_constants.h"
 #include "constants.h"
 
-static celix_status_t endpointDescription_verifyLongProperty(properties_pt properties, char *propertyName, long *longProperty);
+static celix_status_t endpointDescription_verifyLongProperty(properties_pt properties, char *propertyName, unsigned long *longProperty);
 
 celix_status_t endpointDescription_create(properties_pt properties, endpoint_description_pt *endpointDescription) {
-	celix_status_t status;
+	celix_status_t status = CELIX_SUCCESS;
 
-    *endpointDescription = malloc(sizeof(**endpointDescription));
+	unsigned long serviceId = 0UL;
+	status = endpointDescription_verifyLongProperty(properties, (char *) OSGI_RSA_ENDPOINT_SERVICE_ID, &serviceId);
+	if (status != CELIX_SUCCESS) {
+		return status;
+	}
 
-    long serviceId = 0L;
-    status = endpointDescription_verifyLongProperty(properties, (char *) OSGI_RSA_ENDPOINT_SERVICE_ID, &serviceId);
-    if (status != CELIX_SUCCESS) {
-    	return status;
-    }
+	endpoint_description_pt ep = calloc(1,sizeof(*ep));
 
-    (*endpointDescription)->properties = properties;
-    (*endpointDescription)->frameworkUUID = properties_get(properties, (char *) OSGI_RSA_ENDPOINT_FRAMEWORK_UUID);
-    (*endpointDescription)->id = properties_get(properties, (char *) OSGI_RSA_ENDPOINT_ID);
-    (*endpointDescription)->service = properties_get(properties, (char *) OSGI_FRAMEWORK_OBJECTCLASS);
-    (*endpointDescription)->serviceId = serviceId;
+    ep->properties = properties;
+    ep->frameworkUUID = (char*)properties_get(properties, OSGI_RSA_ENDPOINT_FRAMEWORK_UUID);
+    ep->id = (char*)properties_get(properties, OSGI_RSA_ENDPOINT_ID);
+    ep->service = strndup(properties_get(properties, OSGI_FRAMEWORK_OBJECTCLASS), 1024*10);
+    ep->serviceId = serviceId;
 
-    if (!(*endpointDescription)->frameworkUUID || !(*endpointDescription)->id || !(*endpointDescription)->service) {
+    if (!(ep->frameworkUUID) || !(ep->id) || !(ep->service) ) {
     	fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "ENDPOINT_DESCRIPTION: incomplete description!.");
     	status = CELIX_BUNDLE_EXCEPTION;
     }
 
+    if(status == CELIX_SUCCESS){
+	*endpointDescription = ep;
+    }
+    else{
+	*endpointDescription = NULL;
+	free(ep);
+    }
+
     return status;
 }
 
 celix_status_t endpointDescription_destroy(endpoint_description_pt description) {
     properties_destroy(description->properties);
+    free(description->service);
     free(description);
     return CELIX_SUCCESS;
 }
 
-static celix_status_t endpointDescription_verifyLongProperty(properties_pt properties, char *propertyName, long *longProperty) {
+static celix_status_t endpointDescription_verifyLongProperty(properties_pt properties, char *propertyName, unsigned long *longProperty) {
     celix_status_t status = CELIX_SUCCESS;
 
-    char *value = properties_get(properties, propertyName);
+    const char *value = properties_get(properties, propertyName);
     if (value == NULL) {
-        *longProperty = 0l;
+        *longProperty = 0UL;
     } else {
-        *longProperty = atol(value);
+        *longProperty = strtoul(value,NULL,10);
     }
 
     return status;
diff --git a/remote_services/remote_service_admin/private/src/export_registration_impl.c b/remote_services/remote_service_admin/private/src/export_registration_impl.c
index 20be900..1c684e7 100644
--- a/remote_services/remote_service_admin/private/src/export_registration_impl.c
+++ b/remote_services/remote_service_admin/private/src/export_registration_impl.c
@@ -179,7 +179,7 @@
 
 celix_status_t exportRegistration_open(export_registration_pt registration) {
 	celix_status_t status = CELIX_SUCCESS;
-	char *bundleStore = NULL;
+	const char *bundleStore = NULL;
 
 	bundleContext_getProperty(registration->context, BUNDLE_STORE_PROPERTY_NAME, &bundleStore);
 
diff --git a/remote_services/remote_service_admin/private/src/import_registration_impl.c b/remote_services/remote_service_admin/private/src/import_registration_impl.c
index f7419a2..9a84327 100644
--- a/remote_services/remote_service_admin/private/src/import_registration_impl.c
+++ b/remote_services/remote_service_admin/private/src/import_registration_impl.c
@@ -116,7 +116,7 @@
 {
 	celix_status_t status;
 
-	char *bundleStore = NULL;
+	const char *bundleStore = NULL;
 	bundleContext_getProperty(registration_factory->context, BUNDLE_STORE_PROPERTY_NAME, &bundleStore);
 
 	if (bundleStore == NULL) {
diff --git a/remote_services/remote_service_admin/private/src/remote_proxy_factory_impl.c b/remote_services/remote_service_admin/private/src/remote_proxy_factory_impl.c
index b2ffd29..9f996d6 100644
--- a/remote_services/remote_service_admin/private/src/remote_proxy_factory_impl.c
+++ b/remote_services/remote_service_admin/private/src/remote_proxy_factory_impl.c
@@ -175,7 +175,7 @@
 	if (status == CELIX_SUCCESS) {
 		proxy_instance_ptr->properties = properties_create();
 		if (!proxy_instance_ptr->properties) {
-			status = CELIX_BUNDLE_EXCEPTION;
+			status = CELIX_ENOMEM;
 		}
 	}
 
@@ -205,6 +205,15 @@
 		hashMap_put(remote_proxy_factory_ptr->proxy_instances, endpointDescription, proxy_instance_ptr);
 	}
 
+	if(status!=CELIX_SUCCESS){
+		if(proxy_instance_ptr != NULL){
+			if(proxy_instance_ptr->properties != NULL){
+				properties_destroy(proxy_instance_ptr->properties);
+			}
+			free(proxy_instance_ptr);
+		}
+	}
+
 	return status;
 }
 
diff --git a/remote_services/remote_service_admin/public/include/endpoint_description.h b/remote_services/remote_service_admin/public/include/endpoint_description.h
index 26cc0db..de27d2e 100644
--- a/remote_services/remote_service_admin/public/include/endpoint_description.h
+++ b/remote_services/remote_service_admin/public/include/endpoint_description.h
@@ -37,10 +37,11 @@
     char *service;
     // HASH_MAP packageVersions;
     properties_pt properties;
-    long serviceId;
+    unsigned long serviceId;
 };
 
-typedef struct endpoint_description *endpoint_description_pt;
+typedef struct endpoint_description endpoint_description_t;
+typedef endpoint_description_t* endpoint_description_pt;
 
 celix_status_t endpointDescription_create(properties_pt properties, endpoint_description_pt *endpointDescription);
 celix_status_t endpointDescription_destroy(endpoint_description_pt description);
diff --git a/remote_services/remote_service_admin/public/include/endpoint_listener.h b/remote_services/remote_service_admin/public/include/endpoint_listener.h
index ccf52a8..2e6359f 100644
--- a/remote_services/remote_service_admin/public/include/endpoint_listener.h
+++ b/remote_services/remote_service_admin/public/include/endpoint_listener.h
@@ -42,7 +42,8 @@
 	celix_status_t (*endpointRemoved)(void *handle, endpoint_description_pt endpoint, char *machtedFilter);
 };
 
-typedef struct endpoint_listener *endpoint_listener_pt;
+typedef struct endpoint_listener endpoint_listener_t;
+typedef endpoint_listener_t *endpoint_listener_pt;
 
 
 #endif /* ENDPOINT_LISTENER_H_ */
diff --git a/remote_services/remote_service_admin/public/include/remote_endpoint.h b/remote_services/remote_service_admin/public/include/remote_endpoint.h
index e12dd20..ab80abb 100644
--- a/remote_services/remote_service_admin/public/include/remote_endpoint.h
+++ b/remote_services/remote_service_admin/public/include/remote_endpoint.h
@@ -29,7 +29,8 @@
 
 #define OSGI_RSA_REMOTE_ENDPOINT "remote_endpoint"
 
-typedef struct remote_endpoint *remote_endpoint_pt;
+typedef struct remote_endpoint remote_endpoint_t;
+typedef remote_endpoint_t* remote_endpoint_pt;
 
 struct remote_endpoint_service {
 	remote_endpoint_pt endpoint;
diff --git a/remote_services/remote_service_admin/public/include/remote_service_admin.h b/remote_services/remote_service_admin/public/include/remote_service_admin.h
index 1521383..cc7fd98 100644
--- a/remote_services/remote_service_admin/public/include/remote_service_admin.h
+++ b/remote_services/remote_service_admin/public/include/remote_service_admin.h
@@ -34,8 +34,11 @@
 
 #define OSGI_RSA_REMOTE_SERVICE_ADMIN "remote_service_admin"
 
-typedef struct import_registration_factory *import_registration_factory_pt;
-typedef struct remote_service_admin *remote_service_admin_pt;
+typedef struct import_registration_factory import_registration_factory_t;
+typedef import_registration_factory_t* import_registration_factory_pt;
+
+typedef struct remote_service_admin remote_service_admin_t;
+typedef remote_service_admin_t* remote_service_admin_pt;
 
 struct remote_service_admin_service {
 	remote_service_admin_pt admin;
@@ -63,7 +66,8 @@
 
 };
 
-typedef struct remote_service_admin_service *remote_service_admin_service_pt;
+typedef struct remote_service_admin_service remote_service_admin_service_t;
+typedef remote_service_admin_service_t* remote_service_admin_service_pt;
 
 
 #endif /* REMOTE_SERVICE_ADMIN_H_ */
diff --git a/remote_services/remote_service_admin_dfi/CMakeLists.txt b/remote_services/remote_service_admin_dfi/CMakeLists.txt
index c3b3449..4b28231 100644
--- a/remote_services/remote_service_admin_dfi/CMakeLists.txt
+++ b/remote_services/remote_service_admin_dfi/CMakeLists.txt
@@ -16,7 +16,7 @@
 # under the License.
 
 
-celix_subproject(RSA_REMOTE_SERVICE_ADMIN_DFI "Option to enable building the Remote Service Admin Service DFI" OFF DEPS TOPOLOGY_MANAGER)
+celix_subproject(RSA_REMOTE_SERVICE_ADMIN_DFI "Option to enable building the Remote Service Admin Service DFI" ON DEPS TOPOLOGY_MANAGER)
 
 if (RSA_REMOTE_SERVICE_ADMIN_DFI)
 
diff --git a/remote_services/remote_service_admin_dfi/rsa/private/src/dfi_utils.c b/remote_services/remote_service_admin_dfi/rsa/private/src/dfi_utils.c
index ba66e52..1b1eb36 100644
--- a/remote_services/remote_service_admin_dfi/rsa/private/src/dfi_utils.c
+++ b/remote_services/remote_service_admin_dfi/rsa/private/src/dfi_utils.c
@@ -26,7 +26,7 @@
 
     char pwd[1024];
     char path[1024];
-    char *extPath = NULL;
+    const char *extPath = NULL;
    
     status = bundleContext_getProperty(context, "CELIX_FRAMEWORK_EXTENDER_PATH", &extPath);
     if (status != CELIX_SUCCESS || extPath == NULL) {
@@ -52,10 +52,10 @@
     celix_status_t  status;
 
     char *path = NULL;
-    char metaInfFileName[128];
+    char metaInfFileName[512];
     snprintf(metaInfFileName, sizeof(metaInfFileName), "META-INF/descriptors/%s", fileName);
 
-    status = bundle_getEntry(bundle, (char *)fileName, &path);
+    status = bundle_getEntry(bundle, fileName, &path);
     
     if (status != CELIX_SUCCESS || path == NULL) {
         status = bundle_getEntry(bundle, metaInfFileName, &path);
@@ -69,8 +69,9 @@
             *out = df;
         }
 
-        free(path);
     }
+
+    free(path);
     return status;
 }
 
diff --git a/remote_services/remote_service_admin_dfi/rsa/private/src/export_registration_dfi.c b/remote_services/remote_service_admin_dfi/rsa/private/src/export_registration_dfi.c
index a8d61ff..b83b5a8 100644
--- a/remote_services/remote_service_admin_dfi/rsa/private/src/export_registration_dfi.c
+++ b/remote_services/remote_service_admin_dfi/rsa/private/src/export_registration_dfi.c
@@ -54,7 +54,7 @@
 celix_status_t exportRegistration_create(log_helper_pt helper, service_reference_pt reference, endpoint_description_pt endpoint, bundle_context_pt context, export_registration_pt *out) {
     celix_status_t status = CELIX_SUCCESS;
 
-    char *servId = NULL;
+    const char *servId = NULL;
     status = serviceReference_getProperty(reference, "service.id", &servId);
     if (status != CELIX_SUCCESS) {
         logHelper_log(helper, OSGI_LOGSERVICE_WARNING, "Cannot find service.id for ref");
@@ -78,7 +78,7 @@
         celixThreadMutex_create(&reg->mutex, NULL);
     }
 
-    char *exports = NULL;
+    const char *exports = NULL;
     CELIX_DO_IF(status, serviceReference_getProperty(reference, (char *) OSGI_RSA_SERVICE_EXPORTED_INTERFACES, &exports));
 
     bundle_pt bundle = NULL;
@@ -105,7 +105,15 @@
             /* Add the interface version as a property in the properties_map */
             char* intfVersion = NULL;
             dynInterface_getVersionString(reg->intf, &intfVersion);
-            properties_set(endpoint->properties, (char*) CELIX_FRAMEWORK_SERVICE_VERSION, intfVersion);
+            const char *serviceVersion = properties_get(endpoint->properties,(char*) CELIX_FRAMEWORK_SERVICE_VERSION);
+            if(serviceVersion!=NULL){
+            	if(strcmp(serviceVersion,intfVersion)!=0){
+            		logHelper_log(helper, OSGI_LOGSERVICE_WARNING, "Service version (%s) and interface version from the descriptor (%s) are not the same!",serviceVersion,intfVersion);
+            	}
+            }
+            else{
+            	properties_set(endpoint->properties, (char*) CELIX_FRAMEWORK_SERVICE_VERSION, intfVersion);
+            }
         }
     } 
 
diff --git a/remote_services/remote_service_admin_dfi/rsa/private/src/import_registration_dfi.c b/remote_services/remote_service_admin_dfi/rsa/private/src/import_registration_dfi.c
index 2507ea8..7660f3e 100644
--- a/remote_services/remote_service_admin_dfi/rsa/private/src/import_registration_dfi.c
+++ b/remote_services/remote_service_admin_dfi/rsa/private/src/import_registration_dfi.c
@@ -73,7 +73,7 @@
 
         celixThreadMutex_create(&reg->mutex, NULL);
         celixThreadMutex_create(&reg->proxiesMutex, NULL);
-        version_createVersionFromString((char*)serviceVersion,&(reg->version));
+        status = version_createVersionFromString((char*)serviceVersion,&(reg->version));
 
         reg->factory->handle = reg;
         reg->factory->getService = (void *)importRegistration_getService;
@@ -86,6 +86,9 @@
         printf("IMPORT REGISTRATION IS %p\n", reg);
         *out = reg;
     }
+    else{
+    	importRegistration_destroy(reg);
+    }
 
     return status;
 }
@@ -203,16 +206,16 @@
     status = dfi_findDescriptor(import->context, bundle, import->classObject, &descriptor);
 
     if (status != CELIX_SUCCESS || descriptor == NULL) {
-        status = CELIX_BUNDLE_EXCEPTION;
         //TODO use log helper logHelper_log(helper, OSGI_LOGSERVICE_ERROR, "Cannot find/open descriptor for '%s'", import->classObject);
         fprintf(stderr, "RSA_DFI: Cannot find/open descriptor for '%s'", import->classObject);
+        return CELIX_BUNDLE_EXCEPTION;
     }
 
     if (status == CELIX_SUCCESS) {
         int rc = dynInterface_parse(descriptor, &intf);
         fclose(descriptor);
-        if (rc != 0) {
-            status = CELIX_BUNDLE_EXCEPTION;
+        if (rc != 0 || intf==NULL) {
+            return CELIX_BUNDLE_EXCEPTION;
         }
     }
 
diff --git a/remote_services/remote_service_admin_dfi/rsa/private/src/remote_service_admin_dfi.c b/remote_services/remote_service_admin_dfi/rsa/private/src/remote_service_admin_dfi.c
index 8d463c1..9feab9f 100644
--- a/remote_services/remote_service_admin_dfi/rsa/private/src/remote_service_admin_dfi.c
+++ b/remote_services/remote_service_admin_dfi/rsa/private/src/remote_service_admin_dfi.c
@@ -127,8 +127,8 @@
         status = CELIX_ENOMEM;
     } else {
         unsigned int port_counter = 0;
-        char *port = NULL;
-        char *ip = NULL;
+        const char *port = NULL;
+        const char *ip = NULL;
         char *detectedIp = NULL;
         (*admin)->context = context;
         (*admin)->exportedServices = hashMap_create(NULL, NULL, NULL, NULL);
@@ -154,10 +154,10 @@
 
         bundleContext_getProperty(context, "RSA_IP", &ip);
         if (ip == NULL) {
-            char *interface = NULL;
+            const char *interface = NULL;
 
             bundleContext_getProperty(context, "RSA_INTERFACE", &interface);
-            if ((interface != NULL) && (remoteServiceAdmin_getIpAdress(interface, &detectedIp) != CELIX_SUCCESS)) {
+            if ((interface != NULL) && (remoteServiceAdmin_getIpAdress((char*)interface, &detectedIp) != CELIX_SUCCESS)) {
                 logHelper_log((*admin)->loghelper, OSGI_LOGSERVICE_WARNING, "RSA: Could not retrieve IP adress for interface %s", interface);
             }
 
@@ -186,8 +186,10 @@
         memset(&callbacks, 0, sizeof(callbacks));
         callbacks.begin_request = remoteServiceAdmin_callback;
 
+        char newPort[10];
+
         do {
-            char newPort[10];
+
             const char *options[] = { "listening_ports", port, "num_threads", "5", NULL};
 
             (*admin)->ctx = mg_start(&callbacks, (*admin), options);
@@ -198,11 +200,10 @@
 
             }
             else {
-                char* endptr = port;
+            	errno = 0;
+                char* endptr = (char*)port;
                 int currentPort = strtol(port, &endptr, 10);
 
-                errno = 0;
-
                 if (*endptr || errno != 0) {
                     currentPort = strtol(DEFAULT_PORT, NULL, 10);
                 }
@@ -312,7 +313,7 @@
             char service[pos+1];
             strncpy(service, rest, pos);
             service[pos] = '\0';
-            long serviceId = atol(service);
+            unsigned long serviceId = strtoul(service,NULL,10);
 
             celixThreadMutex_lock(&rsa->exportedServicesLock);
 
@@ -365,7 +366,7 @@
                 free(data);
             } else {
                 result = 0;
-                RSA_LOG_WARNING(rsa, "NO export registration found for service id %i", serviceId);
+                RSA_LOG_WARNING(rsa, "NO export registration found for service id %lu", serviceId);
             }
 
             celixThreadMutex_unlock(&rsa->exportedServicesLock);
@@ -406,8 +407,8 @@
         status = CELIX_ILLEGAL_STATE;
     }
 
-    char *exports = NULL;
-    char *provided = NULL;
+    const char *exports = NULL;
+    const char *provided = NULL;
     if (status == CELIX_SUCCESS) {
         serviceReference_getProperty(reference, (char *) OSGI_RSA_SERVICE_EXPORTED_INTERFACES, &exports);
         serviceReference_getProperty(reference, (char *) OSGI_FRAMEWORK_OBJECTCLASS, &provided);
@@ -421,12 +422,12 @@
     }
 
     if (status == CELIX_SUCCESS) {
-        char *interface = provided;
+        const char *interface = provided;
         endpoint_description_pt endpoint = NULL;
         export_registration_pt registration = NULL;
 
-        remoteServiceAdmin_createEndpointDescription(admin, reference, properties, interface, &endpoint);
-        //TOOD precheck if descriptor exists
+        remoteServiceAdmin_createEndpointDescription(admin, reference, properties, (char*)interface, &endpoint);
+        //TODO precheck if descriptor exists
         status = exportRegistration_create(admin->loghelper, reference, endpoint, admin->context, &registration);
         if (status == CELIX_SUCCESS) {
             status = exportRegistration_start(registration);
@@ -458,7 +459,7 @@
     export_reference_pt  ref = NULL;
     status = exportRegistration_getExportReference(registration, &ref);
 
-    if (status == CELIX_SUCCESS) {
+    if (status == CELIX_SUCCESS && ref != NULL) {
     	service_reference_pt servRef;
         celixThreadMutex_lock(&admin->exportedServicesLock);
     	exportReference_getExportedService(ref, &servRef);
@@ -473,9 +474,8 @@
 
         celixThreadMutex_unlock(&admin->exportedServicesLock);
 
-        if (ref != NULL) {
-        	free(ref);
-        }
+        free(ref);
+
     } else {
     	logHelper_log(admin->loghelper, OSGI_LOGSERVICE_ERROR, "Cannot find reference for registration");
     }
@@ -495,7 +495,7 @@
     serviceReference_getPropertyKeys(reference, &keys, &size);
     for (int i = 0; i < size; i++) {
         char *key = keys[i];
-        char *value = NULL;
+        const char *value = NULL;
 
         if (serviceReference_getProperty(reference, key, &value) == CELIX_SUCCESS
             && strcmp(key, (char*) OSGI_RSA_SERVICE_EXPORTED_INTERFACES) != 0
@@ -508,7 +508,7 @@
 
     char* key = hashMapEntry_getKey(entry);
     char *serviceId = (char *) hashMap_remove(endpointProperties, (void *) OSGI_FRAMEWORK_SERVICE_ID);
-    char *uuid = NULL;
+    const char *uuid = NULL;
 
     char buf[512];
     snprintf(buf, 512,  "/service/%s/%s", serviceId, interface);
@@ -543,12 +543,12 @@
     if (!*endpoint) {
         status = CELIX_ENOMEM;
     } else {
-        (*endpoint)->id = properties_get(endpointProperties, (char*) OSGI_RSA_ENDPOINT_ID);
-        char *serviceId = NULL;
+        (*endpoint)->id = (char*)properties_get(endpointProperties, (char*) OSGI_RSA_ENDPOINT_ID);
+        const char *serviceId = NULL;
         serviceReference_getProperty(reference, (char*) OSGI_FRAMEWORK_SERVICE_ID, &serviceId);
         (*endpoint)->serviceId = strtoull(serviceId, NULL, 0);
-        (*endpoint)->frameworkUUID = properties_get(endpointProperties, (char*) OSGI_RSA_ENDPOINT_FRAMEWORK_UUID);
-        (*endpoint)->service = interface;
+        (*endpoint)->frameworkUUID = (char*) properties_get(endpointProperties, (char*) OSGI_RSA_ENDPOINT_FRAMEWORK_UUID);
+        (*endpoint)->service = strndup(interface, 1024*10);
         (*endpoint)->properties = endpointProperties;
     }
 
@@ -596,6 +596,7 @@
     celix_status_t status = CELIX_SUCCESS;
 
     properties_destroy((*description)->properties);
+    free((*description)->service);
     free(*description);
 
     return status;
@@ -625,11 +626,11 @@
     if (objectClass != NULL) {
         status = importRegistration_create(admin->context, endpointDescription, objectClass, serviceVersion, &import);
     }
-    if (status == CELIX_SUCCESS) {
+    if (status == CELIX_SUCCESS && import != NULL) {
         importRegistration_setSendFn(import, (send_func_type) remoteServiceAdmin_send, admin);
     }
 
-    if (status == CELIX_SUCCESS) {
+    if (status == CELIX_SUCCESS && import != NULL) {
         status = importRegistration_start(import);
     }
 
@@ -678,16 +679,16 @@
     get.size = 0;
     get.writeptr = malloc(1);
 
-    char *serviceUrl = properties_get(endpointDescription->properties, (char*) ENDPOINT_URL);
+    char *serviceUrl = (char*)properties_get(endpointDescription->properties, (char*) ENDPOINT_URL);
     char url[256];
     snprintf(url, 256, "%s", serviceUrl);
 
     // assume the default timeout
     int timeout = DEFAULT_TIMEOUT;
 
-    char *timeoutStr = NULL;
+    const char *timeoutStr = NULL;
     // Check if the endpoint has a timeout, if so, use it.
-    timeoutStr = properties_get(endpointDescription->properties, (char*) OSGI_RSA_REMOTE_PROXY_TIMEOUT);
+    timeoutStr = (char*) properties_get(endpointDescription->properties, (char*) OSGI_RSA_REMOTE_PROXY_TIMEOUT);
     if (timeoutStr == NULL) {
         // If not, get the global variable and use that one.
         bundleContext_getProperty(rsa->context, (char*) OSGI_RSA_REMOTE_PROXY_TIMEOUT, &timeoutStr);
@@ -708,7 +709,7 @@
     } else {
         curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
         curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout);
-        curl_easy_setopt(curl, CURLOPT_URL, &url[0]);
+        curl_easy_setopt(curl, CURLOPT_URL, url);
         curl_easy_setopt(curl, CURLOPT_POST, 1L);
         curl_easy_setopt(curl, CURLOPT_READFUNCTION, remoteServiceAdmin_readCallback);
         curl_easy_setopt(curl, CURLOPT_READDATA, &post);
@@ -770,4 +771,5 @@
     char buf2[256];
     vsnprintf(buf2, 256, msg, ap);
     logHelper_log(admin->loghelper, levels[level], "%s%s", buf1, buf2);
+    va_end(ap);
 }
diff --git a/remote_services/remote_service_admin_dfi/rsa_tst/rsa_tests.cpp b/remote_services/remote_service_admin_dfi/rsa_tst/rsa_tests.cpp
index d6db569..8b7988d 100644
--- a/remote_services/remote_service_admin_dfi/rsa_tst/rsa_tests.cpp
+++ b/remote_services/remote_service_admin_dfi/rsa_tst/rsa_tests.cpp
@@ -126,13 +126,13 @@
 
     static void testExportService(void) {
         int rc = 0;
-        char *calcId = NULL;
+        const char *calcId = NULL;
         array_list_pt regs = NULL;
 
         rc = serviceReference_getProperty(calcRef, (char *)"service.id", &calcId);
         CHECK_EQUAL(CELIX_SUCCESS, rc);
 
-        rc = rsa->exportService(rsa->admin, calcId, NULL, &regs);
+        rc = rsa->exportService(rsa->admin, (char*)calcId, NULL, &regs);
         CHECK_EQUAL(CELIX_SUCCESS, rc);
 
         CHECK_EQUAL(1, arrayList_size(regs));
diff --git a/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c b/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c
index 7be7571..0b05c1f 100644
--- a/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c
+++ b/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c
@@ -106,8 +106,8 @@
 		status = CELIX_ENOMEM;
 	} else {
 		unsigned int port_counter = 0;
-		char *port = NULL;
-		char *ip = NULL;
+		const char *port = NULL;
+		const char *ip = NULL;
 		char *detectedIp = NULL;
 		(*admin)->context = context;
 		(*admin)->exportedServices = hashMap_create(NULL, NULL, NULL, NULL);
@@ -129,10 +129,10 @@
 
 		#ifndef ANDROID
 		if (ip == NULL) {
-			char *interface = NULL;
+			const char *interface = NULL;
 
 			bundleContext_getProperty(context, "RSA_INTERFACE", &interface);
-			if ((interface != NULL) && (remoteServiceAdmin_getIpAdress(interface, &detectedIp) != CELIX_SUCCESS)) {
+			if ((interface != NULL) && (remoteServiceAdmin_getIpAdress((char*)interface, &detectedIp) != CELIX_SUCCESS)) {
 				logHelper_log((*admin)->loghelper, OSGI_LOGSERVICE_WARNING, "RSA: Could not retrieve IP adress for interface %s", interface);
 			}
 
@@ -162,8 +162,9 @@
 		memset(&callbacks, 0, sizeof(callbacks));
 		callbacks.begin_request = remoteServiceAdmin_callback;
 
+		char newPort[10];
 		do {
-			char newPort[10];
+
 			const char *options[] = { "listening_ports", port, NULL};
 
 			(*admin)->ctx = mg_start(&callbacks, (*admin), options);
@@ -171,10 +172,9 @@
 			if ((*admin)->ctx != NULL) {
 				logHelper_log((*admin)->loghelper, OSGI_LOGSERVICE_INFO, "RSA: Start webserver: %s", port);
 				(*admin)->port = strdup(port);
-
 			}
 			else {
-		        char* endptr = port;
+		        char* endptr = (char*)port;
 		        int currentPort = strtol(port, &endptr, 10);
 
 				errno = 0;
@@ -321,7 +321,7 @@
 				int expIt = 0;
 				for (expIt = 0; expIt < arrayList_size(exports); expIt++) {
 					export_registration_pt export = arrayList_get(exports, expIt);
-					long serviceId = atol(service);
+					unsigned long serviceId = strtoul(service,NULL,10);
 					if (serviceId == export->endpointDescription->serviceId && export->endpoint != NULL) {
 						uint64_t datalength = request_info->content_length;
 						char* data = malloc(datalength + 1);
@@ -387,12 +387,11 @@
 
 	bundleContext_getServiceReferences(admin->context, NULL, filter, &references);
 
-	if (arrayList_size(references) >= 1) {
-		reference = arrayList_get(references, 0);
-	}
-
-    if(references!=NULL){
-        arrayList_destroy(references);
+	if(references!=NULL){
+		if (arrayList_size(references) >= 1) {
+			reference = arrayList_get(references, 0);
+		}
+		arrayList_destroy(references);
     }
 
 	if (reference == NULL) {
@@ -400,14 +399,17 @@
 		return CELIX_ILLEGAL_STATE;
 	}
 
-	char *exports = NULL;
-	char *provided = NULL;
-	serviceReference_getProperty(reference, (char *) OSGI_RSA_SERVICE_EXPORTED_INTERFACES, &exports);
-	serviceReference_getProperty(reference, (char *) OSGI_FRAMEWORK_OBJECTCLASS, &provided);
-
-	if (exports == NULL || provided == NULL) {
+	const char *exportsProp = NULL;
+	const char *providedProp = NULL;
+	serviceReference_getProperty(reference, OSGI_RSA_SERVICE_EXPORTED_INTERFACES, &exportsProp);
+	serviceReference_getProperty(reference, OSGI_FRAMEWORK_OBJECTCLASS, &providedProp);
+	
+	if (exportsProp == NULL || providedProp == NULL) {
 		logHelper_log(admin->loghelper, OSGI_LOGSERVICE_WARNING, "RSA: No Services to export.");
 	} else {
+		char *exports = strndup(exportsProp, 1024*10);
+		char *provided = strndup(providedProp, 1024*10);
+
 		logHelper_log(admin->loghelper, OSGI_LOGSERVICE_INFO, "RSA: Export services (%s)", exports);
 		array_list_pt interfaces = NULL;
 		arrayList_create(&interfaces);
@@ -454,8 +456,12 @@
 
 		}
 		arrayList_destroy(interfaces);
+		free(exports);
+		free(provided);
 	}
 
+	
+
 	return status;
 }
 
@@ -467,7 +473,7 @@
 
     status = exportRegistration_getExportReference(registration, &ref);
 
-    if (status == CELIX_SUCCESS) {
+    if (status == CELIX_SUCCESS && ref != NULL) {
     	service_reference_pt servRef;
         celixThreadMutex_lock(&admin->exportedServicesLock);
     	exportReference_getExportedService(ref, &servRef);
@@ -482,9 +488,8 @@
 
         celixThreadMutex_unlock(&admin->exportedServicesLock);
 
-        if (ref != NULL) {
-        	free(ref);
-        }
+        free(ref);
+
     } else {
     	 logHelper_log(admin->loghelper, OSGI_LOGSERVICE_ERROR, "Cannot find reference for registration");
     }
@@ -503,7 +508,7 @@
     serviceReference_getPropertyKeys(reference, &keys, &size);
     for (int i = 0; i < size; i++) {
         char *key = keys[i];
-        char *value = NULL;
+        const char *value = NULL;
 
         if (serviceReference_getProperty(reference, key, &value) == CELIX_SUCCESS
         		&& strcmp(key, (char*) OSGI_RSA_SERVICE_EXPORTED_INTERFACES) != 0
@@ -516,7 +521,7 @@
 
 	char* key = hashMapEntry_getKey(entry);
 	char *serviceId = (char *) hashMap_remove(endpointProperties, (void *) OSGI_FRAMEWORK_SERVICE_ID);
-	char *uuid = NULL;
+	const char *uuid = NULL;
 
 	char buf[512];
 	snprintf(buf, 512,  "/service/%s/%s", serviceId, interface);
@@ -591,12 +596,12 @@
 	if (!*description) {
 		status = CELIX_ENOMEM;
 	} else {
-		(*description)->id = properties_get(endpointProperties, (char*) OSGI_RSA_ENDPOINT_ID);
-		char *serviceId = NULL;
-		serviceReference_getProperty(reference, (char*) OSGI_FRAMEWORK_SERVICE_ID, &serviceId);
+		(*description)->id = (char*)properties_get(endpointProperties, (char*) OSGI_RSA_ENDPOINT_ID);
+		const char *serviceId = NULL;
+		serviceReference_getProperty(reference, (char*)OSGI_FRAMEWORK_SERVICE_ID, &serviceId);
 		(*description)->serviceId = strtoull(serviceId, NULL, 0);
-		(*description)->frameworkUUID = properties_get(endpointProperties, (char*) OSGI_RSA_ENDPOINT_FRAMEWORK_UUID);
-		(*description)->service = interface;
+		(*description)->frameworkUUID = (char*)properties_get(endpointProperties, OSGI_RSA_ENDPOINT_FRAMEWORK_UUID);
+		(*description)->service = strndup(interface, 1024*10);
 		(*description)->properties = endpointProperties;
 	}
 
@@ -609,6 +614,7 @@
 	celix_status_t status = CELIX_SUCCESS;
 
 	properties_destroy((*description)->properties);
+	free((*description)->service);
 	free(*description);
 
 	return status;
@@ -725,7 +731,7 @@
 		get.size = 0;
 		get.writeptr = malloc(1);
 
-		char *serviceUrl = properties_get(endpointDescription->properties, (char *) ENDPOINT_URL);
+		const char* serviceUrl = properties_get(endpointDescription->properties, ENDPOINT_URL);
 		if (serviceUrl != NULL) {
 			snprintf(url, 256, "%s", serviceUrl);
 		} else {
@@ -740,13 +746,13 @@
 	int timeout = DEFAULT_TIMEOUT;
 
 	if (status == CELIX_SUCCESS) {
-		char *timeoutStr = NULL;
+		const char *timeoutStr = NULL;
 
 		// Check if the endpoint has a timeout, if so, use it.
-		timeoutStr = properties_get(endpointDescription->properties, (char *) OSGI_RSA_REMOTE_PROXY_TIMEOUT);
+		timeoutStr = (char*)properties_get(endpointDescription->properties, OSGI_RSA_REMOTE_PROXY_TIMEOUT);
 		if (timeoutStr == NULL) {
 			// If not, get the global variable and use that one.
-			status = bundleContext_getProperty(rsa->context, (char *) OSGI_RSA_REMOTE_PROXY_TIMEOUT, &timeoutStr);
+			status = bundleContext_getProperty(rsa->context, OSGI_RSA_REMOTE_PROXY_TIMEOUT, &timeoutStr);
 		}
 
 		// Update timeout if a property is used to set it.
@@ -766,7 +772,7 @@
 		} else {
 		    curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
 			curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout);
-			curl_easy_setopt(curl, CURLOPT_URL, &url[0]);
+			curl_easy_setopt(curl, CURLOPT_URL, url);
 			curl_easy_setopt(curl, CURLOPT_POST, 1L);
 			curl_easy_setopt(curl, CURLOPT_READFUNCTION, remoteServiceAdmin_readCallback);
 			curl_easy_setopt(curl, CURLOPT_READDATA, &post);
diff --git a/remote_services/remote_service_admin_http/private/test/rsa_client_server_tests.cpp b/remote_services/remote_service_admin_http/private/test/rsa_client_server_tests.cpp
index f26bdf3..19cf103 100644
--- a/remote_services/remote_service_admin_http/private/test/rsa_client_server_tests.cpp
+++ b/remote_services/remote_service_admin_http/private/test/rsa_client_server_tests.cpp
@@ -168,7 +168,7 @@
 
 			for (i = 0; i < size; i++) {
 				module_pt module = NULL;
-				char *name = NULL;
+				const char *name = NULL;
 
 				bundle_pt bundle = (bundle_pt) arrayList_get(bundles, i);
 
@@ -229,7 +229,7 @@
 
 			if (status == CELIX_SUCCESS) {
 				module_pt module = NULL;
-				char *name = NULL;
+				const char *name = NULL;
 
 				status = bundle_getCurrentModule(bundle, &module);
 
diff --git a/remote_services/remote_service_admin_shm/private/src/remote_service_admin_impl.c b/remote_services/remote_service_admin_shm/private/src/remote_service_admin_impl.c
index adcfe91..f090223 100644
--- a/remote_services/remote_service_admin_shm/private/src/remote_service_admin_impl.c
+++ b/remote_services/remote_service_admin_shm/private/src/remote_service_admin_impl.c
@@ -65,838 +65,860 @@
 celix_status_t remoteServiceAdmin_removeSharedIdentityFiles(remote_service_admin_pt admin);
 
 celix_status_t remoteServiceAdmin_create(bundle_context_pt context, remote_service_admin_pt *admin) {
-    celix_status_t status = CELIX_SUCCESS;
+	celix_status_t status = CELIX_SUCCESS;
 
-    *admin = calloc(1, sizeof(**admin));
+	*admin = calloc(1, sizeof(**admin));
 
-    if (!*admin) {
-        status = CELIX_ENOMEM;
-    } else {
-        (*admin)->context = context;
-        (*admin)->exportedServices = hashMap_create(NULL, NULL, NULL, NULL);
-        (*admin)->importedServices = hashMap_create(utils_stringHash, NULL, utils_stringEquals, NULL);
-        (*admin)->exportedIpcSegment = hashMap_create(NULL, NULL, NULL, NULL);
-        (*admin)->importedIpcSegment = hashMap_create(NULL, NULL, NULL, NULL);
-        (*admin)->pollThread = hashMap_create(NULL, NULL, NULL, NULL);
-        (*admin)->pollThreadRunning = hashMap_create(NULL, NULL, NULL, NULL);
+	if (!*admin) {
+		status = CELIX_ENOMEM;
+	} else {
+		(*admin)->context = context;
+		(*admin)->exportedServices = hashMap_create(NULL, NULL, NULL, NULL);
+		(*admin)->importedServices = hashMap_create(utils_stringHash, NULL, utils_stringEquals, NULL);
+		(*admin)->exportedIpcSegment = hashMap_create(NULL, NULL, NULL, NULL);
+		(*admin)->importedIpcSegment = hashMap_create(NULL, NULL, NULL, NULL);
+		(*admin)->pollThread = hashMap_create(NULL, NULL, NULL, NULL);
+		(*admin)->pollThreadRunning = hashMap_create(NULL, NULL, NULL, NULL);
 
-        if (logHelper_create(context, &(*admin)->loghelper) == CELIX_SUCCESS) {
-            logHelper_start((*admin)->loghelper);
-        }
-    }
+		if (logHelper_create(context, &(*admin)->loghelper) == CELIX_SUCCESS) {
+			logHelper_start((*admin)->loghelper);
+		}
+	}
 
-    return status;
+	return status;
 }
 
 celix_status_t remoteServiceAdmin_destroy(remote_service_admin_pt* admin) {
-    celix_status_t status = CELIX_SUCCESS;
+	celix_status_t status = CELIX_SUCCESS;
 
-    hashMap_destroy((*admin)->exportedServices, false, false);
-    hashMap_destroy((*admin)->importedServices, false, false);
-    hashMap_destroy((*admin)->exportedIpcSegment, false, false);
-    hashMap_destroy((*admin)->importedIpcSegment, false, false);
-    hashMap_destroy((*admin)->pollThread, false, false);
-    hashMap_destroy((*admin)->pollThreadRunning, false, false);
+	hashMap_destroy((*admin)->exportedServices, false, false);
+	hashMap_destroy((*admin)->importedServices, false, false);
+	hashMap_destroy((*admin)->exportedIpcSegment, false, false);
+	hashMap_destroy((*admin)->importedIpcSegment, false, false);
+	hashMap_destroy((*admin)->pollThread, false, false);
+	hashMap_destroy((*admin)->pollThreadRunning, false, false);
 
-    free(*admin);
+	free(*admin);
 
-    *admin = NULL;
+	*admin = NULL;
 
-    return status;
+	return status;
 }
 
 celix_status_t remoteServiceAdmin_stop(remote_service_admin_pt admin) {
-    celix_status_t status = CELIX_SUCCESS;
+	celix_status_t status = CELIX_SUCCESS;
 
-    celixThreadMutex_lock(&admin->exportedServicesLock);
+	celixThreadMutex_lock(&admin->exportedServicesLock);
 
-    hash_map_iterator_pt iter = hashMapIterator_create(admin->exportedServices);
-    while (hashMapIterator_hasNext(iter)) {
-        array_list_pt exports = hashMapIterator_nextValue(iter);
-        int i;
-        for (i = 0; i < arrayList_size(exports); i++) {
-            export_registration_pt export = arrayList_get(exports, i);
-            exportRegistration_stopTracking(export);
-        }
-    }
-    hashMapIterator_destroy(iter);
-    celixThreadMutex_unlock(&admin->exportedServicesLock);
+	hash_map_iterator_pt iter = hashMapIterator_create(admin->exportedServices);
+	while (hashMapIterator_hasNext(iter)) {
+		array_list_pt exports = hashMapIterator_nextValue(iter);
+		int i;
+		for (i = 0; i < arrayList_size(exports); i++) {
+			export_registration_pt export = arrayList_get(exports, i);
+			exportRegistration_stopTracking(export);
+		}
+	}
+	hashMapIterator_destroy(iter);
+	celixThreadMutex_unlock(&admin->exportedServicesLock);
 
-    celixThreadMutex_lock(&admin->importedServicesLock);
+	celixThreadMutex_lock(&admin->importedServicesLock);
 
-    iter = hashMapIterator_create(admin->importedServices);
-    while (hashMapIterator_hasNext(iter)) {
-        hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
+	iter = hashMapIterator_create(admin->importedServices);
+	while (hashMapIterator_hasNext(iter)) {
+		hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
 
-        char* service = hashMapEntry_getKey(entry);
-        import_registration_factory_pt importFactory = hashMapEntry_getValue(entry);
+		char* service = hashMapEntry_getKey(entry);
+		import_registration_factory_pt importFactory = hashMapEntry_getValue(entry);
 
-        if (importFactory != NULL) {
+		if (importFactory != NULL) {
 
-            int i;
-            for (i = 0; i < arrayList_size(importFactory->registrations); i++) {
-                import_registration_pt importRegistration = arrayList_get(importFactory->registrations, i);
+			int i;
+			for (i = 0; i < arrayList_size(importFactory->registrations); i++) {
+				import_registration_pt importRegistration = arrayList_get(importFactory->registrations, i);
 
-                if (importFactory->trackedFactory != NULL) {
-                    importFactory->trackedFactory->unregisterProxyService(importFactory->trackedFactory->factory, importRegistration->endpointDescription);
-                }
-            }
-            serviceTracker_close(importFactory->proxyFactoryTracker);
-            importRegistrationFactory_close(importFactory);
+				if (importFactory->trackedFactory != NULL) {
+					importFactory->trackedFactory->unregisterProxyService(importFactory->trackedFactory->factory, importRegistration->endpointDescription);
+				}
+			}
+			serviceTracker_close(importFactory->proxyFactoryTracker);
+			importRegistrationFactory_close(importFactory);
 
-            hashMap_remove(admin->importedServices, service);
-            importRegistrationFactory_destroy(&importFactory);
-        }
-    }
-    hashMapIterator_destroy(iter);
-    celixThreadMutex_unlock(&admin->importedServicesLock);
+			hashMap_remove(admin->importedServices, service);
+			importRegistrationFactory_destroy(&importFactory);
+		}
+	}
+	hashMapIterator_destroy(iter);
+	celixThreadMutex_unlock(&admin->importedServicesLock);
 
-    // set stop-thread-variable
-    iter = hashMapIterator_create(admin->pollThreadRunning);
-    while (hashMapIterator_hasNext(iter)) {
-        bool *pollThreadRunning = hashMapIterator_nextValue(iter);
-        *pollThreadRunning = false;
-    }
-    hashMapIterator_destroy(iter);
+	// set stop-thread-variable
+	iter = hashMapIterator_create(admin->pollThreadRunning);
+	while (hashMapIterator_hasNext(iter)) {
+		bool *pollThreadRunning = hashMapIterator_nextValue(iter);
+		*pollThreadRunning = false;
+	}
+	hashMapIterator_destroy(iter);
 
-    // release lock
-    iter = hashMapIterator_create(admin->exportedIpcSegment);
-    while (hashMapIterator_hasNext(iter)) {
-        ipc_segment_pt ipc = hashMapIterator_nextValue(iter);
-        remoteServiceAdmin_unlock(ipc->semId, 1);
-    }
-    hashMapIterator_destroy(iter);
+	// release lock
+	iter = hashMapIterator_create(admin->exportedIpcSegment);
+	while (hashMapIterator_hasNext(iter)) {
+		ipc_segment_pt ipc = hashMapIterator_nextValue(iter);
+		remoteServiceAdmin_unlock(ipc->semId, 1);
+	}
+	hashMapIterator_destroy(iter);
 
-    // wait till threads has stopped
-    iter = hashMapIterator_create(admin->pollThread);
-    while (hashMapIterator_hasNext(iter)) {
-        celix_thread_t *pollThread = hashMapIterator_nextValue(iter);
+	// wait till threads has stopped
+	iter = hashMapIterator_create(admin->pollThread);
+	while (hashMapIterator_hasNext(iter)) {
+		celix_thread_t *pollThread = hashMapIterator_nextValue(iter);
 
-        if (pollThread != NULL) {
-            status = celixThread_join(*pollThread, NULL);
-        }
-    }
-    hashMapIterator_destroy(iter);
+		if (pollThread != NULL) {
+			status = celixThread_join(*pollThread, NULL);
+		}
+	}
+	hashMapIterator_destroy(iter);
 
-    iter = hashMapIterator_create(admin->importedIpcSegment);
-    while (hashMapIterator_hasNext(iter)) {
-        ipc_segment_pt ipc = hashMapIterator_nextValue(iter);
-        remoteServiceAdmin_detachIpcSegment(ipc);
-        free(ipc);
-    }
-    hashMapIterator_destroy(iter);
+	iter = hashMapIterator_create(admin->importedIpcSegment);
+	while (hashMapIterator_hasNext(iter)) {
+		ipc_segment_pt ipc = hashMapIterator_nextValue(iter);
+		remoteServiceAdmin_detachIpcSegment(ipc);
+		free(ipc);
+	}
+	hashMapIterator_destroy(iter);
 
-    iter = hashMapIterator_create(admin->exportedIpcSegment);
-    while (hashMapIterator_hasNext(iter)) {
-        ipc_segment_pt ipc = hashMapIterator_nextValue(iter);
-        remoteServiceAdmin_deleteIpcSegment(ipc);
-        free(ipc);
-    }
-    hashMapIterator_destroy(iter);
+	iter = hashMapIterator_create(admin->exportedIpcSegment);
+	while (hashMapIterator_hasNext(iter)) {
+		ipc_segment_pt ipc = hashMapIterator_nextValue(iter);
+		remoteServiceAdmin_deleteIpcSegment(ipc);
+		free(ipc);
+	}
+	hashMapIterator_destroy(iter);
 
-    remoteServiceAdmin_removeSharedIdentityFiles(admin);
+	remoteServiceAdmin_removeSharedIdentityFiles(admin);
 
-    logHelper_stop(admin->loghelper);
-    logHelper_destroy(&admin->loghelper);
-    return status;
+	logHelper_stop(admin->loghelper);
+	logHelper_destroy(&admin->loghelper);
+	return status;
 }
 
 static int remoteServiceAdmin_getCount(int semId, int semNr) {
-    int token = -1;
-    unsigned short semVals[3];
-    union semun semArg;
+	int token = -1;
+	unsigned short semVals[3];
+	union semun semArg;
 
-    semArg.array = semVals;
+	semArg.array = semVals;
 
-    if (semctl(semId, 0, GETALL, semArg) == 0) {
-        token = semArg.array[semNr];
-    }
+	if (semctl(semId, 0, GETALL, semArg) == 0) {
+		token = semArg.array[semNr];
+	}
 
-    return token;
+	return token;
 }
 
 static celix_status_t remoteServiceAdmin_lock(int semId, int semNr) {
-    celix_status_t status = CELIX_SUCCESS;
-    int semOpStatus = 0;
-    struct sembuf semOperation;
+	celix_status_t status = CELIX_SUCCESS;
+	int semOpStatus = 0;
+	struct sembuf semOperation;
 
-    semOperation.sem_num = semNr;
-    semOperation.sem_op = -1;
-    semOperation.sem_flg = 0;
+	semOperation.sem_num = semNr;
+	semOperation.sem_op = -1;
+	semOperation.sem_flg = 0;
 
-    do {
-        status = CELIX_SUCCESS;
+	do {
+		status = CELIX_SUCCESS;
 
-        if ((semOpStatus = semop(semId, &semOperation, 1)) != 0) {
-            status = CELIX_BUNDLE_EXCEPTION;
-        }
-    } while (semOpStatus == -1 && errno == EINTR);
+		if ((semOpStatus = semop(semId, &semOperation, 1)) != 0) {
+			status = CELIX_BUNDLE_EXCEPTION;
+		}
+	} while (semOpStatus == -1 && errno == EINTR);
 
-    return status;
+	return status;
 }
 
 static celix_status_t remoteServiceAdmin_unlock(int semId, int semNr) {
-    celix_status_t status = CELIX_SUCCESS;
-    int semOpStatus = 0;
-    struct sembuf semOperation;
+	celix_status_t status = CELIX_SUCCESS;
+	int semOpStatus = 0;
+	struct sembuf semOperation;
 
-    semOperation.sem_num = semNr;
-    semOperation.sem_op = 1;
-    semOperation.sem_flg = 0;
+	semOperation.sem_num = semNr;
+	semOperation.sem_op = 1;
+	semOperation.sem_flg = 0;
 
-    do {
-        status = CELIX_SUCCESS;
+	do {
+		status = CELIX_SUCCESS;
 
-        if ((semOpStatus = semop(semId, &semOperation, 1)) != 0) {
-            status = CELIX_BUNDLE_EXCEPTION;
-        }
-    } while (semOpStatus == -1 && errno == EINTR);
+		if ((semOpStatus = semop(semId, &semOperation, 1)) != 0) {
+			status = CELIX_BUNDLE_EXCEPTION;
+		}
+	} while (semOpStatus == -1 && errno == EINTR);
 
-    return status;
+	return status;
 }
 
 celix_status_t remoteServiceAdmin_send(remote_service_admin_pt admin, endpoint_description_pt recpEndpoint, char *request, char **reply, int *replyStatus) {
-    celix_status_t status = CELIX_SUCCESS;
-    ipc_segment_pt ipc = NULL;
+	celix_status_t status = CELIX_SUCCESS;
+	ipc_segment_pt ipc = NULL;
 
-    if ((ipc = hashMap_get(admin->importedIpcSegment, recpEndpoint->service)) != NULL) {
-        int semid = ipc->semId;
+	if ((ipc = hashMap_get(admin->importedIpcSegment, recpEndpoint->service)) != NULL) {
+		int semid = ipc->semId;
 
-        /* lock critical area */
-        remoteServiceAdmin_lock(semid, 0);
+		/* lock critical area */
+		remoteServiceAdmin_lock(semid, 0);
 
-        /* write method and data */
-        strcpy(ipc->shmBaseAdress, request);
+		/* write method and data */
+		strcpy(ipc->shmBaseAdress, request);
 
-        /* Check the status of the send-receive semaphore and reset them if not correct */
-        if (remoteServiceAdmin_getCount(ipc->semId, 1) > 0) {
-            semctl(semid, 1, SETVAL, (int) 0);
-        }
-        if (remoteServiceAdmin_getCount(ipc->semId, 2) > 0) {
-            semctl(semid, 2, SETVAL, (int) 0);
-        }
+		/* Check the status of the send-receive semaphore and reset them if not correct */
+		if (remoteServiceAdmin_getCount(ipc->semId, 1) > 0) {
+			semctl(semid, 1, SETVAL, (int) 0);
+		}
+		if (remoteServiceAdmin_getCount(ipc->semId, 2) > 0) {
+			semctl(semid, 2, SETVAL, (int) 0);
+		}
 
-        /* Inform receiver we are invoking the remote service */
-        remoteServiceAdmin_unlock(semid, 1);
+		/* Inform receiver we are invoking the remote service */
+		remoteServiceAdmin_unlock(semid, 1);
 
-        /* Wait until the receiver finished his operations */
-        remoteServiceAdmin_lock(semid, 2);
+		/* Wait until the receiver finished his operations */
+		remoteServiceAdmin_lock(semid, 2);
 
-        /* read reply */
-        *reply = strdup(ipc->shmBaseAdress);
+		/* read reply */
+		*reply = strdup(ipc->shmBaseAdress);
 
-        /* TODO: fix replyStatus */
-        *replyStatus = 0;
+		/* TODO: fix replyStatus */
+		*replyStatus = 0;
 
-        /* release critical area */
-        remoteServiceAdmin_unlock(semid, 0);
+		/* release critical area */
+		remoteServiceAdmin_unlock(semid, 0);
 
-    } else {
-        status = CELIX_ILLEGAL_STATE; /* could not find ipc segment */
-    }
+	} else {
+		status = CELIX_ILLEGAL_STATE; /* could not find ipc segment */
+	}
 
-    return status;
+	return status;
 }
 
 static void * remoteServiceAdmin_receiveFromSharedMemory(void *data) {
-    recv_shm_thread_pt thread_data = data;
+	recv_shm_thread_pt thread_data = data;
 
-    remote_service_admin_pt admin = thread_data->admin;
-    endpoint_description_pt exportedEndpointDesc = thread_data->endpointDescription;
+	remote_service_admin_pt admin = thread_data->admin;
+	endpoint_description_pt exportedEndpointDesc = thread_data->endpointDescription;
 
-    ipc_segment_pt ipc;
+	ipc_segment_pt ipc;
 
-    if ((ipc = hashMap_get(admin->exportedIpcSegment, exportedEndpointDesc->service)) != NULL) {
-        bool *pollThreadRunning = hashMap_get(admin->pollThreadRunning, exportedEndpointDesc);
+	if ((ipc = hashMap_get(admin->exportedIpcSegment, exportedEndpointDesc->service)) != NULL) {
+		bool *pollThreadRunning = hashMap_get(admin->pollThreadRunning, exportedEndpointDesc);
 
-        while (*pollThreadRunning == true) {
-            if ((remoteServiceAdmin_lock(ipc->semId, 1) == CELIX_SUCCESS) && (*pollThreadRunning == true)) {
+		while (*pollThreadRunning == true) {
+			if ((remoteServiceAdmin_lock(ipc->semId, 1) == CELIX_SUCCESS) && (*pollThreadRunning == true)) {
 
-                // TODO: align data size
-                char *data = calloc(1024, sizeof(*data));
-                strcpy(data, ipc->shmBaseAdress);
+				// TODO: align data size
+				char *data = calloc(1024, sizeof(*data));
+				strcpy(data, ipc->shmBaseAdress);
 
-                hash_map_iterator_pt iter = hashMapIterator_create(admin->exportedServices);
+				hash_map_iterator_pt iter = hashMapIterator_create(admin->exportedServices);
 
-                while (hashMapIterator_hasNext(iter)) {
-                    hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
-                    array_list_pt exports = hashMapEntry_getValue(entry);
-                    int expIt = 0;
+				while (hashMapIterator_hasNext(iter)) {
+					hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
+					array_list_pt exports = hashMapEntry_getValue(entry);
+					int expIt = 0;
 
-                    for (expIt = 0; expIt < arrayList_size(exports); expIt++) {
-                        export_registration_pt export = arrayList_get(exports, expIt);
+					for (expIt = 0; expIt < arrayList_size(exports); expIt++) {
+						export_registration_pt export = arrayList_get(exports, expIt);
 
-                        if ((strcmp(exportedEndpointDesc->service, export->endpointDescription->service) == 0) && (export->endpoint != NULL)) {
-                            char *reply = NULL;
+						if ((strcmp(exportedEndpointDesc->service, export->endpointDescription->service) == 0) && (export->endpoint != NULL)) {
+							char *reply = NULL;
 
-                            /* TODO: fix handling of handleRequest return value*/
-                            export->endpoint->handleRequest(export->endpoint->endpoint, data, &reply);
+							/* TODO: fix handling of handleRequest return value*/
+									export->endpoint->handleRequest(export->endpoint->endpoint, data, &reply);
 
-                            if (reply != NULL) {
-                                if ((strlen(reply) * sizeof(char)) >= RSA_SHM_MEMSIZE) {
-                                    logHelper_log(admin->loghelper, OSGI_LOGSERVICE_ERROR, "receiveFromSharedMemory : size of message bigger than shared memory message. NOT SENDING.");
-                                } else {
-                                    strcpy(ipc->shmBaseAdress, reply);
-                                }
-                                free(reply);
-                            }
-                        } else {
-                            logHelper_log(admin->loghelper, OSGI_LOGSERVICE_ERROR, "receiveFromSharedMemory : No endpoint set for %s.", export->endpointDescription->service);
-                        }
-                    }
-                }
-                hashMapIterator_destroy(iter);
-                free(data);
+									if (reply != NULL) {
+										if ((strlen(reply) * sizeof(char)) >= RSA_SHM_MEMSIZE) {
+											logHelper_log(admin->loghelper, OSGI_LOGSERVICE_ERROR, "receiveFromSharedMemory : size of message bigger than shared memory message. NOT SENDING.");
+										} else {
+											strcpy(ipc->shmBaseAdress, reply);
+										}
+										free(reply);
+									}
+						} else {
+							logHelper_log(admin->loghelper, OSGI_LOGSERVICE_ERROR, "receiveFromSharedMemory : No endpoint set for %s.", export->endpointDescription->service);
+						}
+					}
+				}
+				hashMapIterator_destroy(iter);
+				free(data);
 
-                remoteServiceAdmin_unlock(ipc->semId, 2);
+				remoteServiceAdmin_unlock(ipc->semId, 2);
 
-            }
-        }
-    }
+			}
+		}
+	}
 
-    free(data);
+	free(data);
 
-    return NULL;
+	return NULL;
 }
 
 celix_status_t remoteServiceAdmin_getSharedIdentifierFile(remote_service_admin_pt admin, char *fwUuid, char* servicename, char* outFile) {
-    celix_status_t status = CELIX_SUCCESS;
-    snprintf(outFile, RSA_FILEPATH_LENGTH, "%s/%s/%s", P_tmpdir, fwUuid, servicename);
+	celix_status_t status = CELIX_SUCCESS;
+	snprintf(outFile, RSA_FILEPATH_LENGTH, "%s/%s/%s", P_tmpdir, fwUuid, servicename);
 
-    if (access(outFile, F_OK) != 0) {
-        char tmpDir[RSA_FILEPATH_LENGTH];
+	if (access(outFile, F_OK) != 0) {
+		char tmpDir[RSA_FILEPATH_LENGTH];
 
-        snprintf(tmpDir, RSA_FILEPATH_LENGTH, "%s/%s", P_tmpdir, fwUuid);
+		snprintf(tmpDir, RSA_FILEPATH_LENGTH, "%s/%s", P_tmpdir, fwUuid);
 
-        // we call, even if it already exists (and just don't care about the return value)
-        mkdir(tmpDir, 0755);
+		if(mkdir(tmpDir, 0755) == -1 ){
+			logHelper_log(admin->loghelper, OSGI_LOGSERVICE_ERROR, "error while creating directory %s (%s)", tmpDir, strerror(errno));
+		}
+		FILE *shid_file = fopen(outFile, "wb");
+		if (shid_file == NULL) {
+			logHelper_log(admin->loghelper, OSGI_LOGSERVICE_ERROR, "error while creating shared identifier file %s (%s)", outFile, strerror(errno));
+			status = CELIX_FILE_IO_EXCEPTION;
+		} else {
+			logHelper_log(admin->loghelper, OSGI_LOGSERVICE_DEBUG, "create shared identifier file %s", outFile);
+			fclose(shid_file);
+		}
+	} else {
+		logHelper_log(admin->loghelper, OSGI_LOGSERVICE_DEBUG, "shared identifier file %s already exists", outFile);
+	}
 
-        if (fopen(outFile, "wb") == NULL) {
-            logHelper_log(admin->loghelper, OSGI_LOGSERVICE_ERROR, "error while creating shared identifier file %s (%s)", outFile, strerror(errno));
-            status = CELIX_FILE_IO_EXCEPTION;
-        } else {
-            logHelper_log(admin->loghelper, OSGI_LOGSERVICE_DEBUG, "create shared identifier file %s", outFile);
-        }
-    } else {
-        logHelper_log(admin->loghelper, OSGI_LOGSERVICE_DEBUG, "shared identifier file %s already exists", outFile);
-    }
-
-    return status;
+	return status;
 }
 
 celix_status_t remoteServiceAdmin_removeSharedIdentityFile(remote_service_admin_pt admin, char *fwUuid, char* servicename) {
-    celix_status_t status = CELIX_SUCCESS;
-    char tmpPath[RSA_FILEPATH_LENGTH];
+	celix_status_t status = CELIX_SUCCESS;
+	char tmpPath[RSA_FILEPATH_LENGTH];
+	int retVal = 0;
 
-    snprintf(tmpPath, RSA_FILEPATH_LENGTH, "%s/%s/%s", P_tmpdir, fwUuid, servicename);
+	snprintf(tmpPath, RSA_FILEPATH_LENGTH, "%s/%s/%s", P_tmpdir, fwUuid, servicename);
 
-    if (access(tmpPath, F_OK) == 0) {
-        logHelper_log(admin->loghelper, OSGI_LOGSERVICE_DEBUG, "removing shared identifier file %s", tmpPath);
-        unlink(tmpPath);
-    } else {
-        logHelper_log(admin->loghelper, OSGI_LOGSERVICE_ERROR, "cannot remove shared identifier file %s", tmpPath);
-    }
+	retVal = unlink(tmpPath);
 
-    return status;
+	if (retVal == 0) {
+		logHelper_log(admin->loghelper, OSGI_LOGSERVICE_DEBUG, "Removed shared identifier file %s", tmpPath);
+	} else {
+		logHelper_log(admin->loghelper, OSGI_LOGSERVICE_ERROR, "Cannot remove shared identifier file %s", tmpPath);
+		status = CELIX_FILE_IO_EXCEPTION;
+	}
+
+	return status;
 }
 
 celix_status_t remoteServiceAdmin_removeSharedIdentityFiles(remote_service_admin_pt admin) {
-    char tmpDir[RSA_FILEPATH_LENGTH];
-    char* fwUuid = NULL;
-    bundleContext_getProperty(admin->context, OSGI_FRAMEWORK_FRAMEWORK_UUID, &fwUuid);
+	char tmpDir[RSA_FILEPATH_LENGTH];
+	const char* fwUuid = NULL;
+	bundleContext_getProperty(admin->context, OSGI_FRAMEWORK_FRAMEWORK_UUID, &fwUuid);
 
-    snprintf(tmpDir, RSA_FILEPATH_LENGTH, "%s/%s", P_tmpdir, fwUuid);
+	snprintf(tmpDir, RSA_FILEPATH_LENGTH, "%s/%s", P_tmpdir, fwUuid);
 
-    DIR *d = opendir(tmpDir);
-    size_t path_len = strlen(tmpDir);
-    int retVal = 0;
+	DIR *d = opendir(tmpDir);
+	size_t path_len = strlen(tmpDir);
+	int retVal = 0;
 
-    if (d) {
-        struct dirent *p;
+	if (d) {
+		struct dirent *p;
 
-        while (!retVal && (p = readdir(d))) {
-            char* f_name;
-            size_t len;
+		while (!retVal && (p = readdir(d))) {
+			char* f_name;
+			size_t len;
 
-            if (!strcmp(p->d_name, ".") || !strcmp(p->d_name, "..")) {
-                continue;
-            }
+			if (!strcmp(p->d_name, ".") || !strcmp(p->d_name, "..")) {
+				continue;
+			}
 
-            len = path_len + strlen(p->d_name) + 2;
-            f_name = (char*) calloc(len, 1);
+			len = path_len + strlen(p->d_name) + 2;
+			f_name = (char*) calloc(len, 1);
 
-            if (f_name) {
-                struct stat statbuf;
+			if (f_name) {
+				snprintf(f_name, len, "%s/%s", tmpDir, p->d_name);
 
-                snprintf(f_name, len, "%s/%s", tmpDir, p->d_name);
+				retVal = unlink(f_name);
 
-                if (!stat(f_name, &statbuf)) {
-                    logHelper_log(admin->loghelper, OSGI_LOGSERVICE_WARNING, "removing shared identifier file %s (unproper clean-up?)", f_name);
-                    retVal = unlink(f_name);
-                }
-            }
-            free(f_name);
-        }
-    }
+				if(retVal==0){
+					logHelper_log(admin->loghelper, OSGI_LOGSERVICE_WARNING, "Removed shared identifier file %s (unproper clean-up?)", f_name);
+				}
+				else{
+					logHelper_log(admin->loghelper, OSGI_LOGSERVICE_WARNING, "Unable to remove shared identifier file %s ", f_name);
+				}
 
-    closedir(d);
+			}
+			free(f_name);
+		}
+	}
 
-    if (!retVal) {
-        rmdir(tmpDir);
-    }
+	closedir(d);
 
-    return retVal;
+	if (!retVal) {
+		rmdir(tmpDir);
+	}
+
+	return retVal;
 }
 
 celix_status_t remoteServiceAdmin_exportService(remote_service_admin_pt admin, char *serviceId, properties_pt properties, array_list_pt *registrations) {
-    celix_status_t status = CELIX_SUCCESS;
-    arrayList_create(registrations);
+	celix_status_t status = CELIX_SUCCESS;
+	arrayList_create(registrations);
 
-    array_list_pt references = NULL;
-    service_reference_pt reference = NULL;
-    char filter[256];
-    char *exports = NULL;
-    char *provided = NULL;
+	array_list_pt references = NULL;
+	service_reference_pt reference = NULL;
+	char filter[256];
+	const char *exportsProp = NULL;
+	const char *providedProp = NULL;
 
-    snprintf(filter, 256, "(%s=%s)", (char *) OSGI_FRAMEWORK_SERVICE_ID, serviceId);
+	snprintf(filter, 256, "(%s=%s)", (char *) OSGI_FRAMEWORK_SERVICE_ID, serviceId);
 
-    bundleContext_getServiceReferences(admin->context, NULL, filter, &references);
+	bundleContext_getServiceReferences(admin->context, NULL, filter, &references);
 
-    if (arrayList_size(references) >= 1) {
-        reference = arrayList_get(references, 0);
-    }
+	if (arrayList_size(references) >= 1) {
+		reference = arrayList_get(references, 0);
+	}
 
-    arrayList_destroy(references);
+	arrayList_destroy(references);
 
-    serviceReference_getProperty(reference, (char *) OSGI_RSA_SERVICE_EXPORTED_INTERFACES, &exports);
-    serviceReference_getProperty(reference, (char *) OSGI_FRAMEWORK_OBJECTCLASS, &provided);
+	serviceReference_getProperty(reference, (char *) OSGI_RSA_SERVICE_EXPORTED_INTERFACES, &exportsProp);
+	serviceReference_getProperty(reference, (char *) OSGI_FRAMEWORK_OBJECTCLASS, &providedProp);
 
+	char* exports = strndup(exportsProp, 1024*10);
+	char* provided = strndup(providedProp, 1024*10);
 
-    if (reference == NULL) {
-        logHelper_log(admin->loghelper, OSGI_LOGSERVICE_ERROR, "expected a reference for service id %s.", serviceId);
-        status = CELIX_ILLEGAL_STATE;
-    }
-    else if (exports == NULL || provided == NULL) {
-        logHelper_log(admin->loghelper, OSGI_LOGSERVICE_WARNING, "No Services to export.");
-    } else {
-        logHelper_log(admin->loghelper, OSGI_LOGSERVICE_INFO, "Export services (%s)", exports);
-        array_list_pt interfaces = NULL;
-        arrayList_create(&interfaces);
-        if (strcmp(utils_stringTrim(exports), "*") == 0) {
-            char *provided_save_ptr = NULL;
-            char *interface = strtok_r(provided, ",", &provided_save_ptr);
-            while (interface != NULL) {
-                arrayList_add(interfaces, utils_stringTrim(interface));
-                interface = strtok_r(NULL, ",", &provided_save_ptr);
-            }
-        } else {
-            char *provided_save_ptr = NULL;
-            char *pinterface = strtok_r(provided, ",", &provided_save_ptr);
-            while (pinterface != NULL) {
-                char *exports_save_ptr = NULL;
-                char *einterface = strtok_r(exports, ",", &exports_save_ptr);
-                while (einterface != NULL) {
-                    if (strcmp(einterface, pinterface) == 0) {
-                        arrayList_add(interfaces, einterface);
-                    }
-                    einterface = strtok_r(NULL, ",", &exports_save_ptr);
-                }
-                pinterface = strtok_r(NULL, ",", &provided_save_ptr);
-            }
-        }
+	if (reference == NULL) {
+		logHelper_log(admin->loghelper, OSGI_LOGSERVICE_ERROR, "expected a reference for service id %s.", serviceId);
+		status = CELIX_ILLEGAL_STATE;
+	}
+	else if (exports == NULL || provided == NULL) {
+		logHelper_log(admin->loghelper, OSGI_LOGSERVICE_WARNING, "No Services to export.");
+	} else {
+		logHelper_log(admin->loghelper, OSGI_LOGSERVICE_INFO, "Export services (%s)", exports);
+		array_list_pt interfaces = NULL;
+		arrayList_create(&interfaces);
+		if (strcmp(utils_stringTrim(exports), "*") == 0) {
+			char *provided_save_ptr = NULL;
+			char *interface = strtok_r(provided, ",", &provided_save_ptr);
+			while (interface != NULL) {
+				arrayList_add(interfaces, utils_stringTrim(interface));
+				interface = strtok_r(NULL, ",", &provided_save_ptr);
+			}
+		} else {
+			char *provided_save_ptr = NULL;
+			char *pinterface = strtok_r(provided, ",", &provided_save_ptr);
+			while (pinterface != NULL) {
+				char *exports_save_ptr = NULL;
+				char *einterface = strtok_r(exports, ",", &exports_save_ptr);
+				while (einterface != NULL) {
+					if (strcmp(einterface, pinterface) == 0) {
+						arrayList_add(interfaces, einterface);
+					}
+					einterface = strtok_r(NULL, ",", &exports_save_ptr);
+				}
+				pinterface = strtok_r(NULL, ",", &provided_save_ptr);
+			}
+		}
 
-        if (arrayList_size(interfaces) != 0) {
-            int iter = 0;
-            for (iter = 0; iter < arrayList_size(interfaces); iter++) {
-                char *interface = arrayList_get(interfaces, iter);
-                export_registration_pt registration = NULL;
+		if (arrayList_size(interfaces) != 0) {
+			int iter = 0;
+			for (iter = 0; iter < arrayList_size(interfaces); iter++) {
+				char *interface = arrayList_get(interfaces, iter);
+				export_registration_pt registration = NULL;
 
-                exportRegistration_create(admin->loghelper, reference, NULL, admin, admin->context, &registration);
-                arrayList_add(*registrations, registration);
+				exportRegistration_create(admin->loghelper, reference, NULL, admin, admin->context, &registration);
+				arrayList_add(*registrations, registration);
 
-                remoteServiceAdmin_installEndpoint(admin, registration, reference, interface);
-                exportRegistration_open(registration);
-                exportRegistration_startTracking(registration);
+				remoteServiceAdmin_installEndpoint(admin, registration, reference, interface);
+				exportRegistration_open(registration);
+				exportRegistration_startTracking(registration);
 
-                if (remoteServiceAdmin_createOrAttachShm(admin->exportedIpcSegment, admin, registration->endpointDescription, true) == CELIX_SUCCESS) {
-                    recv_shm_thread_pt recvThreadData = NULL;
+				if (remoteServiceAdmin_createOrAttachShm(admin->exportedIpcSegment, admin, registration->endpointDescription, true) == CELIX_SUCCESS) {
+					recv_shm_thread_pt recvThreadData = NULL;
 
-                    if ((recvThreadData = calloc(1, sizeof(*recvThreadData))) == NULL) {
-                        status = CELIX_ENOMEM;
-                    } else {
-                        recvThreadData->admin = admin;
-                        recvThreadData->endpointDescription = registration->endpointDescription;
+					if ((recvThreadData = calloc(1, sizeof(*recvThreadData))) == NULL) {
+						status = CELIX_ENOMEM;
+					} else {
+						recvThreadData->admin = admin;
+						recvThreadData->endpointDescription = registration->endpointDescription;
 
-                        celix_thread_t* pollThread = calloc(1, sizeof(*pollThread));
-                        bool *pollThreadRunningPtr = calloc(1, sizeof(*pollThreadRunningPtr));
-                        *pollThreadRunningPtr = true;
+						celix_thread_t* pollThread = calloc(1, sizeof(*pollThread));
+						bool *pollThreadRunningPtr = calloc(1, sizeof(*pollThreadRunningPtr));
+						*pollThreadRunningPtr = true;
 
-                        hashMap_put(admin->pollThreadRunning, registration->endpointDescription, pollThreadRunningPtr);
+						hashMap_put(admin->pollThreadRunning, registration->endpointDescription, pollThreadRunningPtr);
 
-                        // start receiving thread
-                        status = celixThread_create(pollThread, NULL, remoteServiceAdmin_receiveFromSharedMemory, recvThreadData);
+						// start receiving thread
+						status = celixThread_create(pollThread, NULL, remoteServiceAdmin_receiveFromSharedMemory, recvThreadData);
 
-                        hashMap_put(admin->pollThread, registration->endpointDescription, pollThread);
-                    }
-                }
-            }
+						hashMap_put(admin->pollThread, registration->endpointDescription, pollThread);
+					}
+				}
+			}
 
-            celixThreadMutex_lock(&admin->exportedServicesLock);
-            hashMap_put(admin->exportedServices, reference, *registrations);
-            celixThreadMutex_unlock(&admin->exportedServicesLock);
+			celixThreadMutex_lock(&admin->exportedServicesLock);
+			hashMap_put(admin->exportedServices, reference, *registrations);
+			celixThreadMutex_unlock(&admin->exportedServicesLock);
 
-        }
-        arrayList_destroy(interfaces);
-    }
+		}
+		arrayList_destroy(interfaces);
+	}
 
-    return status;
+	free(exports);
+	free(provided);
+
+	return status;
 }
 
 celix_status_t remoteServiceAdmin_removeExportedService(remote_service_admin_pt admin, export_registration_pt registration) {
-    celix_status_t status;
-    ipc_segment_pt ipc = NULL;
+	celix_status_t status;
+	ipc_segment_pt ipc = NULL;
 
-    export_reference_pt ref = NULL;
-    status = exportRegistration_getExportReference(registration, &ref);
+	export_reference_pt ref = NULL;
+	status = exportRegistration_getExportReference(registration, &ref);
 
-    if (status == CELIX_SUCCESS) {
-        bool *pollThreadRunning = NULL;
+	if (status == CELIX_SUCCESS) {
+		bool *pollThreadRunning = NULL;
 
-        service_reference_pt servRef;
-        celixThreadMutex_lock(&admin->exportedServicesLock);
-        exportReference_getExportedService(ref, &servRef);
+		service_reference_pt servRef;
+		celixThreadMutex_lock(&admin->exportedServicesLock);
+		exportReference_getExportedService(ref, &servRef);
 
-        array_list_pt exports = (array_list_pt)hashMap_remove(admin->exportedServices, servRef);
-        if(exports!=NULL){
-        	arrayList_destroy(exports);
-        }
+		array_list_pt exports = (array_list_pt)hashMap_remove(admin->exportedServices, servRef);
+		if(exports!=NULL){
+			arrayList_destroy(exports);
+		}
 
-        exportRegistration_close(registration);
+		exportRegistration_close(registration);
 
-        if ((pollThreadRunning = hashMap_get(admin->pollThreadRunning, registration->endpointDescription)) != NULL) {
-            *pollThreadRunning = false;
+		if ((pollThreadRunning = hashMap_get(admin->pollThreadRunning, registration->endpointDescription)) != NULL) {
+			*pollThreadRunning = false;
 
-            if ((ipc = hashMap_get(admin->exportedIpcSegment, registration->endpointDescription->service)) != NULL) {
-                celix_thread_t* pollThread;
+			if ((ipc = hashMap_get(admin->exportedIpcSegment, registration->endpointDescription->service)) != NULL) {
+				celix_thread_t* pollThread;
 
-                remoteServiceAdmin_unlock(ipc->semId, 1);
+				remoteServiceAdmin_unlock(ipc->semId, 1);
 
-                if ((pollThread = hashMap_get(admin->pollThread, registration->endpointDescription)) != NULL) {
-                    status = celixThread_join(*pollThread, NULL);
+				if ((pollThread = hashMap_get(admin->pollThread, registration->endpointDescription)) != NULL) {
+					status = celixThread_join(*pollThread, NULL);
 
-                    if (status == CELIX_SUCCESS) {
-                        semctl(ipc->semId, 1 , IPC_RMID);
-                        shmctl(ipc->shmId, IPC_RMID, 0);
+					if (status == CELIX_SUCCESS) {
+						semctl(ipc->semId, 1 , IPC_RMID);
+						shmctl(ipc->shmId, IPC_RMID, 0);
 
-                        remoteServiceAdmin_removeSharedIdentityFile(admin, registration->endpointDescription->frameworkUUID, registration->endpointDescription->service);
+						remoteServiceAdmin_removeSharedIdentityFile(admin, registration->endpointDescription->frameworkUUID, registration->endpointDescription->service);
 
-                        hashMap_remove(admin->pollThreadRunning, registration->endpointDescription);
-                        hashMap_remove(admin->exportedIpcSegment, registration->endpointDescription->service);
-                        hashMap_remove(admin->pollThread, registration->endpointDescription);
+						hashMap_remove(admin->pollThreadRunning, registration->endpointDescription);
+						hashMap_remove(admin->exportedIpcSegment, registration->endpointDescription->service);
+						hashMap_remove(admin->pollThread, registration->endpointDescription);
 
-                        free(pollThreadRunning);
-                        free(pollThread);
-                        free(ipc);
-                    }
-                }
-            }
-        }
-        exportRegistration_destroy(&registration);
-    }
+						free(pollThreadRunning);
+						free(pollThread);
+						free(ipc);
+					}
+				}
+			}
+		}
+		exportRegistration_destroy(&registration);
+	}
 
-    if(ref!=NULL){
-    	free(ref);
-    }
+	if(ref!=NULL){
+		free(ref);
+	}
 
-    celixThreadMutex_unlock(&admin->exportedServicesLock);
+	celixThreadMutex_unlock(&admin->exportedServicesLock);
 
-    return status;
+	return status;
 }
 
 celix_status_t remoteServiceAdmin_getIpcSegment(remote_service_admin_pt admin, endpoint_description_pt endpointDescription, ipc_segment_pt* ipc) {
-    (*ipc) = (hashMap_containsKey(admin->importedIpcSegment, endpointDescription) == true) ? hashMap_get(admin->importedIpcSegment, endpointDescription) : NULL;
+	(*ipc) = (hashMap_containsKey(admin->importedIpcSegment, endpointDescription) == true) ? hashMap_get(admin->importedIpcSegment, endpointDescription) : NULL;
 
-    return (*ipc != NULL) ? CELIX_SUCCESS : CELIX_ILLEGAL_ARGUMENT;
+	return (*ipc != NULL) ? CELIX_SUCCESS : CELIX_ILLEGAL_ARGUMENT;
 }
 
 celix_status_t remoteServiceAdmin_detachIpcSegment(ipc_segment_pt ipc) {
-    return (shmdt(ipc->shmBaseAdress) != -1) ? CELIX_SUCCESS : CELIX_BUNDLE_EXCEPTION;
+	return (shmdt(ipc->shmBaseAdress) != -1) ? CELIX_SUCCESS : CELIX_BUNDLE_EXCEPTION;
 }
 
 celix_status_t remoteServiceAdmin_deleteIpcSegment(ipc_segment_pt ipc) {
-    return ((semctl(ipc->semId, 1 /*ignored*/, IPC_RMID) != -1) && (shmctl(ipc->shmId, IPC_RMID, 0) != -1)) ? CELIX_SUCCESS : CELIX_BUNDLE_EXCEPTION;
+	return ((semctl(ipc->semId, 1 /*ignored*/, IPC_RMID) != -1) && (shmctl(ipc->shmId, IPC_RMID, 0) != -1)) ? CELIX_SUCCESS : CELIX_BUNDLE_EXCEPTION;
 }
 
 celix_status_t remoteServiceAdmin_createOrAttachShm(hash_map_pt ipcSegment, remote_service_admin_pt admin, endpoint_description_pt endpointDescription, bool createIfNotFound) {
-    celix_status_t status = CELIX_SUCCESS;
+	celix_status_t status = CELIX_SUCCESS;
 
-    /* setup ipc sehment */
-    ipc_segment_pt ipc = NULL;
+	/* setup ipc sehment */
+	ipc_segment_pt ipc = NULL;
 
-    properties_pt endpointProperties = endpointDescription->properties;
+	properties_pt endpointProperties = endpointDescription->properties;
 
-    char *shmPath = NULL;
-    char *shmFtokId = NULL;
+	char *shmPath = NULL;
+	char *shmFtokId = NULL;
 
-    char *semPath = NULL;
-    char *semFtokId = NULL;
+	char *semPath = NULL;
+	char *semFtokId = NULL;
 
-    if ((shmPath = properties_get(endpointProperties, (char *) RSA_SHM_PATH_PROPERTYNAME)) == NULL) {
-        logHelper_log(admin->loghelper, OSGI_LOGSERVICE_DEBUG, "No value found for key %s in endpointProperties.", RSA_SHM_PATH_PROPERTYNAME);
-        status = CELIX_BUNDLE_EXCEPTION;
-    } else if ((shmFtokId = properties_get(endpointProperties, (char *) RSA_SHM_FTOK_ID_PROPERTYNAME)) == NULL) {
-        logHelper_log(admin->loghelper, OSGI_LOGSERVICE_DEBUG, "No value found for key %s in endpointProperties.", RSA_SHM_FTOK_ID_PROPERTYNAME);
-        status = CELIX_BUNDLE_EXCEPTION;
-    } else if ((semPath = properties_get(endpointProperties, (char *) RSA_SEM_PATH_PROPERTYNAME)) == NULL) {
-        logHelper_log(admin->loghelper, OSGI_LOGSERVICE_DEBUG, "No value found for key %s in endpointProperties.", RSA_SEM_PATH_PROPERTYNAME);
-        status = CELIX_BUNDLE_EXCEPTION;
-    } else if ((semFtokId = properties_get(endpointProperties, (char *) RSA_SEM_FTOK_ID_PROPERTYNAME)) == NULL) {
-        logHelper_log(admin->loghelper, OSGI_LOGSERVICE_DEBUG, "No value found for key %s in endpointProperties.", RSA_SEM_FTOK_ID_PROPERTYNAME);
-        status = CELIX_BUNDLE_EXCEPTION;
-    } else {
-        key_t shmKey = ftok(shmPath, atoi(shmFtokId));
-        ipc = calloc(1, sizeof(*ipc));
+	if ((shmPath = (char*)properties_get(endpointProperties, (char *) RSA_SHM_PATH_PROPERTYNAME)) == NULL) {
+		logHelper_log(admin->loghelper, OSGI_LOGSERVICE_DEBUG, "No value found for key %s in endpointProperties.", RSA_SHM_PATH_PROPERTYNAME);
+		status = CELIX_BUNDLE_EXCEPTION;
+	} else if ((shmFtokId = (char*)properties_get(endpointProperties, (char *) RSA_SHM_FTOK_ID_PROPERTYNAME)) == NULL) {
+		logHelper_log(admin->loghelper, OSGI_LOGSERVICE_DEBUG, "No value found for key %s in endpointProperties.", RSA_SHM_FTOK_ID_PROPERTYNAME);
+		status = CELIX_BUNDLE_EXCEPTION;
+	} else if ((semPath = (char*)properties_get(endpointProperties, (char *) RSA_SEM_PATH_PROPERTYNAME)) == NULL) {
+		logHelper_log(admin->loghelper, OSGI_LOGSERVICE_DEBUG, "No value found for key %s in endpointProperties.", RSA_SEM_PATH_PROPERTYNAME);
+		status = CELIX_BUNDLE_EXCEPTION;
+	} else if ((semFtokId = (char*)properties_get(endpointProperties, (char *) RSA_SEM_FTOK_ID_PROPERTYNAME)) == NULL) {
+		logHelper_log(admin->loghelper, OSGI_LOGSERVICE_DEBUG, "No value found for key %s in endpointProperties.", RSA_SEM_FTOK_ID_PROPERTYNAME);
+		status = CELIX_BUNDLE_EXCEPTION;
+	} else {
+		key_t shmKey = ftok(shmPath, atoi(shmFtokId));
+		ipc = calloc(1, sizeof(*ipc));
+		if(ipc == NULL){
+			return CELIX_ENOMEM;
+		}
 
-        if ((ipc->shmId = shmget(shmKey, RSA_SHM_MEMSIZE, 0666)) < 0) {
-            logHelper_log(admin->loghelper, OSGI_LOGSERVICE_WARNING, "Could not attach to shared memory");
+		if ((ipc->shmId = shmget(shmKey, RSA_SHM_MEMSIZE, 0666)) < 0) {
+			logHelper_log(admin->loghelper, OSGI_LOGSERVICE_WARNING, "Could not attach to shared memory");
 
-            if (createIfNotFound == true) {
-                if ((ipc->shmId = shmget(shmKey, RSA_SHM_MEMSIZE, IPC_CREAT | 0666)) < 0) {
-                    logHelper_log(admin->loghelper, OSGI_LOGSERVICE_ERROR, "Creation of shared memory segment failed.");
-                    status = CELIX_BUNDLE_EXCEPTION;
-                } else if ((ipc->shmBaseAdress = shmat(ipc->shmId, 0, 0)) == (char *) -1) {
-                    logHelper_log(admin->loghelper, OSGI_LOGSERVICE_ERROR, "Attaching of shared memory segment failed.");
-                    status = CELIX_BUNDLE_EXCEPTION;
-                } else {
-                    logHelper_log(admin->loghelper, OSGI_LOGSERVICE_INFO, "shared memory segment sucessfully created at %p.", ipc->shmBaseAdress);
-                }
-            }
-        } else if ((ipc->shmBaseAdress = shmat(ipc->shmId, 0, 0)) == (char *) -1) {
-            logHelper_log(admin->loghelper, OSGI_LOGSERVICE_ERROR, "Attaching to shared memory segment failed.");
-            status = CELIX_BUNDLE_EXCEPTION;
-        } else {
-            logHelper_log(admin->loghelper, OSGI_LOGSERVICE_INFO, "sucessfully attached to shared memory at %p.", ipc->shmBaseAdress);
-        }
-    }
+			if (createIfNotFound == true) {
+				if ((ipc->shmId = shmget(shmKey, RSA_SHM_MEMSIZE, IPC_CREAT | 0666)) < 0) {
+					logHelper_log(admin->loghelper, OSGI_LOGSERVICE_ERROR, "Creation of shared memory segment failed.");
+					status = CELIX_BUNDLE_EXCEPTION;
+				} else if ((ipc->shmBaseAdress = shmat(ipc->shmId, 0, 0)) == (char *) -1) {
+					logHelper_log(admin->loghelper, OSGI_LOGSERVICE_ERROR, "Attaching of shared memory segment failed.");
+					status = CELIX_BUNDLE_EXCEPTION;
+				} else {
+					logHelper_log(admin->loghelper, OSGI_LOGSERVICE_INFO, "shared memory segment sucessfully created at %p.", ipc->shmBaseAdress);
+				}
+			}
+		} else if ((ipc->shmBaseAdress = shmat(ipc->shmId, 0, 0)) == (char *) -1) {
+			logHelper_log(admin->loghelper, OSGI_LOGSERVICE_ERROR, "Attaching to shared memory segment failed.");
+			status = CELIX_BUNDLE_EXCEPTION;
+		} else {
+			logHelper_log(admin->loghelper, OSGI_LOGSERVICE_INFO, "sucessfully attached to shared memory at %p.", ipc->shmBaseAdress);
+		}
+	}
 
-    if ((status == CELIX_SUCCESS) && (ipc != NULL)) {
-        key_t semkey = ftok(semPath, atoi(semFtokId));
-        int semflg = (createIfNotFound == true) ? (0666 | IPC_CREAT) : (0666);
-        int semid = semget(semkey, 3, semflg);
+	if(ipc != NULL && status == CELIX_SUCCESS){
 
-        if (semid != -1) {
-            // only reset semaphores if a create was supposed
-            if ((createIfNotFound == true) && ((semctl(semid, 0, SETVAL, (int) 1) == -1) || (semctl(semid, 1, SETVAL, (int) 0) == -1) || (semctl(semid, 2, SETVAL, (int) 0) == -1))) {
-                logHelper_log(admin->loghelper, OSGI_LOGSERVICE_ERROR, "error while initialize semaphores.");
-            }
+		key_t semkey = ftok(semPath, atoi(semFtokId));
+		int semflg = (createIfNotFound == true) ? (0666 | IPC_CREAT) : (0666);
+		int semid = semget(semkey, 3, semflg);
 
-            logHelper_log(admin->loghelper, OSGI_LOGSERVICE_DEBUG, "semaphores w/ key %s and id %i added.", endpointDescription->service, semid);
-            ipc->semId = semid;
+		if (semid != -1) {
+			// only reset semaphores if a create was supposed
+			if ((createIfNotFound == true) && ((semctl(semid, 0, SETVAL, (int) 1) == -1) || (semctl(semid, 1, SETVAL, (int) 0) == -1) || (semctl(semid, 2, SETVAL, (int) 0) == -1))) {
+				logHelper_log(admin->loghelper, OSGI_LOGSERVICE_ERROR, "error while initialize semaphores.");
+			}
 
-            hashMap_put(ipcSegment, endpointDescription->service, ipc);
-        } else {
-            logHelper_log(admin->loghelper, OSGI_LOGSERVICE_ERROR, "error getting semaphores.");
-            status = CELIX_BUNDLE_EXCEPTION;
-        }
-    }
+			logHelper_log(admin->loghelper, OSGI_LOGSERVICE_DEBUG, "semaphores w/ key %s and id %i added.", endpointDescription->service, semid);
+			ipc->semId = semid;
 
-    return status;
+			hashMap_put(ipcSegment, endpointDescription->service, ipc);
+		} else {
+			logHelper_log(admin->loghelper, OSGI_LOGSERVICE_ERROR, "error getting semaphores.");
+			status = CELIX_BUNDLE_EXCEPTION;
+		}
+	}
+
+	if(ipc != NULL && status != CELIX_SUCCESS){
+		free(ipc);
+	}
+
+	return status;
 }
 
 celix_status_t remoteServiceAdmin_installEndpoint(remote_service_admin_pt admin, export_registration_pt registration, service_reference_pt reference, char *interface) {
-    celix_status_t status = CELIX_SUCCESS;
-    properties_pt endpointProperties = properties_create();
+	celix_status_t status = CELIX_SUCCESS;
+	properties_pt endpointProperties = properties_create();
 
-    unsigned int size = 0;
-    char **keys;
+	unsigned int size = 0;
+	char **keys;
 
-    serviceReference_getPropertyKeys(reference, &keys, &size);
-    for (int i = 0; i < size; i++) {
-        char *key = keys[i];
-        char *value = NULL;
+	serviceReference_getPropertyKeys(reference, &keys, &size);
+	for (int i = 0; i < size; i++) {
+		char *key = keys[i];
+		const char *value = NULL;
 
-        if (serviceReference_getProperty(reference, key, &value) == CELIX_SUCCESS && strcmp(key, (char*) OSGI_RSA_SERVICE_EXPORTED_INTERFACES) != 0 && strcmp(key, (char*) OSGI_FRAMEWORK_OBJECTCLASS) != 0) {
-            properties_set(endpointProperties, key, value);
-        }
-    }
+		if (serviceReference_getProperty(reference, key, &value) == CELIX_SUCCESS && strcmp(key, (char*) OSGI_RSA_SERVICE_EXPORTED_INTERFACES) != 0 && strcmp(key, (char*) OSGI_FRAMEWORK_OBJECTCLASS) != 0) {
+			properties_set(endpointProperties, key, value);
+		}
+	}
 
-    hash_map_entry_pt entry = hashMap_getEntry(endpointProperties, (void *) OSGI_FRAMEWORK_SERVICE_ID);
+	hash_map_entry_pt entry = hashMap_getEntry(endpointProperties, (void *) OSGI_FRAMEWORK_SERVICE_ID);
 
-    char* key = hashMapEntry_getKey(entry);
-    char *serviceId = (char *) hashMap_remove(endpointProperties, (void *) OSGI_FRAMEWORK_SERVICE_ID);
-    char *uuid = NULL;
+	char* key = hashMapEntry_getKey(entry);
+	char *serviceId = (char *) hashMap_remove(endpointProperties, (void *) OSGI_FRAMEWORK_SERVICE_ID);
+	const char *uuid = NULL;
 
-    uuid_t endpoint_uid;
-    uuid_generate(endpoint_uid);
-    char endpoint_uuid[37];
-    uuid_unparse_lower(endpoint_uid, endpoint_uuid);
+	uuid_t endpoint_uid;
+	uuid_generate(endpoint_uid);
+	char endpoint_uuid[37];
+	uuid_unparse_lower(endpoint_uid, endpoint_uuid);
 
-    bundleContext_getProperty(admin->context, OSGI_FRAMEWORK_FRAMEWORK_UUID, &uuid);
-    properties_set(endpointProperties, (char*) OSGI_RSA_ENDPOINT_FRAMEWORK_UUID, uuid);
-    properties_set(endpointProperties, (char*) OSGI_FRAMEWORK_OBJECTCLASS, interface);
-    properties_set(endpointProperties, (char*) OSGI_RSA_ENDPOINT_SERVICE_ID, serviceId);
-    properties_set(endpointProperties, (char*) OSGI_RSA_ENDPOINT_ID, endpoint_uuid);
-    properties_set(endpointProperties, (char*) OSGI_RSA_SERVICE_IMPORTED, "true");
-//    properties_set(endpointProperties, (char*) OSGI_RSA_SERVICE_IMPORTED_CONFIGS, (char*) CONFIGURATION_TYPE);
+	bundleContext_getProperty(admin->context, OSGI_FRAMEWORK_FRAMEWORK_UUID, &uuid);
+	properties_set(endpointProperties, (char*) OSGI_RSA_ENDPOINT_FRAMEWORK_UUID, uuid);
+	properties_set(endpointProperties, (char*) OSGI_FRAMEWORK_OBJECTCLASS, interface);
+	properties_set(endpointProperties, (char*) OSGI_RSA_ENDPOINT_SERVICE_ID, serviceId);
+	properties_set(endpointProperties, (char*) OSGI_RSA_ENDPOINT_ID, endpoint_uuid);
+	properties_set(endpointProperties, (char*) OSGI_RSA_SERVICE_IMPORTED, "true");
+	//    properties_set(endpointProperties, (char*) OSGI_RSA_SERVICE_IMPORTED_CONFIGS, (char*) CONFIGURATION_TYPE);
 
-    if (properties_get(endpointProperties, (char *) RSA_SHM_PATH_PROPERTYNAME) == NULL) {
-        char sharedIdentifierFile[RSA_FILEPATH_LENGTH];
+	if (properties_get(endpointProperties, (char *) RSA_SHM_PATH_PROPERTYNAME) == NULL) {
+		char sharedIdentifierFile[RSA_FILEPATH_LENGTH];
 
-        if (remoteServiceAdmin_getSharedIdentifierFile(admin, uuid, interface, sharedIdentifierFile) == CELIX_SUCCESS) {
-            properties_set(endpointProperties, (char *) RSA_SHM_PATH_PROPERTYNAME, sharedIdentifierFile);
-        } else {
-            properties_set(endpointProperties, (char *) RSA_SHM_PATH_PROPERTYNAME, (char *) RSA_SHM_DEFAULTPATH);
-        }
-    }
-    if (properties_get(endpointProperties, (char *) RSA_SHM_FTOK_ID_PROPERTYNAME) == NULL) {
-        properties_set(endpointProperties, (char *) RSA_SHM_FTOK_ID_PROPERTYNAME, (char *) RSA_SHM_DEFAULT_FTOK_ID);
-    }
-    if (properties_get(endpointProperties, (char *) RSA_SEM_PATH_PROPERTYNAME) == NULL) {
-        char sharedIdentifierFile[RSA_FILEPATH_LENGTH];
+		if (remoteServiceAdmin_getSharedIdentifierFile(admin, (char*)uuid, interface, sharedIdentifierFile) == CELIX_SUCCESS) {
+			properties_set(endpointProperties, RSA_SHM_PATH_PROPERTYNAME, sharedIdentifierFile);
+		} else {
+			properties_set(endpointProperties, (char *) RSA_SHM_PATH_PROPERTYNAME, (char *) RSA_SHM_DEFAULTPATH);
+		}
+	}
+	if (properties_get(endpointProperties, (char *) RSA_SHM_FTOK_ID_PROPERTYNAME) == NULL) {
+		properties_set(endpointProperties, (char *) RSA_SHM_FTOK_ID_PROPERTYNAME, (char *) RSA_SHM_DEFAULT_FTOK_ID);
+	}
+	if (properties_get(endpointProperties, (char *) RSA_SEM_PATH_PROPERTYNAME) == NULL) {
+		char sharedIdentifierFile[RSA_FILEPATH_LENGTH];
 
-        if (remoteServiceAdmin_getSharedIdentifierFile(admin, uuid, interface, sharedIdentifierFile) == CELIX_SUCCESS) {
-            properties_set(endpointProperties, (char *) RSA_SEM_PATH_PROPERTYNAME, sharedIdentifierFile);
-        } else {
-            properties_set(endpointProperties, (char *) RSA_SEM_PATH_PROPERTYNAME, (char *) RSA_SEM_DEFAULTPATH);
-        }
-    }
-    if (properties_get(endpointProperties, (char *) RSA_SEM_FTOK_ID_PROPERTYNAME) == NULL) {
-        properties_set(endpointProperties, (char *) RSA_SEM_FTOK_ID_PROPERTYNAME, (char *) RSA_SEM_DEFAULT_FTOK_ID);
-    }
+		if (remoteServiceAdmin_getSharedIdentifierFile(admin, (char*)uuid, interface, sharedIdentifierFile) == CELIX_SUCCESS) {
+			properties_set(endpointProperties, (char *) RSA_SEM_PATH_PROPERTYNAME, sharedIdentifierFile);
+		} else {
+			properties_set(endpointProperties, (char *) RSA_SEM_PATH_PROPERTYNAME, (char *) RSA_SEM_DEFAULTPATH);
+		}
+	}
+	if (properties_get(endpointProperties, (char *) RSA_SEM_FTOK_ID_PROPERTYNAME) == NULL) {
+		properties_set(endpointProperties, (char *) RSA_SEM_FTOK_ID_PROPERTYNAME, (char *) RSA_SEM_DEFAULT_FTOK_ID);
+	}
 
-    endpoint_description_pt endpointDescription = NULL;
-    remoteServiceAdmin_createEndpointDescription(admin, reference, endpointProperties, interface, &endpointDescription);
-    exportRegistration_setEndpointDescription(registration, endpointDescription);
+	endpoint_description_pt endpointDescription = NULL;
+	remoteServiceAdmin_createEndpointDescription(admin, reference, endpointProperties, interface, &endpointDescription);
+	exportRegistration_setEndpointDescription(registration, endpointDescription);
 
-    free(key);
-    free(serviceId);
-    free(keys);
+	free(key);
+	free(serviceId);
+	free(keys);
 
-    return status;
+	return status;
 }
 
 celix_status_t remoteServiceAdmin_createEndpointDescription(remote_service_admin_pt admin, service_reference_pt reference, properties_pt endpointProperties, char *interface, endpoint_description_pt *description) {
-    celix_status_t status = CELIX_SUCCESS;
+	celix_status_t status = CELIX_SUCCESS;
 
-    *description = calloc(1, sizeof(**description));
-    if (!*description) {
-        status = CELIX_ENOMEM;
-    } else {
-        if (status == CELIX_SUCCESS) {
-            (*description)->properties = endpointProperties;
-            (*description)->frameworkUUID = properties_get(endpointProperties, (char*) OSGI_RSA_ENDPOINT_FRAMEWORK_UUID);
-            char *serviceId = NULL;
-            serviceReference_getProperty(reference, (char*) OSGI_FRAMEWORK_SERVICE_ID, &serviceId);
-            (*description)->serviceId = strtoull(serviceId, NULL, 0);
-            (*description)->id = properties_get(endpointProperties, (char*) OSGI_RSA_ENDPOINT_ID);
-            (*description)->service = interface;
-        }
-    }
+	*description = calloc(1, sizeof(**description));
+	if (!*description) {
+		status = CELIX_ENOMEM;
+	} else {
+		if (status == CELIX_SUCCESS) {
+			(*description)->properties = endpointProperties;
+			(*description)->frameworkUUID = (char*)properties_get(endpointProperties, (char*) OSGI_RSA_ENDPOINT_FRAMEWORK_UUID);
+			const char *serviceId = NULL;
+			serviceReference_getProperty(reference, (char*)OSGI_FRAMEWORK_SERVICE_ID, &serviceId);
+			(*description)->serviceId = strtoull(serviceId, NULL, 0);
+			(*description)->id = (char*)properties_get(endpointProperties, (char*) OSGI_RSA_ENDPOINT_ID);
+			(*description)->service = strndup(interface, 1024*10);
+		}
+	}
 
-    return status;
+	return status;
 }
 
 celix_status_t remoteServiceAdmin_destroyEndpointDescription(endpoint_description_pt *description) {
-    celix_status_t status = CELIX_SUCCESS;
+	celix_status_t status = CELIX_SUCCESS;
 
-    properties_destroy((*description)->properties);
-    free(*description);
+	properties_destroy((*description)->properties);
+	free((*description)->service);
+	free(*description);
 
-    return status;
+	return status;
 }
 
 celix_status_t remoteServiceAdmin_getExportedServices(remote_service_admin_pt admin, array_list_pt *services) {
-    celix_status_t status = CELIX_SUCCESS;
-    return status;
+	celix_status_t status = CELIX_SUCCESS;
+	return status;
 }
 
 celix_status_t remoteServiceAdmin_getImportedEndpoints(remote_service_admin_pt admin, array_list_pt *services) {
-    celix_status_t status = CELIX_SUCCESS;
-    return status;
+	celix_status_t status = CELIX_SUCCESS;
+	return status;
 }
 
 celix_status_t remoteServiceAdmin_importService(remote_service_admin_pt admin, endpoint_description_pt endpointDescription, import_registration_pt *registration) {
-    celix_status_t status = CELIX_SUCCESS;
+	celix_status_t status = CELIX_SUCCESS;
 
-    logHelper_log(admin->loghelper, OSGI_LOGSERVICE_INFO, "RSA: Import service %s", endpointDescription->service);
+	logHelper_log(admin->loghelper, OSGI_LOGSERVICE_INFO, "RSA: Import service %s", endpointDescription->service);
 
-    celixThreadMutex_lock(&admin->importedServicesLock);
+	celixThreadMutex_lock(&admin->importedServicesLock);
 
-    import_registration_factory_pt registration_factory = (import_registration_factory_pt) hashMap_get(admin->importedServices, endpointDescription->service);
+	import_registration_factory_pt registration_factory = (import_registration_factory_pt) hashMap_get(admin->importedServices, endpointDescription->service);
 
-    // check whether we already have a registration_factory registered in the hashmap
-    if (registration_factory == NULL) {
-        status = importRegistrationFactory_install(admin->loghelper, endpointDescription->service, admin->context, &registration_factory);
-        if (status == CELIX_SUCCESS) {
-            hashMap_put(admin->importedServices, endpointDescription->service, registration_factory);
-        }
-    }
+	// check whether we already have a registration_factory registered in the hashmap
+	if (registration_factory == NULL) {
+		status = importRegistrationFactory_install(admin->loghelper, endpointDescription->service, admin->context, &registration_factory);
+		if (status == CELIX_SUCCESS) {
+			hashMap_put(admin->importedServices, endpointDescription->service, registration_factory);
+		}
+	}
 
-    // factory available
-    if (status != CELIX_SUCCESS || (registration_factory->trackedFactory == NULL)) {
-        logHelper_log(admin->loghelper, OSGI_LOGSERVICE_WARNING, "RSA: no proxyFactory available.");
-        if (status == CELIX_SUCCESS) {
-            status = CELIX_SERVICE_EXCEPTION;
-        }
-    } else {
-        // we create an importRegistration per imported service
-        importRegistration_create(endpointDescription, admin, (sendToHandle) &remoteServiceAdmin_send, admin->context, registration);
-        registration_factory->trackedFactory->registerProxyService(registration_factory->trackedFactory->factory, endpointDescription, admin, (sendToHandle) &remoteServiceAdmin_send);
+	// factory available
+	if (status != CELIX_SUCCESS || (registration_factory->trackedFactory == NULL)) {
+		logHelper_log(admin->loghelper, OSGI_LOGSERVICE_WARNING, "RSA: no proxyFactory available.");
+		if (status == CELIX_SUCCESS) {
+			status = CELIX_SERVICE_EXCEPTION;
+		}
+	} else {
+		// we create an importRegistration per imported service
+		importRegistration_create(endpointDescription, admin, (sendToHandle) &remoteServiceAdmin_send, admin->context, registration);
+		registration_factory->trackedFactory->registerProxyService(registration_factory->trackedFactory->factory, endpointDescription, admin, (sendToHandle) &remoteServiceAdmin_send);
 
-        arrayList_add(registration_factory->registrations, *registration);
-        remoteServiceAdmin_createOrAttachShm(admin->importedIpcSegment, admin, endpointDescription, false);
-    }
+		arrayList_add(registration_factory->registrations, *registration);
+		remoteServiceAdmin_createOrAttachShm(admin->importedIpcSegment, admin, endpointDescription, false);
+	}
 
-    celixThreadMutex_unlock(&admin->importedServicesLock);
+	celixThreadMutex_unlock(&admin->importedServicesLock);
 
-    return status;
+	return status;
 }
 
 celix_status_t remoteServiceAdmin_removeImportedService(remote_service_admin_pt admin, import_registration_pt registration) {
-    celix_status_t status = CELIX_SUCCESS;
+	celix_status_t status = CELIX_SUCCESS;
 
-    if (registration != NULL) {
+	if (registration != NULL) {
 
-        celixThreadMutex_lock(&admin->importedServicesLock);
+		celixThreadMutex_lock(&admin->importedServicesLock);
 
-        ipc_segment_pt ipc = NULL;
-        endpoint_description_pt endpointDescription = (endpoint_description_pt) registration->endpointDescription;
-        import_registration_factory_pt registration_factory = (import_registration_factory_pt) hashMap_get(admin->importedServices, endpointDescription->service);
+		ipc_segment_pt ipc = NULL;
+		endpoint_description_pt endpointDescription = (endpoint_description_pt) registration->endpointDescription;
+		import_registration_factory_pt registration_factory = (import_registration_factory_pt) hashMap_get(admin->importedServices, endpointDescription->service);
 
-        // detach from IPC
-        if (remoteServiceAdmin_getIpcSegment(admin, endpointDescription, &ipc) != CELIX_SUCCESS) {
-            logHelper_log(admin->loghelper, OSGI_LOGSERVICE_ERROR, "Error while retrieving IPC segment for imported service %s.", endpointDescription->service);
-        } else if (remoteServiceAdmin_detachIpcSegment(ipc) != CELIX_SUCCESS) {
-            logHelper_log(admin->loghelper, OSGI_LOGSERVICE_ERROR, "Error while detaching IPC segment for imported service %s.", endpointDescription->service);
-        }
+		// detach from IPC
+		if (remoteServiceAdmin_getIpcSegment(admin, endpointDescription, &ipc) != CELIX_SUCCESS) {
+			logHelper_log(admin->loghelper, OSGI_LOGSERVICE_ERROR, "Error while retrieving IPC segment for imported service %s.", endpointDescription->service);
+		} else if (remoteServiceAdmin_detachIpcSegment(ipc) != CELIX_SUCCESS) {
+			logHelper_log(admin->loghelper, OSGI_LOGSERVICE_ERROR, "Error while detaching IPC segment for imported service %s.", endpointDescription->service);
+		}
 
-        ipc = hashMap_remove(admin->importedIpcSegment,endpointDescription);
-        if(ipc!=NULL){
-        	free(ipc);
-        }
+		ipc = hashMap_remove(admin->importedIpcSegment,endpointDescription);
+		if(ipc!=NULL){
+			free(ipc);
+		}
 
-        // factory available
-        if ((registration_factory == NULL) || (registration_factory->trackedFactory == NULL)) {
-            logHelper_log(admin->loghelper, OSGI_LOGSERVICE_ERROR, "Error while retrieving registration factory for imported service %s.", endpointDescription->service);
-        } else {
-            registration_factory->trackedFactory->unregisterProxyService(registration_factory->trackedFactory->factory, endpointDescription);
-            arrayList_removeElement(registration_factory->registrations, registration);
-            importRegistration_destroy(registration);
+		// factory available
+		if ((registration_factory == NULL) || (registration_factory->trackedFactory == NULL)) {
+			logHelper_log(admin->loghelper, OSGI_LOGSERVICE_ERROR, "Error while retrieving registration factory for imported service %s.", endpointDescription->service);
+		} else {
+			registration_factory->trackedFactory->unregisterProxyService(registration_factory->trackedFactory->factory, endpointDescription);
+			arrayList_removeElement(registration_factory->registrations, registration);
+			importRegistration_destroy(registration);
 
-            if (arrayList_isEmpty(registration_factory->registrations) == true) {
-                logHelper_log(admin->loghelper, OSGI_LOGSERVICE_INFO, "closing proxy");
+			if (arrayList_isEmpty(registration_factory->registrations) == true) {
+				logHelper_log(admin->loghelper, OSGI_LOGSERVICE_INFO, "closing proxy");
 
-                serviceTracker_close(registration_factory->proxyFactoryTracker);
-                importRegistrationFactory_close(registration_factory);
+				serviceTracker_close(registration_factory->proxyFactoryTracker);
+				importRegistrationFactory_close(registration_factory);
 
-                hashMap_remove(admin->importedServices, endpointDescription->service);
+				hashMap_remove(admin->importedServices, endpointDescription->service);
 
-                importRegistrationFactory_destroy(&registration_factory);
-            }
-        }
+				importRegistrationFactory_destroy(&registration_factory);
+			}
+		}
 
-        celixThreadMutex_unlock(&admin->importedServicesLock);
-    }
+		celixThreadMutex_unlock(&admin->importedServicesLock);
+	}
 
-    return status;
+	return status;
 }
diff --git a/remote_services/remote_service_admin_shm/private/test/rsa_client_server_tests.cpp b/remote_services/remote_service_admin_shm/private/test/rsa_client_server_tests.cpp
index 2e80521..13c6941 100644
--- a/remote_services/remote_service_admin_shm/private/test/rsa_client_server_tests.cpp
+++ b/remote_services/remote_service_admin_shm/private/test/rsa_client_server_tests.cpp
@@ -168,7 +168,7 @@
 
 			for (i = 0; i < size; i++) {
 				module_pt module = NULL;
-				char *name = NULL;
+				const char *name = NULL;
 
 				bundle_pt bundle = (bundle_pt) arrayList_get(bundles, i);
 
@@ -226,7 +226,7 @@
 
 			if (status == CELIX_SUCCESS) {
 				module_pt module = NULL;
-				char *name = NULL;
+				const char *name = NULL;
 
 				status = bundle_getCurrentModule(bundle, &module);
 
diff --git a/remote_services/topology_manager/private/src/activator.c b/remote_services/topology_manager/private/src/activator.c
index a6ee750..7f39a25 100644
--- a/remote_services/topology_manager/private/src/activator.c
+++ b/remote_services/topology_manager/private/src/activator.c
@@ -44,24 +44,24 @@
 #include "topology_manager.h"
 
 struct activator {
-    bundle_context_pt context;
+	bundle_context_pt context;
 
-    topology_manager_pt manager;
+	topology_manager_pt manager;
 
-    service_tracker_pt endpointListenerTracker;
-    service_tracker_pt remoteServiceAdminTracker;
-    service_listener_pt serviceListener;
+	service_tracker_pt endpointListenerTracker;
+	service_tracker_pt remoteServiceAdminTracker;
+	service_listener_pt serviceListener;
 
-    endpoint_listener_pt endpointListener;
-    service_registration_pt endpointListenerService;
+	endpoint_listener_pt endpointListener;
+	service_registration_pt endpointListenerService;
 
-    listener_hook_service_pt hookService;
-    service_registration_pt hook;
+	listener_hook_service_pt hookService;
+	service_registration_pt hook;
 
-    tm_scope_service_pt	scopeService;
-    service_registration_pt scopeReg;
+	tm_scope_service_pt	scopeService;
+	service_registration_pt scopeReg;
 
-    log_helper_pt loghelper;
+	log_helper_pt loghelper;
 };
 
 
@@ -70,216 +70,220 @@
 static celix_status_t bundleActivator_createServiceListener(struct activator *activator, service_listener_pt *listener);
 
 celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
-    celix_status_t status = CELIX_SUCCESS;
-    struct activator *activator = NULL;
-    void *scope;
+	celix_status_t status = CELIX_SUCCESS;
+	struct activator *activator = NULL;
+	void *scope;
 
-    activator = calloc(1, sizeof(struct activator));
+	activator = calloc(1, sizeof(struct activator));
 
-    if (!activator) {
-        return CELIX_ENOMEM;
-    }
+	if (!activator) {
+		return CELIX_ENOMEM;
+	}
 
-    activator->context = context;
-    activator->endpointListenerService = NULL;
-    activator->endpointListenerTracker = NULL;
-    activator->hook = NULL;
-    activator->manager = NULL;
-    activator->remoteServiceAdminTracker = NULL;
-    activator->serviceListener = NULL;
-    activator->scopeService = calloc(1, sizeof(*(activator->scopeService)));
-    if (activator->scopeService == NULL)
-    {
-    	free(activator);
-    	return CELIX_ENOMEM;
-    }
+	activator->context = context;
+	activator->endpointListenerService = NULL;
+	activator->endpointListenerTracker = NULL;
+	activator->hook = NULL;
+	activator->manager = NULL;
+	activator->remoteServiceAdminTracker = NULL;
+	activator->serviceListener = NULL;
+	activator->scopeService = calloc(1, sizeof(*(activator->scopeService)));
+	if (activator->scopeService == NULL)
+	{
+		free(activator);
+		return CELIX_ENOMEM;
+	}
 
-    activator->scopeService->addExportScope = tm_addExportScope;
-    activator->scopeService->removeExportScope = tm_removeExportScope;
-    activator->scopeService->addImportScope = tm_addImportScope;
-    activator->scopeService->removeImportScope = tm_removeImportScope;
-    activator->scopeReg = NULL; // explicitly needed, otherwise exception
+	activator->scopeService->addExportScope = tm_addExportScope;
+	activator->scopeService->removeExportScope = tm_removeExportScope;
+	activator->scopeService->addImportScope = tm_addImportScope;
+	activator->scopeService->removeImportScope = tm_removeImportScope;
+	activator->scopeReg = NULL; // explicitly needed, otherwise exception
 
-    logHelper_create(context, &activator->loghelper);
-    logHelper_start(activator->loghelper);
+	logHelper_create(context, &activator->loghelper);
+	logHelper_start(activator->loghelper);
 
-    status = topologyManager_create(context, activator->loghelper, &activator->manager, &scope);
-    activator->scopeService->handle = scope;
+	status = topologyManager_create(context, activator->loghelper, &activator->manager, &scope);
+	activator->scopeService->handle = scope;
 
-    if (status == CELIX_SUCCESS) {
-        status = bundleActivator_createEPLTracker(activator, &activator->endpointListenerTracker);
-        if (status == CELIX_SUCCESS) {
-            status = bundleActivator_createRSATracker(activator, &activator->remoteServiceAdminTracker);
-            if (status == CELIX_SUCCESS) {
-                status = bundleActivator_createServiceListener(activator, &activator->serviceListener);
-                if (status == CELIX_SUCCESS) {
-                	*userData = activator;
-                }
-            }
-        }
-    }
+	if (status == CELIX_SUCCESS) {
+		status = bundleActivator_createEPLTracker(activator, &activator->endpointListenerTracker);
+		if (status == CELIX_SUCCESS) {
+			status = bundleActivator_createRSATracker(activator, &activator->remoteServiceAdminTracker);
+			if (status == CELIX_SUCCESS) {
+				status = bundleActivator_createServiceListener(activator, &activator->serviceListener);
+				if (status == CELIX_SUCCESS) {
+					*userData = activator;
+				}
+			}
+		}
+	}
 
-    return status;
+	if(status != CELIX_SUCCESS){
+		bundleActivator_destroy(activator,context);
+	}
+
+	return status;
 }
 
 static celix_status_t bundleActivator_createEPLTracker(struct activator *activator, service_tracker_pt *tracker) {
-    celix_status_t status;
+	celix_status_t status;
 
-    service_tracker_customizer_pt customizer = NULL;
+	service_tracker_customizer_pt customizer = NULL;
 
-    status = serviceTrackerCustomizer_create(activator->manager, topologyManager_endpointListenerAdding, topologyManager_endpointListenerAdded, topologyManager_endpointListenerModified,
-            topologyManager_endpointListenerRemoved, &customizer);
+	status = serviceTrackerCustomizer_create(activator->manager, topologyManager_endpointListenerAdding, topologyManager_endpointListenerAdded, topologyManager_endpointListenerModified,
+			topologyManager_endpointListenerRemoved, &customizer);
 
-    if (status == CELIX_SUCCESS) {
-        status = serviceTracker_create(activator->context, (char *) OSGI_ENDPOINT_LISTENER_SERVICE, customizer, tracker);
-    }
+	if (status == CELIX_SUCCESS) {
+		status = serviceTracker_create(activator->context, (char *) OSGI_ENDPOINT_LISTENER_SERVICE, customizer, tracker);
+	}
 
-    return status;
+	return status;
 }
 
 static celix_status_t bundleActivator_createRSATracker(struct activator *activator, service_tracker_pt *tracker) {
-    celix_status_t status;
+	celix_status_t status;
 
-    service_tracker_customizer_pt customizer = NULL;
+	service_tracker_customizer_pt customizer = NULL;
 
-    status = serviceTrackerCustomizer_create(activator->manager, topologyManager_rsaAdding, topologyManager_rsaAdded, topologyManager_rsaModified, topologyManager_rsaRemoved, &customizer);
+	status = serviceTrackerCustomizer_create(activator->manager, topologyManager_rsaAdding, topologyManager_rsaAdded, topologyManager_rsaModified, topologyManager_rsaRemoved, &customizer);
 
-    if (status == CELIX_SUCCESS) {
-        status = serviceTracker_create(activator->context, OSGI_RSA_REMOTE_SERVICE_ADMIN, customizer, tracker);
-    }
+	if (status == CELIX_SUCCESS) {
+		status = serviceTracker_create(activator->context, OSGI_RSA_REMOTE_SERVICE_ADMIN, customizer, tracker);
+	}
 
-    return status;
+	return status;
 }
 
 static celix_status_t bundleActivator_createServiceListener(struct activator *activator, service_listener_pt *listener) {
-    celix_status_t status = CELIX_SUCCESS;
+	celix_status_t status = CELIX_SUCCESS;
 
-    *listener = malloc(sizeof(**listener));
-    if (!*listener) {
-        return CELIX_ENOMEM;
-    }
+	*listener = malloc(sizeof(**listener));
+	if (!*listener) {
+		return CELIX_ENOMEM;
+	}
 
-    (*listener)->handle = activator->manager;
-    (*listener)->serviceChanged = topologyManager_serviceChanged;
+	(*listener)->handle = activator->manager;
+	(*listener)->serviceChanged = topologyManager_serviceChanged;
 
-    return status;
+	return status;
 }
 
 celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
-    celix_status_t status;
-    struct activator *activator = userData;
+	celix_status_t status;
+	struct activator *activator = userData;
 
-    endpoint_listener_pt endpointListener = malloc(sizeof(*endpointListener));
-    endpointListener->handle = activator->manager;
-    endpointListener->endpointAdded = topologyManager_addImportedService;
-    endpointListener->endpointRemoved = topologyManager_removeImportedService;
-    activator->endpointListener = endpointListener;
+	endpoint_listener_pt endpointListener = malloc(sizeof(*endpointListener));
+	endpointListener->handle = activator->manager;
+	endpointListener->endpointAdded = topologyManager_addImportedService;
+	endpointListener->endpointRemoved = topologyManager_removeImportedService;
+	activator->endpointListener = endpointListener;
 
-    char *uuid = NULL;
-    status = bundleContext_getProperty(activator->context, (char *) OSGI_FRAMEWORK_FRAMEWORK_UUID, &uuid);
-    if (!uuid) {
-        logHelper_log(activator->loghelper, OSGI_LOGSERVICE_ERROR, "TOPOLOGY_MANAGER: no framework UUID defined?!");
-        return CELIX_ILLEGAL_STATE;
-    }
+	const char *uuid = NULL;
+	status = bundleContext_getProperty(activator->context, OSGI_FRAMEWORK_FRAMEWORK_UUID, &uuid);
+	if (!uuid) {
+		logHelper_log(activator->loghelper, OSGI_LOGSERVICE_ERROR, "TOPOLOGY_MANAGER: no framework UUID defined?!");
+		return CELIX_ILLEGAL_STATE;
+	}
 
-    size_t len = 14 + strlen(OSGI_FRAMEWORK_OBJECTCLASS) + strlen(OSGI_RSA_ENDPOINT_FRAMEWORK_UUID) + strlen(uuid);
-    char *scope = malloc(len);
-    if (!scope) {
-        return CELIX_ENOMEM;
-    }
+	size_t len = 14 + strlen(OSGI_FRAMEWORK_OBJECTCLASS) + strlen(OSGI_RSA_ENDPOINT_FRAMEWORK_UUID) + strlen(uuid);
+	char *scope = malloc(len);
+	if (!scope) {
+		return CELIX_ENOMEM;
+	}
 
-    snprintf(scope, len, "(&(%s=*)(!(%s=%s)))", OSGI_FRAMEWORK_OBJECTCLASS, OSGI_RSA_ENDPOINT_FRAMEWORK_UUID, uuid);
+	snprintf(scope, len, "(&(%s=*)(!(%s=%s)))", OSGI_FRAMEWORK_OBJECTCLASS, OSGI_RSA_ENDPOINT_FRAMEWORK_UUID, uuid);
 
-    logHelper_log(activator->loghelper, OSGI_LOGSERVICE_INFO, "TOPOLOGY_MANAGER: endpoint listener scope is %s", scope);
+	logHelper_log(activator->loghelper, OSGI_LOGSERVICE_INFO, "TOPOLOGY_MANAGER: endpoint listener scope is %s", scope);
 
-    properties_pt props = properties_create();
-    properties_set(props, (char *) OSGI_ENDPOINT_LISTENER_SCOPE, scope);
+	properties_pt props = properties_create();
+	properties_set(props, (char *) OSGI_ENDPOINT_LISTENER_SCOPE, scope);
 
-    // We can release the scope, as properties_set makes a copy of the key & value...
-    free(scope);
+	// We can release the scope, as properties_set makes a copy of the key & value...
+	free(scope);
 
-    bundleContext_registerService(context, (char *) OSGI_ENDPOINT_LISTENER_SERVICE, endpointListener, props, &activator->endpointListenerService);
+	bundleContext_registerService(context, (char *) OSGI_ENDPOINT_LISTENER_SERVICE, endpointListener, props, &activator->endpointListenerService);
 
-    listener_hook_service_pt hookService = malloc(sizeof(*hookService));
-    hookService->handle = activator->manager;
-    hookService->added = topologyManager_listenerAdded;
-    hookService->removed = topologyManager_listenerRemoved;
-    activator->hookService = hookService;
+	listener_hook_service_pt hookService = malloc(sizeof(*hookService));
+	hookService->handle = activator->manager;
+	hookService->added = topologyManager_listenerAdded;
+	hookService->removed = topologyManager_listenerRemoved;
+	activator->hookService = hookService;
 
-    bundleContext_registerService(context, (char *) OSGI_FRAMEWORK_LISTENER_HOOK_SERVICE_NAME, hookService, NULL, &activator->hook);
-    bundleContext_addServiceListener(context, activator->serviceListener, "(service.exported.interfaces=*)");
+	bundleContext_registerService(context, (char *) OSGI_FRAMEWORK_LISTENER_HOOK_SERVICE_NAME, hookService, NULL, &activator->hook);
+	bundleContext_addServiceListener(context, activator->serviceListener, "(service.exported.interfaces=*)");
 
-    if (status == CELIX_SUCCESS) {
-        serviceTracker_open(activator->remoteServiceAdminTracker);
-    }
+	if (status == CELIX_SUCCESS) {
+		serviceTracker_open(activator->remoteServiceAdminTracker);
+	}
 
-    if (status == CELIX_SUCCESS) {
-        status = serviceTracker_open(activator->endpointListenerTracker);
-    }
+	if (status == CELIX_SUCCESS) {
+		status = serviceTracker_open(activator->endpointListenerTracker);
+	}
 
 	bundleContext_registerService(context, (char *) TOPOLOGYMANAGER_SCOPE_SERVICE, activator->scopeService, NULL, &activator->scopeReg);
 
-    array_list_pt references = NULL;
-    bundleContext_getServiceReferences(context, NULL, "(service.exported.interfaces=*)", &references);
-    int i;
-    for (i = 0; i < arrayList_size(references); i++) {
-        service_reference_pt reference = arrayList_get(references, i);
-        char *serviceId = NULL;
-        status = CELIX_DO_IF(status, serviceReference_getProperty(reference, (char *)OSGI_FRAMEWORK_SERVICE_ID, &serviceId));
+	array_list_pt references = NULL;
+	bundleContext_getServiceReferences(context, NULL, "(service.exported.interfaces=*)", &references);
+	int i;
+	for (i = 0; i < arrayList_size(references); i++) {
+		service_reference_pt reference = arrayList_get(references, i);
+		const char* serviceId = NULL;
+		status = CELIX_DO_IF(status, serviceReference_getProperty(reference, OSGI_FRAMEWORK_SERVICE_ID, &serviceId));
 
-        CELIX_DO_IF(status, topologyManager_addExportedService(activator->manager, reference, serviceId));
-    }
-    arrayList_destroy(references);
+		CELIX_DO_IF(status, topologyManager_addExportedService(activator->manager, reference, (char*)serviceId));
+	}
+	arrayList_destroy(references);
 
-    return status;
+	return status;
 }
 
 celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
-    celix_status_t status = CELIX_SUCCESS;
-    struct activator *activator = userData;
+	celix_status_t status = CELIX_SUCCESS;
+	struct activator *activator = userData;
 
-    if (serviceTracker_close(activator->remoteServiceAdminTracker) == CELIX_SUCCESS) {
-        serviceTracker_destroy(activator->remoteServiceAdminTracker);
-    }
+	if (serviceTracker_close(activator->remoteServiceAdminTracker) == CELIX_SUCCESS) {
+		serviceTracker_destroy(activator->remoteServiceAdminTracker);
+	}
 
-    if (serviceTracker_close(activator->endpointListenerTracker) == CELIX_SUCCESS) {
-        serviceTracker_destroy(activator->endpointListenerTracker);
-    }
+	if (serviceTracker_close(activator->endpointListenerTracker) == CELIX_SUCCESS) {
+		serviceTracker_destroy(activator->endpointListenerTracker);
+	}
 
-    bundleContext_removeServiceListener(context, activator->serviceListener);
-    free(activator->serviceListener);
+	bundleContext_removeServiceListener(context, activator->serviceListener);
+	free(activator->serviceListener);
 
-    serviceRegistration_unregister(activator->hook);
-    free(activator->hookService);
+	serviceRegistration_unregister(activator->hook);
+	free(activator->hookService);
 
-    serviceRegistration_unregister(activator->endpointListenerService);
-    free(activator->endpointListener);
+	serviceRegistration_unregister(activator->endpointListenerService);
+	free(activator->endpointListener);
 
-    serviceRegistration_unregister(activator->scopeReg);
+	serviceRegistration_unregister(activator->scopeReg);
 
-    topologyManager_closeImports(activator->manager);
+	topologyManager_closeImports(activator->manager);
 
-    return status;
+	return status;
 }
 
 celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
-    celix_status_t status = CELIX_SUCCESS;
+	celix_status_t status = CELIX_SUCCESS;
 
-    struct activator *activator = userData;
-    if (!activator || !activator->manager) {
-        status = CELIX_BUNDLE_EXCEPTION;
-    } else {
-        logHelper_stop(activator->loghelper);
-        logHelper_destroy(&activator->loghelper);
+	struct activator *activator = userData;
+	if (!activator || !activator->manager) {
+		status = CELIX_BUNDLE_EXCEPTION;
+	} else {
+		logHelper_stop(activator->loghelper);
+		logHelper_destroy(&activator->loghelper);
 
-        status = topologyManager_destroy(activator->manager);
+		status = topologyManager_destroy(activator->manager);
 
-        if (activator->scopeService) {
-        	free(activator->scopeService);
-        }
+		if (activator->scopeService) {
+			free(activator->scopeService);
+		}
 
-        free(activator);
-    }
+		free(activator);
+	}
 
-    return status;
+	return status;
 }
diff --git a/remote_services/topology_manager/private/src/scope.c b/remote_services/topology_manager/private/src/scope.c
index 59e030c..b81d050 100644
--- a/remote_services/topology_manager/private/src/scope.c
+++ b/remote_services/topology_manager/private/src/scope.c
@@ -47,7 +47,7 @@
     celix_status_t (*importScopeChangedHandler)(void* manager, char *filter);
 };
 
-static celix_status_t import_equal(void *, void *, bool *equals);
+static celix_status_t import_equal(const void *, const void *, bool *equals);
 
 /*
  * SERVICES
@@ -243,7 +243,7 @@
 /*****************************************************************************
  * STATIC FUNCTIONS
  *****************************************************************************/
-static celix_status_t import_equal(void *src, void *dest, bool *equals) {
+static celix_status_t import_equal(const void *src, const void *dest, bool *equals) {
     celix_status_t status;
 
     filter_pt src_filter = (filter_pt) src;
@@ -286,7 +286,7 @@
     serviceReference_getPropertyKeys(reference, &keys, &size);
     for (int i = 0; i < size; i++) {
         char *key = keys[i];
-        char *value = NULL;
+        const char* value = NULL;
 
         if (serviceReference_getProperty(reference, key, &value) == CELIX_SUCCESS) {
 //        		&& strcmp(key, (char*) OSGI_RSA_SERVICE_EXPORTED_INTERFACES) != 0
diff --git a/remote_services/topology_manager/private/src/topology_manager.c b/remote_services/topology_manager/private/src/topology_manager.c
index a116383..6472b01 100644
--- a/remote_services/topology_manager/private/src/topology_manager.c
+++ b/remote_services/topology_manager/private/src/topology_manager.c
@@ -46,23 +46,25 @@
 #include "hash_map.h"
 
 struct topology_manager {
-    bundle_context_pt context;
+	bundle_context_pt context;
 
-    celix_thread_mutex_t rsaListLock;
-    array_list_pt rsaList;
+	celix_thread_mutex_t rsaListLock;
+	celix_thread_mutexattr_t rsaListLockAttr;
+	array_list_pt rsaList;
 
-    celix_thread_mutex_t listenerListLock;
-    hash_map_pt listenerList;
+	celix_thread_mutex_t listenerListLock;
+	hash_map_pt listenerList;
 
-    celix_thread_mutex_t exportedServicesLock;
-    hash_map_pt exportedServices;
+	celix_thread_mutex_t exportedServicesLock;
+	hash_map_pt exportedServices;
 
-    celix_thread_mutex_t importedServicesLock;
-    hash_map_pt importedServices;
+	celix_thread_mutex_t importedServicesLock;
+	celix_thread_mutexattr_t importedServicesLockAttr;
+	hash_map_pt importedServices;
 
-    scope_pt scope;
+	scope_pt scope;
 
-    log_helper_pt loghelper;
+	log_helper_pt loghelper;
 };
 
 celix_status_t topologyManager_exportScopeChanged(void *handle, char *service_name);
@@ -71,899 +73,913 @@
 celix_status_t topologyManager_notifyListenersEndpointRemoved(topology_manager_pt manager, remote_service_admin_service_pt rsa, export_registration_pt export);
 
 celix_status_t topologyManager_create(bundle_context_pt context, log_helper_pt logHelper, topology_manager_pt *manager, void **scope) {
-    celix_status_t status = CELIX_SUCCESS;
+	celix_status_t status = CELIX_SUCCESS;
 
-    *manager = calloc(1, sizeof(**manager));
+	*manager = calloc(1, sizeof(**manager));
 
-    if (!*manager) {
-        return CELIX_ENOMEM;
-    }
+	if (!*manager) {
+		return CELIX_ENOMEM;
+	}
 
-    (*manager)->context = context;
-    (*manager)->rsaList = NULL;
+	(*manager)->context = context;
+	(*manager)->rsaList = NULL;
 
-    arrayList_create(&(*manager)->rsaList);
-
-    celixThreadMutex_create(&(*manager)->rsaListLock, NULL);
-    celixThreadMutex_create(&(*manager)->exportedServicesLock, NULL);
-    celixThreadMutex_create(&(*manager)->importedServicesLock, NULL);
-    celixThreadMutex_create(&(*manager)->listenerListLock, NULL);
-
-    (*manager)->listenerList = hashMap_create(serviceReference_hashCode, NULL, serviceReference_equals2, NULL);
-    (*manager)->exportedServices = hashMap_create(serviceReference_hashCode, NULL, serviceReference_equals2, NULL);
-    (*manager)->importedServices = hashMap_create(NULL, NULL, NULL, NULL);
-
-    status = scope_scopeCreate(*manager, &(*manager)->scope);
-    scope_setExportScopeChangedCallback((*manager)->scope, topologyManager_exportScopeChanged);
-    scope_setImportScopeChangedCallback((*manager)->scope, topologyManager_importScopeChanged);
-    *scope = (*manager)->scope;
-
-    (*manager)->loghelper = logHelper;
+	arrayList_create(&(*manager)->rsaList);
 
 
-    return status;
+	celixThreadMutexAttr_create(&(*manager)->rsaListLockAttr);
+	celixThreadMutexAttr_settype(&(*manager)->rsaListLockAttr, CELIX_THREAD_MUTEX_RECURSIVE);
+	celixThreadMutex_create(&(*manager)->rsaListLock, &(*manager)->rsaListLockAttr);
+
+	celixThreadMutexAttr_create(&(*manager)->importedServicesLockAttr);
+	celixThreadMutexAttr_settype(&(*manager)->importedServicesLockAttr, CELIX_THREAD_MUTEX_RECURSIVE);
+	celixThreadMutex_create(&(*manager)->importedServicesLock, &(*manager)->importedServicesLockAttr);
+
+	celixThreadMutex_create(&(*manager)->exportedServicesLock, NULL);
+	celixThreadMutex_create(&(*manager)->listenerListLock, NULL);
+
+	(*manager)->listenerList = hashMap_create(serviceReference_hashCode, NULL, serviceReference_equals2, NULL);
+	(*manager)->exportedServices = hashMap_create(serviceReference_hashCode, NULL, serviceReference_equals2, NULL);
+	(*manager)->importedServices = hashMap_create(NULL, NULL, NULL, NULL);
+
+	status = scope_scopeCreate(*manager, &(*manager)->scope);
+	scope_setExportScopeChangedCallback((*manager)->scope, topologyManager_exportScopeChanged);
+	scope_setImportScopeChangedCallback((*manager)->scope, topologyManager_importScopeChanged);
+	*scope = (*manager)->scope;
+
+	(*manager)->loghelper = logHelper;
+
+
+	return status;
 }
 
 celix_status_t topologyManager_destroy(topology_manager_pt manager) {
-    celix_status_t status = CELIX_SUCCESS;
+	celix_status_t status = CELIX_SUCCESS;
 
-    celixThreadMutex_lock(&manager->listenerListLock);
-    hashMap_destroy(manager->listenerList, false, false);
+	celixThreadMutex_lock(&manager->listenerListLock);
+	hashMap_destroy(manager->listenerList, false, false);
 
-    celixThreadMutex_unlock(&manager->listenerListLock);
-    celixThreadMutex_destroy(&manager->listenerListLock);
+	celixThreadMutex_unlock(&manager->listenerListLock);
+	celixThreadMutex_destroy(&manager->listenerListLock);
 
-    celixThreadMutex_lock(&manager->rsaListLock);
+	celixThreadMutex_lock(&manager->rsaListLock);
 
-    arrayList_destroy(manager->rsaList);
+	arrayList_destroy(manager->rsaList);
 
-    celixThreadMutex_unlock(&manager->rsaListLock);
-    celixThreadMutex_destroy(&manager->rsaListLock);
+	celixThreadMutex_unlock(&manager->rsaListLock);
+	celixThreadMutex_destroy(&manager->rsaListLock);
+	celixThreadMutexAttr_destroy(&manager->rsaListLockAttr);
 
-    celixThreadMutex_lock(&manager->exportedServicesLock);
+	celixThreadMutex_lock(&manager->exportedServicesLock);
 
-    hashMap_destroy(manager->exportedServices, false, false);
+	hashMap_destroy(manager->exportedServices, false, false);
 
-    celixThreadMutex_unlock(&manager->exportedServicesLock);
-    celixThreadMutex_destroy(&manager->exportedServicesLock);
+	celixThreadMutex_unlock(&manager->exportedServicesLock);
+	celixThreadMutex_destroy(&manager->exportedServicesLock);
 
-    celixThreadMutex_lock(&manager->importedServicesLock);
+	celixThreadMutex_lock(&manager->importedServicesLock);
 
-    hashMap_destroy(manager->importedServices, false, false);
+	hashMap_destroy(manager->importedServices, false, false);
 
-    celixThreadMutex_unlock(&manager->importedServicesLock);
-    celixThreadMutex_destroy(&manager->importedServicesLock);
+	celixThreadMutex_unlock(&manager->importedServicesLock);
+	celixThreadMutex_destroy(&manager->importedServicesLock);
+	celixThreadMutexAttr_destroy(&manager->importedServicesLockAttr);
 
-    scope_scopeDestroy(manager->scope);
-    free(manager);
+	scope_scopeDestroy(manager->scope);
+	free(manager);
 
-    return status;
+	return status;
 }
 
 celix_status_t topologyManager_closeImports(topology_manager_pt manager) {
-    celix_status_t status;
+	celix_status_t status;
 
-    status = celixThreadMutex_lock(&manager->importedServicesLock);
+	status = celixThreadMutex_lock(&manager->importedServicesLock);
 
-    hash_map_iterator_pt iter = hashMapIterator_create(manager->importedServices);
-    while (hashMapIterator_hasNext(iter)) {
-        hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
-        endpoint_description_pt ep = hashMapEntry_getKey(entry);
-        hash_map_pt imports = hashMapEntry_getValue(entry);
+	hash_map_iterator_pt iter = hashMapIterator_create(manager->importedServices);
+	while (hashMapIterator_hasNext(iter)) {
+		hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
+		endpoint_description_pt ep = hashMapEntry_getKey(entry);
+		hash_map_pt imports = hashMapEntry_getValue(entry);
 
-        logHelper_log(manager->loghelper, OSGI_LOGSERVICE_INFO, "TOPOLOGY_MANAGER: Remove imported service (%s; %s).", ep->service, ep->id);
-        hash_map_iterator_pt importsIter = hashMapIterator_create(imports);
+		if (imports != NULL) {
+			logHelper_log(manager->loghelper, OSGI_LOGSERVICE_INFO, "TOPOLOGY_MANAGER: Remove imported service (%s; %s).", ep->service, ep->id);
+			hash_map_iterator_pt importsIter = hashMapIterator_create(imports);
 
-        while (hashMapIterator_hasNext(importsIter)) {
-            hash_map_entry_pt entry = hashMapIterator_nextEntry(importsIter);
+			while (hashMapIterator_hasNext(importsIter)) {
+				hash_map_entry_pt entry = hashMapIterator_nextEntry(importsIter);
 
-            remote_service_admin_service_pt rsa = hashMapEntry_getKey(entry);
-            import_registration_pt import = hashMapEntry_getValue(entry);
+				remote_service_admin_service_pt rsa = hashMapEntry_getKey(entry);
+				import_registration_pt import = hashMapEntry_getValue(entry);
 
-            status = rsa->importRegistration_close(rsa->admin, import);
-            if (status == CELIX_SUCCESS) {
-                hashMapIterator_remove(importsIter);
-            }
-        }
-        hashMapIterator_destroy(importsIter);
+				status = rsa->importRegistration_close(rsa->admin, import);
+				if (status == CELIX_SUCCESS) {
+					hashMapIterator_remove(importsIter);
+				}
+			}
+			hashMapIterator_destroy(importsIter);
 
-        hashMapIterator_remove(iter);
+			hashMapIterator_remove(iter);
 
-        if (imports != NULL) {
-            hashMap_destroy(imports, false, false);
-        }
-    }
-    hashMapIterator_destroy(iter);
+			hashMap_destroy(imports, false, false);
+		}
+	}
+	hashMapIterator_destroy(iter);
 
-    status = celixThreadMutex_unlock(&manager->importedServicesLock);
+	status = celixThreadMutex_unlock(&manager->importedServicesLock);
 
-    return status;
+	return status;
 }
 
 celix_status_t topologyManager_rsaAdding(void * handle, service_reference_pt reference, void **service) {
-    celix_status_t status;
-    topology_manager_pt manager = (topology_manager_pt) handle;
+	celix_status_t status;
+	topology_manager_pt manager = (topology_manager_pt) handle;
 
-    status = bundleContext_getService(manager->context, reference, service);
+	status = bundleContext_getService(manager->context, reference, service);
 
-    return status;
+	return status;
 }
 
 celix_status_t topologyManager_rsaAdded(void * handle, service_reference_pt reference, void * service) {
-    celix_status_t status;
-    topology_manager_pt manager = (topology_manager_pt) handle;
-    properties_pt serviceProperties = NULL;
-    remote_service_admin_service_pt rsa = (remote_service_admin_service_pt) service;
-    logHelper_log(manager->loghelper, OSGI_LOGSERVICE_INFO, "TOPOLOGY_MANAGER: Added RSA");
+	celix_status_t status;
+	topology_manager_pt manager = (topology_manager_pt) handle;
+	properties_pt serviceProperties = NULL;
+	remote_service_admin_service_pt rsa = (remote_service_admin_service_pt) service;
+	logHelper_log(manager->loghelper, OSGI_LOGSERVICE_INFO, "TOPOLOGY_MANAGER: Added RSA");
 
-    status = celixThreadMutex_lock(&manager->rsaListLock);
+	status = celixThreadMutex_lock(&manager->rsaListLock);
 
-    if (status == CELIX_SUCCESS) {
-        arrayList_add(manager->rsaList, rsa);
-        status = celixThreadMutex_unlock(&manager->rsaListLock);
-    }
+	if (status == CELIX_SUCCESS) {
+		arrayList_add(manager->rsaList, rsa);
+		status = celixThreadMutex_unlock(&manager->rsaListLock);
+	}
 
-    // add already imported services to new rsa
-    if (status == CELIX_SUCCESS) {
-        status = celixThreadMutex_lock(&manager->importedServicesLock);
+	// add already imported services to new rsa
+	if (status == CELIX_SUCCESS) {
+		status = celixThreadMutex_lock(&manager->importedServicesLock);
 
-        if (status == CELIX_SUCCESS) {
-            hash_map_iterator_pt importedServicesIterator = hashMapIterator_create(manager->importedServices);
+		if (status == CELIX_SUCCESS) {
+			hash_map_iterator_pt importedServicesIterator = hashMapIterator_create(manager->importedServices);
 
-            while (hashMapIterator_hasNext(importedServicesIterator)) {
-                hash_map_entry_pt entry = hashMapIterator_nextEntry(importedServicesIterator);
-                endpoint_description_pt endpoint = hashMapEntry_getKey(entry);
-                if (scope_allowImport(manager->scope, endpoint)) {
-                    import_registration_pt import = NULL;
-                    status = rsa->importService(rsa->admin, endpoint, &import);
+			while (hashMapIterator_hasNext(importedServicesIterator)) {
+				hash_map_entry_pt entry = hashMapIterator_nextEntry(importedServicesIterator);
+				endpoint_description_pt endpoint = hashMapEntry_getKey(entry);
+				if (scope_allowImport(manager->scope, endpoint)) {
+					import_registration_pt import = NULL;
+					status = rsa->importService(rsa->admin, endpoint, &import);
 
-                    if (status == CELIX_SUCCESS) {
-                        hash_map_pt imports = hashMapEntry_getValue(entry);
+					if (status == CELIX_SUCCESS) {
+						hash_map_pt imports = hashMapEntry_getValue(entry);
 
-                        if (imports == NULL) {
-                            imports = hashMap_create(NULL, NULL, NULL, NULL);
-                        }
+						if (imports == NULL) {
+							imports = hashMap_create(NULL, NULL, NULL, NULL);
+							hashMap_put(manager->importedServices,endpoint,imports);
+						}
 
-                        hashMap_put(imports, service, import);
-                    }
-                }
-            }
+						hashMap_put(imports, service, import);
+					}
+				}
+			}
 
-            hashMapIterator_destroy(importedServicesIterator);
+			hashMapIterator_destroy(importedServicesIterator);
 
-            celixThreadMutex_unlock(&manager->importedServicesLock);
-        }
-    }
+			celixThreadMutex_unlock(&manager->importedServicesLock);
+		}
+	}
 
-    // add already exported services to new rsa
-    if (status == CELIX_SUCCESS) {
-        status = celixThreadMutex_lock(&manager->exportedServicesLock);
+	// add already exported services to new rsa
+	if (status == CELIX_SUCCESS) {
+		status = celixThreadMutex_lock(&manager->exportedServicesLock);
 
-        if (status == CELIX_SUCCESS) {
-            hash_map_iterator_pt exportedServicesIterator = hashMapIterator_create(manager->exportedServices);
+		if (status == CELIX_SUCCESS) {
+			hash_map_iterator_pt exportedServicesIterator = hashMapIterator_create(manager->exportedServices);
 
-            while (hashMapIterator_hasNext(exportedServicesIterator)) {
-                hash_map_entry_pt entry = hashMapIterator_nextEntry(exportedServicesIterator);
-                service_reference_pt reference = hashMapEntry_getKey(entry);
-                char *serviceId = NULL;
+			while (hashMapIterator_hasNext(exportedServicesIterator)) {
+				hash_map_entry_pt entry = hashMapIterator_nextEntry(exportedServicesIterator);
+				service_reference_pt reference = hashMapEntry_getKey(entry);
+				const char* serviceId = NULL;
 
-                serviceReference_getProperty(reference, (char *) OSGI_FRAMEWORK_SERVICE_ID, &serviceId);
+				serviceReference_getProperty(reference, OSGI_FRAMEWORK_SERVICE_ID, &serviceId);
 
-                scope_getExportProperties(manager->scope, reference, &serviceProperties);
+				scope_getExportProperties(manager->scope, reference, &serviceProperties);
 
-                array_list_pt endpoints = NULL;
-                status = rsa->exportService(rsa->admin, serviceId, serviceProperties, &endpoints);
+				array_list_pt endpoints = NULL;
+				status = rsa->exportService(rsa->admin, (char*)serviceId, serviceProperties, &endpoints);
 
-                if (status == CELIX_SUCCESS) {
-                    hash_map_pt exports = hashMapEntry_getValue(entry);
+				if (status == CELIX_SUCCESS) {
+					hash_map_pt exports = hashMapEntry_getValue(entry);
 
-                    if (exports == NULL) {
-                        exports = hashMap_create(NULL, NULL, NULL, NULL);
-                    }
+					if (exports == NULL) {
+						exports = hashMap_create(NULL, NULL, NULL, NULL);
+						hashMap_put(manager->exportedServices,reference,exports);
+					}
 
-                    hashMap_put(exports, rsa, endpoints);
-                    status = topologyManager_notifyListenersEndpointAdded(manager, rsa, endpoints);
-                }
-            }
+					hashMap_put(exports, rsa, endpoints);
+					status = topologyManager_notifyListenersEndpointAdded(manager, rsa, endpoints);
+				}
+			}
 
-            hashMapIterator_destroy(exportedServicesIterator);
+			hashMapIterator_destroy(exportedServicesIterator);
 
-            celixThreadMutex_unlock(&manager->exportedServicesLock);
-        }
-    }
-    return status;
+			celixThreadMutex_unlock(&manager->exportedServicesLock);
+		}
+	}
+	return status;
 }
 
 celix_status_t topologyManager_rsaModified(void * handle, service_reference_pt reference, void * service) {
-    celix_status_t status = CELIX_SUCCESS;
+	celix_status_t status = CELIX_SUCCESS;
 
-    // Nop...
+	// Nop...
 
-    return status;
+	return status;
 }
 
 celix_status_t topologyManager_rsaRemoved(void * handle, service_reference_pt reference, void * service) {
-    celix_status_t status = CELIX_SUCCESS;
-    topology_manager_pt manager = (topology_manager_pt) handle;
-    remote_service_admin_service_pt rsa = (remote_service_admin_service_pt) service;
+	celix_status_t status = CELIX_SUCCESS;
+	topology_manager_pt manager = (topology_manager_pt) handle;
+	remote_service_admin_service_pt rsa = (remote_service_admin_service_pt) service;
 
-    if (celixThreadMutex_lock(&manager->exportedServicesLock) == CELIX_SUCCESS) {
-        hash_map_iterator_pt iter = hashMapIterator_create(manager->exportedServices);
+	if (celixThreadMutex_lock(&manager->exportedServicesLock) == CELIX_SUCCESS) {
+		hash_map_iterator_pt iter = hashMapIterator_create(manager->exportedServices);
 
-        while (hashMapIterator_hasNext(iter)) {
+		while (hashMapIterator_hasNext(iter)) {
 
-            hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
-            service_reference_pt key = hashMapEntry_getKey(entry);
-            hash_map_pt exports = hashMapEntry_getValue(entry);
+			hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
+			service_reference_pt key = hashMapEntry_getKey(entry);
+			hash_map_pt exports = hashMapEntry_getValue(entry);
 
-            /*
-             * the problem here is that also the rsa has a a list of
-             * endpoints which is destroyed when closing the exportRegistration
-             */
-            array_list_pt exports_list = hashMap_get(exports, rsa);
+			/*
+			 * the problem here is that also the rsa has a a list of
+			 * endpoints which is destroyed when closing the exportRegistration
+			 */
+			array_list_pt exports_list = hashMap_get(exports, rsa);
 
-            if (exports_list != NULL) {
-                int exportsIter = 0;
-                int exportListSize = arrayList_size(exports_list);
-                for (exportsIter = 0; exports_list != NULL && exportsIter < exportListSize; exportsIter++) {
-                    export_registration_pt export = arrayList_get(exports_list, exportsIter);
-                    topologyManager_notifyListenersEndpointRemoved(manager, rsa, export);
-                    rsa->exportRegistration_close(rsa->admin, export);
-                }
-            }
+			if (exports_list != NULL) {
+				int exportsIter = 0;
+				int exportListSize = arrayList_size(exports_list);
+				for (exportsIter = 0; exports_list != NULL && exportsIter < exportListSize; exportsIter++) {
+					export_registration_pt export = arrayList_get(exports_list, exportsIter);
+					topologyManager_notifyListenersEndpointRemoved(manager, rsa, export);
+					rsa->exportRegistration_close(rsa->admin, export);
+				}
+			}
 
-            hashMap_remove(exports, rsa);
-            /*if(exports_list!=NULL){
+			hashMap_remove(exports, rsa);
+			/*if(exports_list!=NULL){
             	arrayList_destroy(exports_list);
             }*/
 
-            if (hashMap_size(exports) == 0) {
-                hashMap_remove(manager->exportedServices, key);
-                hashMap_destroy(exports, false, false);
+			if (hashMap_size(exports) == 0) {
+				hashMap_remove(manager->exportedServices, key);
+				hashMap_destroy(exports, false, false);
 
-                hashMapIterator_destroy(iter);
-                iter = hashMapIterator_create(manager->exportedServices);
-            }
-        }
-        hashMapIterator_destroy(iter);
-        celixThreadMutex_unlock(&manager->exportedServicesLock);
-    }
+				hashMapIterator_destroy(iter);
+				iter = hashMapIterator_create(manager->exportedServices);
+			}
+		}
+		hashMapIterator_destroy(iter);
+		celixThreadMutex_unlock(&manager->exportedServicesLock);
+	}
 
-    if (celixThreadMutex_lock(&manager->importedServicesLock) == CELIX_SUCCESS) {
-        hash_map_iterator_pt iter = hashMapIterator_create(manager->importedServices);
+	if (celixThreadMutex_lock(&manager->importedServicesLock) == CELIX_SUCCESS) {
+		hash_map_iterator_pt iter = hashMapIterator_create(manager->importedServices);
 
-        while (hashMapIterator_hasNext(iter)) {
-            hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
-            hash_map_pt imports = hashMapEntry_getValue(entry);
+		while (hashMapIterator_hasNext(iter)) {
+			hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
+			hash_map_pt imports = hashMapEntry_getValue(entry);
 
-            import_registration_pt import = hashMap_get(imports, rsa);
+			import_registration_pt import = hashMap_get(imports, rsa);
 
-            if (import != NULL) {
-                celix_status_t subStatus = rsa->importRegistration_close(rsa->admin, import);
+			if (import != NULL) {
+				celix_status_t subStatus = rsa->importRegistration_close(rsa->admin, import);
 
-                if (subStatus == CELIX_SUCCESS) {
-                    hashMap_remove(imports, rsa);
-                } else {
-                    status = subStatus;
-                }
-            }
-        }
-        hashMapIterator_destroy(iter);
-        celixThreadMutex_unlock(&manager->importedServicesLock);
-    }
+				if (subStatus == CELIX_SUCCESS) {
+					hashMap_remove(imports, rsa);
+				} else {
+					status = subStatus;
+				}
+			}
+		}
+		hashMapIterator_destroy(iter);
+		celixThreadMutex_unlock(&manager->importedServicesLock);
+	}
 
-    if (celixThreadMutex_lock(&manager->rsaListLock) == CELIX_SUCCESS) {
-        arrayList_removeElement(manager->rsaList, rsa);
-        celixThreadMutex_unlock(&manager->rsaListLock);
-    }
+	if (celixThreadMutex_lock(&manager->rsaListLock) == CELIX_SUCCESS) {
+		arrayList_removeElement(manager->rsaList, rsa);
+		celixThreadMutex_unlock(&manager->rsaListLock);
+	}
 
-    logHelper_log(manager->loghelper, OSGI_LOGSERVICE_INFO, "TOPOLOGY_MANAGER: Removed RSA");
+	logHelper_log(manager->loghelper, OSGI_LOGSERVICE_INFO, "TOPOLOGY_MANAGER: Removed RSA");
 
-    return status;
+	return status;
 }
 
 
 celix_status_t topologyManager_serviceChanged(void *listener, service_event_pt event) {
-    celix_status_t status = CELIX_SUCCESS;
-    service_listener_pt listen = listener;
-    topology_manager_pt manager = listen->handle;
+	celix_status_t status = CELIX_SUCCESS;
+	service_listener_pt listen = listener;
+	topology_manager_pt manager = listen->handle;
 
-    char *export = NULL;
-    char *serviceId = NULL;
-    serviceReference_getProperty(event->reference, (char *) OSGI_RSA_SERVICE_EXPORTED_INTERFACES, &export);
-    serviceReference_getProperty(event->reference, (char *) OSGI_FRAMEWORK_SERVICE_ID, &serviceId);
+	const char* export = NULL;
+	const char* serviceId = NULL;
+	serviceReference_getProperty(event->reference, OSGI_RSA_SERVICE_EXPORTED_INTERFACES, &export);
+	serviceReference_getProperty(event->reference, OSGI_FRAMEWORK_SERVICE_ID, &serviceId);
 
-    if (!export) {
-        // Nothing needs to be done: we're not interested...
-        return status;
-    }
+	if (!export) {
+		// Nothing needs to be done: we're not interested...
+		return status;
+	}
 
-    switch (event->type) {
-        case OSGI_FRAMEWORK_SERVICE_EVENT_REGISTERED:
-            status = topologyManager_addExportedService(manager, event->reference, serviceId);
-            break;
-        case OSGI_FRAMEWORK_SERVICE_EVENT_MODIFIED:
-            status = topologyManager_removeExportedService(manager, event->reference, serviceId);
+	switch (event->type) {
+	case OSGI_FRAMEWORK_SERVICE_EVENT_REGISTERED:
+		status = topologyManager_addExportedService(manager, event->reference, (char*)serviceId);
+		break;
+	case OSGI_FRAMEWORK_SERVICE_EVENT_MODIFIED:
+		status = topologyManager_removeExportedService(manager, event->reference, (char*)serviceId);
 
-            if (status == CELIX_SUCCESS) {
-                status = topologyManager_addExportedService(manager, event->reference, serviceId);
-            }
-            break;
-        case OSGI_FRAMEWORK_SERVICE_EVENT_UNREGISTERING:
-            status = topologyManager_removeExportedService(manager, event->reference, serviceId);
-            break;
-        case OSGI_FRAMEWORK_SERVICE_EVENT_MODIFIED_ENDMATCH:
-            break;
-    }
+		if (status == CELIX_SUCCESS) {
+			status = topologyManager_addExportedService(manager, event->reference, (char*)serviceId);
+		}
+		break;
+	case OSGI_FRAMEWORK_SERVICE_EVENT_UNREGISTERING:
+		status = topologyManager_removeExportedService(manager, event->reference, (char*)serviceId);
+		break;
+	case OSGI_FRAMEWORK_SERVICE_EVENT_MODIFIED_ENDMATCH:
+		break;
+	}
 
-    return status;
+	return status;
 }
 
 celix_status_t topologyManager_exportScopeChanged(void *handle, char *filterStr) {
-    celix_status_t status = CELIX_SUCCESS;
-    topology_manager_pt manager = (topology_manager_pt) handle;
-    service_registration_pt reg = NULL;
-    char *serviceId = NULL;
-    bool found;
-    properties_pt props;
-    filter_pt filter = filter_create(filterStr);
+	celix_status_t status = CELIX_SUCCESS;
+	topology_manager_pt manager = (topology_manager_pt) handle;
+	service_registration_pt reg = NULL;
+	const char* serviceId = NULL;
+	bool found;
+	properties_pt props;
+	filter_pt filter = filter_create(filterStr);
 
-    if (filter == NULL) {
-        printf("filter creating failed\n");
-        return CELIX_ENOMEM;
-    }
+	if (filter == NULL) {
+		printf("filter creating failed\n");
+		return CELIX_ENOMEM;
+	}
 
-    // add already exported services to new rsa
-    if (celixThreadMutex_lock(&manager->exportedServicesLock) == CELIX_SUCCESS) {
-        hash_map_iterator_pt exportedServicesIterator = hashMapIterator_create(manager->exportedServices);
-        int size = hashMap_size(manager->exportedServices);
-        service_reference_pt *srvRefs = (service_reference_pt *) calloc(size, sizeof(service_reference_pt));
-        char **srvIds = (char **) calloc(size, sizeof(char*));
-        int nrFound = 0;
+	// add already exported services to new rsa
+	if (celixThreadMutex_lock(&manager->exportedServicesLock) == CELIX_SUCCESS) {
+		hash_map_iterator_pt exportedServicesIterator = hashMapIterator_create(manager->exportedServices);
+		int size = hashMap_size(manager->exportedServices);
+		service_reference_pt *srvRefs = (service_reference_pt *) calloc(size, sizeof(service_reference_pt));
+		char **srvIds = (char **) calloc(size, sizeof(char*));
+		int nrFound = 0;
 
-        found = false;
+		found = false;
 
-        while (hashMapIterator_hasNext(exportedServicesIterator)) {
-            hash_map_entry_pt entry = hashMapIterator_nextEntry(exportedServicesIterator);
-            service_reference_pt reference = hashMapEntry_getKey(entry);
-            reg = NULL;
-            serviceReference_getServiceRegistration(reference, &reg);
-            if (reg != NULL) {
-                props = NULL;
-                serviceRegistration_getProperties(reg, &props);
-                status = filter_match(filter, props, &found);
-                if (found) {
-                    srvRefs[nrFound] = reference;
-                    serviceReference_getProperty(reference, (char *) OSGI_FRAMEWORK_SERVICE_ID, &serviceId);
-                    srvIds[nrFound++] = serviceId;
-                }
-            }
-        }
+		while (hashMapIterator_hasNext(exportedServicesIterator)) {
+			hash_map_entry_pt entry = hashMapIterator_nextEntry(exportedServicesIterator);
+			service_reference_pt reference = hashMapEntry_getKey(entry);
+			reg = NULL;
+			serviceReference_getServiceRegistration(reference, &reg);
+			if (reg != NULL) {
+				props = NULL;
+				serviceRegistration_getProperties(reg, &props);
+				status = filter_match(filter, props, &found);
+				if (found) {
+					srvRefs[nrFound] = reference;
+					serviceReference_getProperty(reference, OSGI_FRAMEWORK_SERVICE_ID, &serviceId);
+					srvIds[nrFound++] = (char*)serviceId;
+				}
+			}
+		}
 
-        hashMapIterator_destroy(exportedServicesIterator);
-        celixThreadMutex_unlock(&manager->exportedServicesLock);
+		hashMapIterator_destroy(exportedServicesIterator);
+		celixThreadMutex_unlock(&manager->exportedServicesLock);
 
-        if (nrFound > 0) {
-            for (int i = 0; i < nrFound; i++) {
-                // Question: can srvRefs become invalid meanwhile??
-                char *export = NULL;
-                serviceReference_getProperty(srvRefs[i], (char *) OSGI_RSA_SERVICE_EXPORTED_INTERFACES, &export);
+		if (nrFound > 0) {
+			for (int i = 0; i < nrFound; i++) {
+				// Question: can srvRefs become invalid meanwhile??
+				const char* export = NULL;
+				serviceReference_getProperty(srvRefs[i], (char *) OSGI_RSA_SERVICE_EXPORTED_INTERFACES, &export);
 
-                if (export) {
-                    celix_status_t substatus = topologyManager_removeExportedService(manager, srvRefs[i], srvIds[i]);
+				if (export) {
+					celix_status_t substatus = topologyManager_removeExportedService(manager, srvRefs[i], srvIds[i]);
 
-                    if (substatus != CELIX_SUCCESS) {
-                        logHelper_log(manager->loghelper, OSGI_LOGSERVICE_ERROR, "TOPOLOGY_MANAGER: Removal of exported service (%s) failed.", srvIds[i]);
-                    } else {
-                        substatus = topologyManager_addExportedService(manager, srvRefs[i], srvIds[i]);
-                    }
+					if (substatus != CELIX_SUCCESS) {
+						logHelper_log(manager->loghelper, OSGI_LOGSERVICE_ERROR, "TOPOLOGY_MANAGER: Removal of exported service (%s) failed.", srvIds[i]);
+					} else {
+						substatus = topologyManager_addExportedService(manager, srvRefs[i], srvIds[i]);
+					}
 
-                    if (substatus != CELIX_SUCCESS) {
-                        status = substatus;
-                    }
-                }
-            }
-        }
+					if (substatus != CELIX_SUCCESS) {
+						status = substatus;
+					}
+				}
+			}
+		}
 
-        free(srvRefs);
-        free(srvIds);
-    }
+		free(srvRefs);
+		free(srvIds);
+	}
 
-    filter_destroy(filter);
+	filter_destroy(filter);
 
-    return status;
+	return status;
 }
 
 celix_status_t topologyManager_importScopeChanged(void *handle, char *service_name) {
-    celix_status_t status = CELIX_SUCCESS;
-    endpoint_description_pt endpoint;
-    topology_manager_pt manager = (topology_manager_pt) handle;
-    bool found = false;
+	celix_status_t status = CELIX_SUCCESS;
+	endpoint_description_pt endpoint;
+	topology_manager_pt manager = (topology_manager_pt) handle;
+	bool found = false;
 
-    // add already exported services to new rsa
-    if (celixThreadMutex_lock(&manager->importedServicesLock) == CELIX_SUCCESS) {
-        hash_map_iterator_pt importedServicesIterator = hashMapIterator_create(manager->importedServices);
-        while (!found && hashMapIterator_hasNext(importedServicesIterator)) {
-            hash_map_entry_pt entry = hashMapIterator_nextEntry(importedServicesIterator);
-            endpoint = hashMapEntry_getKey(entry);
+	// add already exported services to new rsa
+	if (celixThreadMutex_lock(&manager->importedServicesLock) == CELIX_SUCCESS) {
+		hash_map_iterator_pt importedServicesIterator = hashMapIterator_create(manager->importedServices);
+		while (!found && hashMapIterator_hasNext(importedServicesIterator)) {
+			hash_map_entry_pt entry = hashMapIterator_nextEntry(importedServicesIterator);
+			endpoint = hashMapEntry_getKey(entry);
 
-            entry = hashMap_getEntry(endpoint->properties, (void *) OSGI_FRAMEWORK_OBJECTCLASS);
-            char* name = (char *) hashMapEntry_getValue(entry);
-            // Test if a service with the same name is imported
-            if (strcmp(name, service_name) == 0) {
-                found = true;
-            }
-        }
-        hashMapIterator_destroy(importedServicesIterator);
-        celixThreadMutex_unlock(&manager->importedServicesLock);
-    }
+			entry = hashMap_getEntry(endpoint->properties, (void *) OSGI_FRAMEWORK_OBJECTCLASS);
+			char* name = (char *) hashMapEntry_getValue(entry);
+			// Test if a service with the same name is imported
+			if (strcmp(name, service_name) == 0) {
+				found = true;
+			}
+		}
+		hashMapIterator_destroy(importedServicesIterator);
+		celixThreadMutex_unlock(&manager->importedServicesLock);
+	}
 
-    if (found) {
-        status = topologyManager_removeImportedService(manager, endpoint, NULL);
+	if (found) {
+		status = topologyManager_removeImportedService(manager, endpoint, NULL);
 
-        if (status != CELIX_SUCCESS) {
-            logHelper_log(manager->loghelper, OSGI_LOGSERVICE_ERROR, "TOPOLOGY_MANAGER: Removal of imported service (%s; %s) failed.", endpoint->service, endpoint->id);
-        } else {
-            status = topologyManager_addImportedService(manager, endpoint, NULL);
-        }
-    }
-    return status;
+		if (status != CELIX_SUCCESS) {
+			logHelper_log(manager->loghelper, OSGI_LOGSERVICE_ERROR, "TOPOLOGY_MANAGER: Removal of imported service (%s; %s) failed.", endpoint->service, endpoint->id);
+		} else {
+			status = topologyManager_addImportedService(manager, endpoint, NULL);
+		}
+	}
+	return status;
 }
 
 celix_status_t topologyManager_addImportedService(void *handle, endpoint_description_pt endpoint, char *matchedFilter) {
-    celix_status_t status = CELIX_SUCCESS;
-    topology_manager_pt manager = handle;
+	celix_status_t status = CELIX_SUCCESS;
+	topology_manager_pt manager = handle;
 
-    logHelper_log(manager->loghelper, OSGI_LOGSERVICE_INFO, "TOPOLOGY_MANAGER: Add imported service (%s; %s).", endpoint->service, endpoint->id);
+	logHelper_log(manager->loghelper, OSGI_LOGSERVICE_INFO, "TOPOLOGY_MANAGER: Add imported service (%s; %s).", endpoint->service, endpoint->id);
 
-    if (celixThreadMutex_lock(&manager->importedServicesLock) == CELIX_SUCCESS) {
+	if (celixThreadMutex_lock(&manager->importedServicesLock) == CELIX_SUCCESS) {
 
-        hash_map_pt imports = hashMap_create(NULL, NULL, NULL, NULL);
-        hashMap_put(manager->importedServices, endpoint, imports);
+		hash_map_pt imports = hashMap_create(NULL, NULL, NULL, NULL);
+		hashMap_put(manager->importedServices, endpoint, imports);
 
-        if (scope_allowImport(manager->scope, endpoint)) {
-            if (celixThreadMutex_lock(&manager->rsaListLock) == CELIX_SUCCESS) {
-                int size = arrayList_size(manager->rsaList);
+		if (scope_allowImport(manager->scope, endpoint)) {
+			if (celixThreadMutex_lock(&manager->rsaListLock) == CELIX_SUCCESS) {
+				int size = arrayList_size(manager->rsaList);
 
-                for (int iter = 0; iter < size; iter++) {
-                    import_registration_pt import = NULL;
-                    remote_service_admin_service_pt rsa = arrayList_get(manager->rsaList, iter);
-                    celix_status_t substatus = rsa->importService(rsa->admin, endpoint, &import);
-                    if (substatus == CELIX_SUCCESS) {
-                        hashMap_put(imports, rsa, import);
-                    } else {
-                        status = substatus;
-                    }
-                }
-                celixThreadMutex_unlock(&manager->rsaListLock);
-            }
+				for (int iter = 0; iter < size; iter++) {
+					import_registration_pt import = NULL;
+					remote_service_admin_service_pt rsa = arrayList_get(manager->rsaList, iter);
+					celix_status_t substatus = rsa->importService(rsa->admin, endpoint, &import);
+					if (substatus == CELIX_SUCCESS) {
+						hashMap_put(imports, rsa, import);
+					} else {
+						status = substatus;
+					}
+				}
+				celixThreadMutex_unlock(&manager->rsaListLock);
+			}
 
-        }
+		}
 
-        celixThreadMutex_unlock(&manager->importedServicesLock);
-    }
+		celixThreadMutex_unlock(&manager->importedServicesLock);
+	}
 
 
-    return status;
+	return status;
 }
 
 celix_status_t topologyManager_removeImportedService(void *handle, endpoint_description_pt endpoint, char *matchedFilter) {
-    celix_status_t status = CELIX_SUCCESS;
-    topology_manager_pt manager = handle;
+	celix_status_t status = CELIX_SUCCESS;
+	topology_manager_pt manager = handle;
 
-    logHelper_log(manager->loghelper, OSGI_LOGSERVICE_INFO, "TOPOLOGY_MANAGER: Remove imported service (%s; %s).", endpoint->service, endpoint->id);
+	logHelper_log(manager->loghelper, OSGI_LOGSERVICE_INFO, "TOPOLOGY_MANAGER: Remove imported service (%s; %s).", endpoint->service, endpoint->id);
 
-    if (celixThreadMutex_lock(&manager->importedServicesLock) == CELIX_SUCCESS) {
+	if (celixThreadMutex_lock(&manager->importedServicesLock) == CELIX_SUCCESS) {
 
-        hash_map_iterator_pt iter = hashMapIterator_create(manager->importedServices);
-        while (hashMapIterator_hasNext(iter)) {
-            hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
-            endpoint_description_pt ep = hashMapEntry_getKey(entry);
-            hash_map_pt imports = hashMapEntry_getValue(entry);
+		hash_map_iterator_pt iter = hashMapIterator_create(manager->importedServices);
+		while (hashMapIterator_hasNext(iter)) {
+			hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
+			endpoint_description_pt ep = hashMapEntry_getKey(entry);
+			hash_map_pt imports = hashMapEntry_getValue(entry);
 
-            if (strcmp(endpoint->id, ep->id) == 0) {
-                hash_map_iterator_pt importsIter = hashMapIterator_create(imports);
+			if (imports != NULL && strcmp(endpoint->id, ep->id) == 0) {
+				hash_map_iterator_pt importsIter = hashMapIterator_create(imports);
 
-                while (hashMapIterator_hasNext(importsIter)) {
-                    hash_map_entry_pt entry = hashMapIterator_nextEntry(importsIter);
-                    remote_service_admin_service_pt rsa = hashMapEntry_getKey(entry);
-                    import_registration_pt import = hashMapEntry_getValue(entry);
-                    celix_status_t substatus = rsa->importRegistration_close(rsa->admin, import);
-                    if (status == CELIX_SUCCESS) {
-                        hashMapIterator_remove(importsIter);
-                    } else {
-                        status = substatus;
-                    }
-                }
-                hashMapIterator_destroy(importsIter);
-                hashMapIterator_remove(iter);
+				while (hashMapIterator_hasNext(importsIter)) {
+					hash_map_entry_pt entry = hashMapIterator_nextEntry(importsIter);
+					remote_service_admin_service_pt rsa = hashMapEntry_getKey(entry);
+					import_registration_pt import = hashMapEntry_getValue(entry);
+					celix_status_t substatus = rsa->importRegistration_close(rsa->admin, import);
+					if (substatus == CELIX_SUCCESS) {
+						hashMapIterator_remove(importsIter);
+					} else {
+						status = substatus;
+					}
+				}
+				hashMapIterator_destroy(importsIter);
+				hashMapIterator_remove(iter);
 
-                if (imports != NULL) {
-                    hashMap_destroy(imports, false, false);
-                }
-            }
-        }
-        hashMapIterator_destroy(iter);
-        celixThreadMutex_unlock(&manager->importedServicesLock);
-    }
+				hashMap_destroy(imports, false, false);
+			}
+		}
+		hashMapIterator_destroy(iter);
+		celixThreadMutex_unlock(&manager->importedServicesLock);
+	}
 
-    return status;
+	return status;
 }
 
 celix_status_t topologyManager_addExportedService(topology_manager_pt manager, service_reference_pt reference, char *serviceId) {
-    celix_status_t status = CELIX_SUCCESS;
-    properties_pt serviceProperties = NULL;
+	celix_status_t status = CELIX_SUCCESS;
+	properties_pt serviceProperties = NULL;
 
-    logHelper_log(manager->loghelper, OSGI_LOGSERVICE_INFO, "TOPOLOGY_MANAGER: Add exported service (%s).", serviceId);
+	logHelper_log(manager->loghelper, OSGI_LOGSERVICE_INFO, "TOPOLOGY_MANAGER: Add exported service (%s).", serviceId);
 
-    if (celixThreadMutex_lock(&manager->exportedServicesLock) == CELIX_SUCCESS) {
-        scope_getExportProperties(manager->scope, reference, &serviceProperties);
-        hash_map_pt exports = hashMap_create(NULL, NULL, NULL, NULL);
-        hashMap_put(manager->exportedServices, reference, exports);
+	if (celixThreadMutex_lock(&manager->exportedServicesLock) == CELIX_SUCCESS) {
+		scope_getExportProperties(manager->scope, reference, &serviceProperties);
+		hash_map_pt exports = hashMap_create(NULL, NULL, NULL, NULL);
+		hashMap_put(manager->exportedServices, reference, exports);
 
-        if (celixThreadMutex_lock(&manager->rsaListLock) == CELIX_SUCCESS) {
-            int size = arrayList_size(manager->rsaList);
+		if (celixThreadMutex_lock(&manager->rsaListLock) == CELIX_SUCCESS) {
+			int size = arrayList_size(manager->rsaList);
 
-            if (size == 0) {
-                logHelper_log(manager->loghelper, OSGI_LOGSERVICE_WARNING, "TOPOLOGY_MANAGER: No RSA available yet.");
-            }
+			if (size == 0) {
+				logHelper_log(manager->loghelper, OSGI_LOGSERVICE_WARNING, "TOPOLOGY_MANAGER: No RSA available yet.");
+			}
 
-            for (int iter = 0; iter < size; iter++) {
-                remote_service_admin_service_pt rsa = arrayList_get(manager->rsaList, iter);
+			for (int iter = 0; iter < size; iter++) {
+				remote_service_admin_service_pt rsa = arrayList_get(manager->rsaList, iter);
 
-                array_list_pt endpoints = NULL;
-                celix_status_t substatus = rsa->exportService(rsa->admin, serviceId, serviceProperties, &endpoints);
+				array_list_pt endpoints = NULL;
+				celix_status_t substatus = rsa->exportService(rsa->admin, serviceId, serviceProperties, &endpoints);
 
-                if (substatus == CELIX_SUCCESS) {
-                    hashMap_put(exports, rsa, endpoints);
-                    topologyManager_notifyListenersEndpointAdded(manager, rsa, endpoints);
-                } else {
-                    status = substatus;
-                }
-            }
-            celixThreadMutex_unlock(&manager->rsaListLock);
-        }
-        celixThreadMutex_unlock(&manager->exportedServicesLock);
-    }
+				if (substatus == CELIX_SUCCESS) {
+					hashMap_put(exports, rsa, endpoints);
+					topologyManager_notifyListenersEndpointAdded(manager, rsa, endpoints);
+				} else {
+					status = substatus;
+				}
+			}
+			celixThreadMutex_unlock(&manager->rsaListLock);
+		}
+		celixThreadMutex_unlock(&manager->exportedServicesLock);
+	}
 
-    return status;
+	return status;
 }
 
 celix_status_t topologyManager_removeExportedService(topology_manager_pt manager, service_reference_pt reference, char *serviceId) {
-    celix_status_t status = CELIX_SUCCESS;
+	celix_status_t status = CELIX_SUCCESS;
 
-    logHelper_log(manager->loghelper, OSGI_LOGSERVICE_INFO, "TOPOLOGY_MANAGER: Remove exported service (%s).", serviceId);
+	logHelper_log(manager->loghelper, OSGI_LOGSERVICE_INFO, "TOPOLOGY_MANAGER: Remove exported service (%s).", serviceId);
 
-    if (celixThreadMutex_lock(&manager->exportedServicesLock) == CELIX_SUCCESS) {
-        hash_map_pt exports = hashMap_get(manager->exportedServices, reference);
-        if (exports) {
-            hash_map_iterator_pt iter = hashMapIterator_create(exports);
-            while (hashMapIterator_hasNext(iter)) {
-                hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
-                remote_service_admin_service_pt rsa = hashMapEntry_getKey(entry);
-                array_list_pt exportRegistrations = hashMapEntry_getValue(entry);
+	if (celixThreadMutex_lock(&manager->exportedServicesLock) == CELIX_SUCCESS) {
+		hash_map_pt exports = hashMap_get(manager->exportedServices, reference);
+		if (exports) {
+			hash_map_iterator_pt iter = hashMapIterator_create(exports);
+			while (hashMapIterator_hasNext(iter)) {
+				hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
+				remote_service_admin_service_pt rsa = hashMapEntry_getKey(entry);
+				array_list_pt exportRegistrations = hashMapEntry_getValue(entry);
 
-                int size = arrayList_size(exportRegistrations);
+				int size = arrayList_size(exportRegistrations);
 
-                for (int exportsIter = 0; exportsIter < size; exportsIter++) {
-                    export_registration_pt export = arrayList_get(exportRegistrations, exportsIter);
-                    topologyManager_notifyListenersEndpointRemoved(manager, rsa, export);
-                    rsa->exportRegistration_close(rsa->admin, export);
-                }
+				for (int exportsIter = 0; exportsIter < size; exportsIter++) {
+					export_registration_pt export = arrayList_get(exportRegistrations, exportsIter);
+					topologyManager_notifyListenersEndpointRemoved(manager, rsa, export);
+					rsa->exportRegistration_close(rsa->admin, export);
+				}
 
-                hashMap_remove(exports, rsa);
-                //arrayList_destroy(exportRegistrations);
-                hashMapIterator_destroy(iter);
-                iter = hashMapIterator_create(exports);
+				hashMap_remove(exports, rsa);
+				//arrayList_destroy(exportRegistrations);
+				hashMapIterator_destroy(iter);
+				iter = hashMapIterator_create(exports);
 
-            }
-            hashMapIterator_destroy(iter);
-        }
-        exports = hashMap_remove(manager->exportedServices, reference);
+			}
+			hashMapIterator_destroy(iter);
+		}
+		exports = hashMap_remove(manager->exportedServices, reference);
 
-        if (exports != NULL) {
-            hashMap_destroy(exports, false, false);
-        }
+		if (exports != NULL) {
+			hashMap_destroy(exports, false, false);
+		}
 
-        celixThreadMutex_unlock(&manager->exportedServicesLock);
-    }
+		celixThreadMutex_unlock(&manager->exportedServicesLock);
+	}
 
-    return status;
+	return status;
 }
 
 celix_status_t topologyManager_getEndpointDescriptionForExportRegistration(remote_service_admin_service_pt rsa, export_registration_pt export, endpoint_description_pt *endpoint) {
-    celix_status_t status;
+	celix_status_t status;
 
-    export_reference_pt reference = NULL;
-    status = rsa->exportRegistration_getExportReference(export, &reference);
+	export_reference_pt reference = NULL;
+	status = rsa->exportRegistration_getExportReference(export, &reference);
 
-    if (status == CELIX_SUCCESS) {
-        status = rsa->exportReference_getExportedEndpoint(reference, endpoint);
-    }
+	if (status == CELIX_SUCCESS) {
+		status = rsa->exportReference_getExportedEndpoint(reference, endpoint);
+	}
 
-    free(reference);
+	free(reference);
 
-    return status;
+	return status;
 }
 
 celix_status_t topologyManager_endpointListenerAdding(void* handle, service_reference_pt reference, void** service) {
-    celix_status_t status = CELIX_SUCCESS;
-    topology_manager_pt manager = (topology_manager_pt) handle;
+	celix_status_t status = CELIX_SUCCESS;
+	topology_manager_pt manager = (topology_manager_pt) handle;
 
-    bundleContext_getService(manager->context, reference, service);
+	bundleContext_getService(manager->context, reference, service);
 
-    return status;
+	return status;
 }
 
 celix_status_t topologyManager_endpointListenerAdded(void* handle, service_reference_pt reference, void* service) {
-    celix_status_t status = CELIX_SUCCESS;
-    topology_manager_pt manager = handle;
-    char *scope = NULL;
+	celix_status_t status = CELIX_SUCCESS;
+	topology_manager_pt manager = handle;
+	const char* scope = NULL;
 
-    logHelper_log(manager->loghelper, OSGI_LOGSERVICE_INFO, "TOPOLOGY_MANAGER: Added ENDPOINT_LISTENER");
+	logHelper_log(manager->loghelper, OSGI_LOGSERVICE_INFO, "TOPOLOGY_MANAGER: Added ENDPOINT_LISTENER");
 
-    if (celixThreadMutex_lock(&manager->listenerListLock) == CELIX_SUCCESS) {
-        hashMap_put(manager->listenerList, reference, NULL);
-        celixThreadMutex_unlock(&manager->listenerListLock);
+	if (celixThreadMutex_lock(&manager->listenerListLock) == CELIX_SUCCESS) {
+		hashMap_put(manager->listenerList, reference, NULL);
+		celixThreadMutex_unlock(&manager->listenerListLock);
 
-        serviceReference_getProperty(reference, (char *) OSGI_ENDPOINT_LISTENER_SCOPE, &scope);
+		serviceReference_getProperty(reference, OSGI_ENDPOINT_LISTENER_SCOPE, &scope);
 
-        filter_pt filter = filter_create(scope);
-        hash_map_iterator_pt refIter = hashMapIterator_create(manager->exportedServices);
+		filter_pt filter = filter_create(scope);
+		hash_map_iterator_pt refIter = hashMapIterator_create(manager->exportedServices);
 
-        while (hashMapIterator_hasNext(refIter)) {
-            hash_map_pt rsaExports = hashMapIterator_nextValue(refIter);
-            hash_map_iterator_pt rsaIter = hashMapIterator_create(rsaExports);
+		while (hashMapIterator_hasNext(refIter)) {
+			hash_map_pt rsaExports = hashMapIterator_nextValue(refIter);
+			hash_map_iterator_pt rsaIter = hashMapIterator_create(rsaExports);
 
-            while (hashMapIterator_hasNext(rsaIter)) {
-                hash_map_entry_pt entry = hashMapIterator_nextEntry(rsaIter);
-                remote_service_admin_service_pt rsa = hashMapEntry_getKey(entry);
-                array_list_pt registrations = hashMapEntry_getValue(entry);
+			while (hashMapIterator_hasNext(rsaIter)) {
+				hash_map_entry_pt entry = hashMapIterator_nextEntry(rsaIter);
+				remote_service_admin_service_pt rsa = hashMapEntry_getKey(entry);
+				array_list_pt registrations = hashMapEntry_getValue(entry);
 
-                int arrayListSize = arrayList_size(registrations);
-                int cnt = 0;
+				int arrayListSize = arrayList_size(registrations);
+				int cnt = 0;
 
-                for (; cnt < arrayListSize; cnt++) {
-                    export_registration_pt export = arrayList_get(registrations, cnt);
-                    endpoint_description_pt endpoint = NULL;
+				for (; cnt < arrayListSize; cnt++) {
+					export_registration_pt export = arrayList_get(registrations, cnt);
+					endpoint_description_pt endpoint = NULL;
 
-                    status = topologyManager_getEndpointDescriptionForExportRegistration(rsa, export, &endpoint);
-                    if (status == CELIX_SUCCESS) {
-                        bool matchResult = false;
-                        filter_match(filter, endpoint->properties, &matchResult);
-                        if (matchResult) {
-                            endpoint_listener_pt listener = (endpoint_listener_pt) service;
-                            status = listener->endpointAdded(listener->handle, endpoint, scope);
-                        }
-                    }
-                }
-            }
-            hashMapIterator_destroy(rsaIter);
-        }
-        hashMapIterator_destroy(refIter);
+					status = topologyManager_getEndpointDescriptionForExportRegistration(rsa, export, &endpoint);
+					if (status == CELIX_SUCCESS) {
+						bool matchResult = false;
+						filter_match(filter, endpoint->properties, &matchResult);
+						if (matchResult) {
+							endpoint_listener_pt listener = (endpoint_listener_pt) service;
+							status = listener->endpointAdded(listener->handle, endpoint, (char*)scope);
+						}
+					}
+				}
+			}
+			hashMapIterator_destroy(rsaIter);
+		}
+		hashMapIterator_destroy(refIter);
 
-        filter_destroy(filter);
-    }
+		filter_destroy(filter);
+	}
 
-    return status;
+	return status;
 }
 
 celix_status_t topologyManager_endpointListenerModified(void * handle, service_reference_pt reference, void * service) {
-    celix_status_t status;
+	celix_status_t status;
 
-    status = topologyManager_endpointListenerRemoved(handle, reference, service);
+	status = topologyManager_endpointListenerRemoved(handle, reference, service);
 
-    if (status == CELIX_SUCCESS) {
-        status = topologyManager_endpointListenerAdded(handle, reference, service);
-    }
+	if (status == CELIX_SUCCESS) {
+		status = topologyManager_endpointListenerAdded(handle, reference, service);
+	}
 
-    return status;
+	return status;
 }
 
 celix_status_t topologyManager_endpointListenerRemoved(void * handle, service_reference_pt reference, void * service) {
-    celix_status_t status = CELIX_SUCCESS;
-    topology_manager_pt manager = handle;
+	celix_status_t status = CELIX_SUCCESS;
+	topology_manager_pt manager = handle;
 
-    if (celixThreadMutex_lock(&manager->listenerListLock) == CELIX_SUCCESS) {
+	if (celixThreadMutex_lock(&manager->listenerListLock) == CELIX_SUCCESS) {
 
-        if (hashMap_remove(manager->listenerList, reference)) {
-            logHelper_log(manager->loghelper, OSGI_LOGSERVICE_INFO, "EndpointListener Removed");
-        }
+		if (hashMap_remove(manager->listenerList, reference)) {
+			logHelper_log(manager->loghelper, OSGI_LOGSERVICE_INFO, "EndpointListener Removed");
+		}
 
-        celixThreadMutex_unlock(&manager->listenerListLock);
-    }
+		celixThreadMutex_unlock(&manager->listenerListLock);
+	}
 
-    return status;
+	return status;
 }
 
 celix_status_t topologyManager_notifyListenersEndpointAdded(topology_manager_pt manager, remote_service_admin_service_pt rsa, array_list_pt registrations) {
-    celix_status_t status = CELIX_SUCCESS;
+	celix_status_t status = CELIX_SUCCESS;
 
-    if (celixThreadMutex_lock(&manager->listenerListLock) == CELIX_SUCCESS) {
+	if (celixThreadMutex_lock(&manager->listenerListLock) == CELIX_SUCCESS) {
 
-        hash_map_iterator_pt iter = hashMapIterator_create(manager->listenerList);
-        while (hashMapIterator_hasNext(iter)) {
-            char *scope = NULL;
-            endpoint_listener_pt epl = NULL;
-            service_reference_pt reference = hashMapIterator_nextKey(iter);
+		hash_map_iterator_pt iter = hashMapIterator_create(manager->listenerList);
+		while (hashMapIterator_hasNext(iter)) {
+			const char* scope = NULL;
+			endpoint_listener_pt epl = NULL;
+			service_reference_pt reference = hashMapIterator_nextKey(iter);
 
-            serviceReference_getProperty(reference, (char *) OSGI_ENDPOINT_LISTENER_SCOPE, &scope);
+			serviceReference_getProperty(reference, OSGI_ENDPOINT_LISTENER_SCOPE, &scope);
 
-            status = bundleContext_getService(manager->context, reference, (void **) &epl);
-            if (status == CELIX_SUCCESS) {
-                filter_pt filter = filter_create(scope);
+			status = bundleContext_getService(manager->context, reference, (void **) &epl);
+			if (status == CELIX_SUCCESS) {
+				filter_pt filter = filter_create(scope);
 
-                int regSize = arrayList_size(registrations);
-                for (int regIt = 0; regIt < regSize; regIt++) {
-                    export_registration_pt export = arrayList_get(registrations, regIt);
-                    endpoint_description_pt endpoint = NULL;
-                    celix_status_t substatus = topologyManager_getEndpointDescriptionForExportRegistration(rsa, export, &endpoint);
-                    if (substatus == CELIX_SUCCESS) {
-                        bool matchResult = false;
-                        filter_match(filter, endpoint->properties, &matchResult);
-                        if (matchResult) {
-                            status = epl->endpointAdded(epl->handle, endpoint, scope);
-                        }
-                    } else {
-                        status = substatus;
-                    }
-                }
-                filter_destroy(filter);
-            }
-        }
-        hashMapIterator_destroy(iter);
-        celixThreadMutex_unlock(&manager->listenerListLock);
-    }
+				int regSize = arrayList_size(registrations);
+				for (int regIt = 0; regIt < regSize; regIt++) {
+					export_registration_pt export = arrayList_get(registrations, regIt);
+					endpoint_description_pt endpoint = NULL;
+					celix_status_t substatus = topologyManager_getEndpointDescriptionForExportRegistration(rsa, export, &endpoint);
+					if (substatus == CELIX_SUCCESS) {
+						bool matchResult = false;
+						filter_match(filter, endpoint->properties, &matchResult);
+						if (matchResult) {
+							status = epl->endpointAdded(epl->handle, endpoint, (char*)scope);
+						}
+					} else {
+						status = substatus;
+					}
+				}
+				filter_destroy(filter);
+			}
+		}
+		hashMapIterator_destroy(iter);
+		celixThreadMutex_unlock(&manager->listenerListLock);
+	}
 
-    return status;
+	return status;
 }
 
 celix_status_t topologyManager_notifyListenersEndpointRemoved(topology_manager_pt manager, remote_service_admin_service_pt rsa, export_registration_pt export) {
-    celix_status_t status = CELIX_SUCCESS;
+	celix_status_t status = CELIX_SUCCESS;
 
-    if (celixThreadMutex_lock(&manager->listenerListLock) == CELIX_SUCCESS) {
-        hash_map_iterator_pt iter = hashMapIterator_create(manager->listenerList);
-        while (hashMapIterator_hasNext(iter)) {
-            endpoint_description_pt endpoint = NULL;
-            endpoint_listener_pt epl = NULL;
-            celix_status_t substatus;
-            char *scope = NULL;
+	if (celixThreadMutex_lock(&manager->listenerListLock) == CELIX_SUCCESS) {
+		hash_map_iterator_pt iter = hashMapIterator_create(manager->listenerList);
+		while (hashMapIterator_hasNext(iter)) {
+			endpoint_description_pt endpoint = NULL;
+			endpoint_listener_pt epl = NULL;
+			celix_status_t substatus;
+			const char* scope = NULL;
 
-            service_reference_pt reference = hashMapIterator_nextKey(iter);
-            serviceReference_getProperty(reference, (char *) OSGI_ENDPOINT_LISTENER_SCOPE, &scope);
+			service_reference_pt reference = hashMapIterator_nextKey(iter);
+			serviceReference_getProperty(reference, OSGI_ENDPOINT_LISTENER_SCOPE, &scope);
 
-            substatus = bundleContext_getService(manager->context, reference, (void **) &epl);
+			substatus = bundleContext_getService(manager->context, reference, (void **) &epl);
 
-            if (substatus == CELIX_SUCCESS) {
-                substatus = topologyManager_getEndpointDescriptionForExportRegistration(rsa, export, &endpoint);
-            }
+			if (substatus == CELIX_SUCCESS) {
+				substatus = topologyManager_getEndpointDescriptionForExportRegistration(rsa, export, &endpoint);
+			}
 
-            if (substatus == CELIX_SUCCESS) {
-                substatus = epl->endpointRemoved(epl->handle, endpoint, NULL);
-            }
+			if (substatus == CELIX_SUCCESS) {
+				substatus = epl->endpointRemoved(epl->handle, endpoint, NULL);
+			}
 
-            /*            if (substatus != CELIX_SUCCESS) {
+			/*            if (substatus != CELIX_SUCCESS) {
              status = substatus;
 
              }
-             */
-        }
-        hashMapIterator_destroy(iter);
-        celixThreadMutex_unlock(&manager->listenerListLock);
-    }
+			 */
+		}
+		hashMapIterator_destroy(iter);
+		celixThreadMutex_unlock(&manager->listenerListLock);
+	}
 
-    return status;
+	return status;
 }
 
 celix_status_t topologyManager_extendFilter(topology_manager_pt manager, char *filter, char **updatedFilter) {
-    celix_status_t status;
-    bundle_context_pt context = manager->context;
-    char* uuid = NULL;
+	celix_status_t status;
+	bundle_context_pt context = manager->context;
+	const char* uuid = NULL;
 
-    status = bundleContext_getProperty(context, (char *) OSGI_FRAMEWORK_FRAMEWORK_UUID, &uuid);
+	status = bundleContext_getProperty(context, OSGI_FRAMEWORK_FRAMEWORK_UUID, &uuid);
 
-    if (!uuid) {
-        logHelper_log(manager->loghelper, OSGI_LOGSERVICE_ERROR, "TOPOLOGY_MANAGER: no framework UUID defined?!");
-        return CELIX_BUNDLE_EXCEPTION;
-    }
+	if (!uuid) {
+		logHelper_log(manager->loghelper, OSGI_LOGSERVICE_ERROR, "TOPOLOGY_MANAGER: no framework UUID defined?!");
+		return CELIX_BUNDLE_EXCEPTION;
+	}
 
-    int len = 10 + strlen(filter) + strlen(OSGI_RSA_ENDPOINT_FRAMEWORK_UUID) + strlen(uuid);
-    *updatedFilter = malloc(len);
-    if (!*updatedFilter) {
-        return CELIX_ENOMEM;
-    }
+	int len = 10 + strlen(filter) + strlen(OSGI_RSA_ENDPOINT_FRAMEWORK_UUID) + strlen(uuid);
+	*updatedFilter = malloc(len);
+	if (!*updatedFilter) {
+		return CELIX_ENOMEM;
+	}
 
-    snprintf(*updatedFilter, len, "(&%s(!(%s=%s)))", filter, OSGI_RSA_ENDPOINT_FRAMEWORK_UUID, uuid);
+	snprintf(*updatedFilter, len, "(&%s(!(%s=%s)))", filter, OSGI_RSA_ENDPOINT_FRAMEWORK_UUID, uuid);
 
-    return status;
+	return status;
 }
 
 celix_status_t topologyManager_listenerAdded(void *handle, array_list_pt listeners) {
-    celix_status_t status = CELIX_SUCCESS;
-    topology_manager_pt manager = handle;
+	celix_status_t status = CELIX_SUCCESS;
+	topology_manager_pt manager = handle;
 
-    for (int i = 0; i < arrayList_size(listeners); i++) {
-        listener_hook_info_pt info = arrayList_get(listeners, i);
-        bundle_pt bundle = NULL, self = NULL;
-        bundleContext_getBundle(info->context, &bundle);
-        bundleContext_getBundle(manager->context, &self);
-        if (bundle == self) {
-            logHelper_log(manager->loghelper, OSGI_LOGSERVICE_DEBUG, "TOPOLOGY_MANAGER: Ignore myself.");
-            continue;
-        }
+	for (int i = 0; i < arrayList_size(listeners); i++) {
+		listener_hook_info_pt info = arrayList_get(listeners, i);
+		bundle_pt bundle = NULL, self = NULL;
+		bundleContext_getBundle(info->context, &bundle);
+		bundleContext_getBundle(manager->context, &self);
+		if (bundle == self) {
+			logHelper_log(manager->loghelper, OSGI_LOGSERVICE_DEBUG, "TOPOLOGY_MANAGER: Ignore myself.");
+			continue;
+		}
 
-        logHelper_log(manager->loghelper, OSGI_LOGSERVICE_INFO, "TOPOLOGY_MANAGER: listener with filter \"%s\" added", info->filter);
+		logHelper_log(manager->loghelper, OSGI_LOGSERVICE_INFO, "TOPOLOGY_MANAGER: listener with filter \"%s\" added", info->filter);
 
-        char *filter = NULL;
-        status = topologyManager_extendFilter(manager, info->filter, &filter);
+		char *filter = NULL;
+		bool free_filter = true;
+		status = topologyManager_extendFilter(manager, info->filter, &filter);
 #if 0
-        // TODO: add status handling
-        status = celixThreadMutex_lock(&manager->importScopesLock);
+		if(filter != NULL){
+			// TODO: add status handling
+			status = celixThreadMutex_lock(&manager->importScopesLock);
 
-        struct scope *interest = hashMap_get(manager->importScopes, filter);
-        if (interest) {
-            interest->refs++;
-            free(filter);
-        } else {
-            interest = malloc(sizeof(*interest));
-            interest->filter = filter;
-            interest->refs = 1;
-            hashMap_put(manager->importScopes, filter, interest);
-        }
+			struct scope *interest = hashMap_get(manager->importScopes, filter);
+			if (interest) {
+				interest->refs++;
+				free(filter);
+				filter = NULL;
+			} else {
+				interest = malloc(sizeof(*interest));
+				interest->filter = filter;
+				interest->refs = 1;
+				hashMap_put(manager->importScopes, filter, interest);
+				free_filter = false;
+			}
 
-        status = celixThreadMutex_unlock(&manager->importScopesLock);
+			status = celixThreadMutex_unlock(&manager->importScopesLock);
+		}
 #endif
 
-        if (status == CELIX_SUCCESS) {
-            free(filter);
-        }
+		if (filter != NULL && free_filter) {
+			free(filter);
+		}
 
-    }
+	}
 
-    return status;
+	return status;
 }
 
 celix_status_t topologyManager_listenerRemoved(void *handle, array_list_pt listeners) {
-    celix_status_t status = CELIX_SUCCESS;
-    topology_manager_pt manager = handle;
+	celix_status_t status = CELIX_SUCCESS;
+	topology_manager_pt manager = handle;
 
-    for (int i = 0; i < arrayList_size(listeners); i++) {
-        listener_hook_info_pt info = arrayList_get(listeners, i);
+	for (int i = 0; i < arrayList_size(listeners); i++) {
+		listener_hook_info_pt info = arrayList_get(listeners, i);
 
-        bundle_pt bundle = NULL, self = NULL;
-        bundleContext_getBundle(info->context, &bundle);
-        bundleContext_getBundle(manager->context, &self);
-        if (bundle == self) {
-            logHelper_log(manager->loghelper, OSGI_LOGSERVICE_DEBUG, "TOPOLOGY_MANAGER: Ignore myself.");
-            continue;
-        }
+		bundle_pt bundle = NULL, self = NULL;
+		bundleContext_getBundle(info->context, &bundle);
+		bundleContext_getBundle(manager->context, &self);
+		if (bundle == self) {
+			logHelper_log(manager->loghelper, OSGI_LOGSERVICE_DEBUG, "TOPOLOGY_MANAGER: Ignore myself.");
+			continue;
+		}
 
-        logHelper_log(manager->loghelper, OSGI_LOGSERVICE_INFO, "TOPOLOGY_MANAGER: listener with filter \"%s\" removed.", info->filter);
+		logHelper_log(manager->loghelper, OSGI_LOGSERVICE_INFO, "TOPOLOGY_MANAGER: listener with filter \"%s\" removed.", info->filter);
 
-        char *filter = NULL;
-        topologyManager_extendFilter(manager, info->filter, &filter);
+		char *filter = NULL;
+		topologyManager_extendFilter(manager, info->filter, &filter);
 #if 0
-        status = celixThreadMutex_lock(&manager->importScopesLock);
+		status = celixThreadMutex_lock(&manager->importScopesLock);
 
-        struct scope *interest = hashMap_get(manager->importScopes, filter);
-        if (interest != NULL && --interest->refs <= 0) {
-            // last reference, remove from scope
-            hash_map_entry_pt entry = hashMap_getEntry(manager->importScopes, filter);
-            char* key = (char*) hashMapEntry_getKey(entry);
-            interest = hashMap_remove(manager->importScopes, filter);
-            free(key);
-            free(interest);
-        }
+		struct scope *interest = hashMap_get(manager->importScopes, filter);
+		if (interest != NULL && --interest->refs <= 0) {
+			// last reference, remove from scope
+			hash_map_entry_pt entry = hashMap_getEntry(manager->importScopes, filter);
+			char* key = (char*) hashMapEntry_getKey(entry);
+			interest = hashMap_remove(manager->importScopes, filter);
+			free(key);
+			free(interest);
+		}
 #endif
 
-        if (filter != NULL) {
-            free(filter);
-        }
+		if (filter != NULL) {
+			free(filter);
+		}
 #if 0
-        status = celixThreadMutex_unlock(&manager->importScopesLock);
+		status = celixThreadMutex_unlock(&manager->importScopesLock);
 #endif
-    }
+	}
 
-    return status;
+	return status;
 }
 
diff --git a/remote_services/topology_manager/public/include/tm_scope.h b/remote_services/topology_manager/public/include/tm_scope.h
index 24e130a..d4f60ca 100644
--- a/remote_services/topology_manager/public/include/tm_scope.h
+++ b/remote_services/topology_manager/public/include/tm_scope.h
@@ -40,6 +40,7 @@
     celix_status_t (*removeImportScope)(void *handle, char *filter);
 };
 
-typedef struct tm_scope_service *tm_scope_service_pt;
+typedef struct tm_scope_service tm_scope_service_t;
+typedef tm_scope_service_t *tm_scope_service_pt;
 
 #endif /* TM_SCOPE_H_ */
diff --git a/remote_services/topology_manager/tms_tst/CMakeLists.txt b/remote_services/topology_manager/tms_tst/CMakeLists.txt
index 19695ec..16ad011 100644
--- a/remote_services/topology_manager/tms_tst/CMakeLists.txt
+++ b/remote_services/topology_manager/tms_tst/CMakeLists.txt
@@ -43,27 +43,33 @@
 
 add_dependencies(test_tm_scoped remote_service_admin_dfi topology_manager calculator)
 
-#get_property(rsa_bundle_file TARGET remote_service_admin_dfi PROPERTY BUNDLE)
-# Not nice, but only (?) solution to prevent circular dependency between this test and rsa_dfi_test
-set_property(GLOBAL PROPERTY temp_rsa_bundle_file ${PROJECT_BINARY_DIR}/remote_services/remote_service_admin_dfi/rsa/remote_service_admin_dfi.zip)
-get_property(rsa_bundle_file GLOBAL PROPERTY temp_rsa_bundle_file)
-get_property(calc_bundle_file TARGET calculator PROPERTY BUNDLE_FILE)
-get_property(topology_manager_bundle_file TARGET topology_manager PROPERTY BUNDLE_FILE)
-get_property(disc_mock_bundle_file TARGET topology_manager_disc_mock_bundle PROPERTY BUNDLE_FILE)
-get_property(test_bundle_file TARGET topology_manager_test_bundle PROPERTY BUNDLE_FILE)
+file(GENERATE 
+    OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/config.properties"
+    CONTENT "
+cosgi.auto.start.1=$<TARGET_PROPERTY:remote_service_admin_dfi,BUNDLE_FILE> $<TARGET_PROPERTY:calculator,BUNDLE_FILE> $<TARGET_PROPERTY:topology_manager,BUNDLE_FILE> $<TARGET_PROPERTY:topology_manager_disc_mock_bundle,BUNDLE_FILE>
+LOGHELPER_ENABLE_STDOUT_FALLBACK=true
+org.osgi.framework.storage.clean=onFirstInit
+")
 
-#file(GENERATE OUTPUT config.properties CONTENT "
-#cosgi.auto.start.1=$<TARGET_PROPERTY:remote_service_admin_dfi,BUNDE_FILE> $<TARGET_PROPERTY:calculator,BUNDLE_FILE> $<TARGET_PROPERTY:topology_manager,BUNDLE_FILE> $<TARGET_PROPERTY:topology_manager_disc_mock_bundle,BUNDLE_FILE>
-#LOGHELPER_ENABLE_STDOUT_FALLBACK=true
-#org.osgi.framework.storage.clean=onFirstInit
-#")
-configure_file(config.properties.in config.properties)
+file(GENERATE 
+    OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/config_import.properties"
+    CONTENT "
+cosgi.auto.start.1=$<TARGET_PROPERTY:remote_service_admin_dfi,BUNDLE_FILE> $<TARGET_PROPERTY:calculator,BUNDLE_FILE> $<TARGET_PROPERTY:topology_manager,BUNDLE_FILE> $<TARGET_PROPERTY:topology_manager_test_bundle,BUNDLE_FILE>
+LOGHELPER_ENABLE_STDOUT_FALLBACK=true
+org.osgi.framework.storage.clean=onFirstInit
+")
 
-configure_file(config_import.properties.in config_import.properties)
-configure_file(scope.json scope.json)
-configure_file(scope2.json scope2.json)
-configure_file(scope3.json scope3.json)
-configure_file(scope4.json scope4.json)
+
+#TODO improve copy commands, for now using configure_file as copy 
+#add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scope.json" COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURE_DIR}/scope.json" "${CMAKE_CURRENT_BINARY_DIR}/scope.json")
+#add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scope2.json" COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURE_DIR}/scope2.json" "${CMAKE_CURRENT_BINARY_DIR}/scope2.json")
+#add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scope3.json" COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURE_DIR}/scope3.json" "${CMAKE_CURRENT_BINARY_DIR}/scope3.json")
+#add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scope4.json" COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURE_DIR}/scope4.json" "${CMAKE_CURRENT_BINARY_DIR}/scope4.json")
+
+configure_file("scope.json" "scope.json")
+configure_file("scope2.json" "scope2.json")
+configure_file("scope3.json" "scope3.json")
+configure_file("scope4.json" "scope4.json")
 
 
 add_test(NAME run_test_tm_scoped COMMAND test_tm_scoped)
diff --git a/remote_services/topology_manager/tms_tst/config.properties.in b/remote_services/topology_manager/tms_tst/config.properties.in
deleted file mode 100644
index 277b863..0000000
--- a/remote_services/topology_manager/tms_tst/config.properties.in
+++ /dev/null
@@ -1,3 +0,0 @@
-cosgi.auto.start.1=@rsa_bundle_file@ @topology_manager_bundle_file@ @calc_bundle_file@ @disc_mock_bundle_file@ 
-LOGHELPER_ENABLE_STDOUT_FALLBACK=true
-org.osgi.framework.storage.clean=onFirstInit
diff --git a/remote_services/topology_manager/tms_tst/config_import.properties.in b/remote_services/topology_manager/tms_tst/config_import.properties.in
deleted file mode 100644
index 63ee31d..0000000
--- a/remote_services/topology_manager/tms_tst/config_import.properties.in
+++ /dev/null
@@ -1,3 +0,0 @@
-cosgi.auto.start.1=@rsa_bundle_file@ @topology_manager_bundle_file@ @calc_bundle_file@ @test_bundle_file@
-LOGHELPER_ENABLE_STDOUT_FALLBACK=true
-org.osgi.framework.storage.clean=onFirstInit
diff --git a/remote_services/topology_manager/tms_tst/disc_mock/disc_mock_activator.c b/remote_services/topology_manager/tms_tst/disc_mock/disc_mock_activator.c
index 15f128f..53fccd7 100644
--- a/remote_services/topology_manager/tms_tst/disc_mock/disc_mock_activator.c
+++ b/remote_services/topology_manager/tms_tst/disc_mock/disc_mock_activator.c
@@ -61,10 +61,10 @@
 celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
     celix_status_t status;
     struct disc_mock_activator * act = userData;
-    char *uuid = NULL;
+    const char *uuid = NULL;
 
     act->reg = NULL;
-    status = bundleContext_registerService(context, (char *) DISC_MOCK_SERVICE_NAME, act->serv, NULL, &act->reg);
+    status = bundleContext_registerService(context, DISC_MOCK_SERVICE_NAME, act->serv, NULL, &act->reg);
 
     bundleContext_getProperty(context, OSGI_FRAMEWORK_FRAMEWORK_UUID, &uuid);
 
diff --git a/remote_services/utils/private/src/civetweb.c b/remote_services/utils/private/src/civetweb.c
index 94009c9..0639d08 100644
--- a/remote_services/utils/private/src/civetweb.c
+++ b/remote_services/utils/private/src/civetweb.c
@@ -3903,7 +3903,7 @@
                 if(de.file.is_directory) {
                     remove_directory(conn, path);
                 } else {
-                    mg_remove(path);
+                    (void) mg_remove(path);
                 }
             }
 
@@ -5003,24 +5003,22 @@
         return;
     }
 
-    /* This is an existing file (not a directory).
-       Check if write permission is granted. */
-    if (access(path, W_OK) != 0) {
-        /* File is read only */
-        send_http_error(conn, 403, NULL,
-            "Error: Delete not possible\nDeleting %s is not allowed", path);
-        return;
+    /* Try to delete path. */
+    if (mg_remove(path) == 0) {
+	/* Delete was successful: Return 204 without content. */
+	send_http_error(conn, 204, NULL, "%s", "");
+    } else {
+	/* Delete not successful (no permissions). */
+	if(ERRNO==EPERM || ERRNO==EACCES){
+		send_http_error(conn, 403, NULL,
+				"Error: Delete not possible\nDeleting %s is not allowed", path);
+	} else {
+		/* Delete not successful (file locked). */
+		send_http_error(conn, 423, NULL,
+				"Error: Cannot delete file\nremove(%s): %s", path, strerror(ERRNO));
+	}
     }
 
-    /* Try to delete it. */
-    if (mg_remove(path) == 0) {
-        /* Delete was successful: Return 204 without content. */
-        send_http_error(conn, 204, NULL, "%s", "");
-    } else {
-        /* Delete not successful (file locked). */
-        send_http_error(conn, 423, NULL,
-            "Error: Cannot delete file\nremove(%s): %s", path, strerror(ERRNO));
-    }
 }
 
 static void send_ssi_file(struct mg_connection *, const char *,
@@ -5992,14 +5990,20 @@
         } while (!eof && (n = mg_read(conn, buf + len, sizeof(buf) - len)) > 0);
         fclose(fp);
         if (eof) {
-            remove(path);
-            rename(tmp_path, path);
+            if( remove(path) == -1){
+		mg_cry(conn,"Unable to remove %s",path);
+            }
+            if( rename(tmp_path, path) == -1){
+		mg_cry(conn,"Unable to rename %s to %s",tmp_path,path);
+            }
             num_uploaded_files++;
             if (conn->ctx->callbacks.upload != NULL) {
                 conn->ctx->callbacks.upload(conn, path);
             }
         } else {
-            remove(tmp_path);
+            if( remove(tmp_path) == -1){
+		mg_cry(conn,"Unable to remove %s",tmp_path);
+            }
         }
     }
 
diff --git a/remote_shell/private/src/activator.c b/remote_shell/private/src/activator.c
index 4344258..541eda6 100644
--- a/remote_shell/private/src/activator.c
+++ b/remote_shell/private/src/activator.c
@@ -131,12 +131,12 @@
 }
 
 static int bundleActivator_getProperty(bundle_instance_pt bi, bundle_context_pt context, char* propertyName, int defaultValue) {
-	char *strValue = NULL;
+	const char *strValue = NULL;
 	int value;
 
 	bundleContext_getProperty(context, propertyName, &strValue);
 	if (strValue != NULL) {
-		char* endptr = strValue;
+		char* endptr = (char*)strValue;
 
 		errno = 0;
 		value = strtol(strValue, &endptr, 10);
diff --git a/remote_shell/private/src/connection_listener.c b/remote_shell/private/src/connection_listener.c
index 4083935..3bef9e5 100644
--- a/remote_shell/private/src/connection_listener.c
+++ b/remote_shell/private/src/connection_listener.c
@@ -120,6 +120,7 @@
 	connection_listener_pt instance = data;
 	struct timeval timeout; /* Timeout for select */
 	fd_set active_fd_set;
+	FD_ZERO(&active_fd_set);
 	int listenSocket = 0;
 	int on = 1;
 
@@ -209,7 +210,7 @@
 		}
 	}
 
-	if (listenSocket > 0) {
+	if (listenSocket >= 0) {
 		close(listenSocket);
 	}
 
diff --git a/remote_shell/private/src/remote_shell.c b/remote_shell/private/src/remote_shell.c
index 73b76d4..8f42778 100644
--- a/remote_shell/private/src/remote_shell.c
+++ b/remote_shell/private/src/remote_shell.c
@@ -123,7 +123,7 @@
 		status = CELIX_ENOMEM;
 	}
 
-	if (status != CELIX_SUCCESS) {
+	if (status != CELIX_SUCCESS && connection != NULL) {
 		if (connection->socketStream != NULL) {
 			fclose(connection->socketStream);
 		}
diff --git a/remote_shell/private/src/shell_mediator.c b/remote_shell/private/src/shell_mediator.c
index ae4de10..d9722a9 100644
--- a/remote_shell/private/src/shell_mediator.c
+++ b/remote_shell/private/src/shell_mediator.c
@@ -66,7 +66,7 @@
 		status = CELIX_ENOMEM;
 	}
 
-	if (status != CELIX_SUCCESS) {
+	if ((status != CELIX_SUCCESS) && ((*instance) != NULL)){
 		logHelper_log((*instance)->loghelper, OSGI_LOGSERVICE_ERROR, "Error creating shell_mediator, error code is %i\n", status);
 	}
 	return status;
diff --git a/scr/CMakeLists.txt b/scr/CMakeLists.txt
deleted file mode 100644
index 88c95a7..0000000
--- a/scr/CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-celix_subproject(SCR "Option to build the SCR static library" OFF DEPS LAUNCHER FRAMEWORK SHELL SHELL_TUI)
-if (SCR)
-    if(NOT ${WITH_APR})
-		message(FATAL_ERROR "SCR requires APR, enable WITH_APR option.")
-	endif()
-    add_subdirectory(scr)
-    add_subdirectory(test)
-    
-    deploy(scr-test BUNDLES shell shell_tui scr_test scr)
-endif (SCR)
-   
diff --git a/scr/scr/CMakeLists.txt b/scr/scr/CMakeLists.txt
deleted file mode 100644
index c236832..0000000
--- a/scr/scr/CMakeLists.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-include(FindLibXml2)
-include_directories(${LIBXML2_INCLUDE_DIR})
-
-add_bundle(scr SOURCES
-	scr.c 
-	private/src/xml_parser.c
-	private/src/component_metadata.c
-	private/src/service_metadata.c
-	private/src/reference_metadata.c
-	)
-include_directories("public/include")
-include_directories("private/include")
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-target_link_libraries(scr celix_framework ${LIBXML2_LIBRARIES})
diff --git a/scr/scr/META-INF/MANIFEST.MF b/scr/scr/META-INF/MANIFEST.MF
deleted file mode 100644
index 2e59cfb..0000000
--- a/scr/scr/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,20 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-Bundle-SymbolicName: scr
-Bundle-Version: 1.0.0
-library: scr
diff --git a/scr/scr/private/include/component_metadata.h b/scr/scr/private/include/component_metadata.h
deleted file mode 100644
index 8c00c8f..0000000
--- a/scr/scr/private/include/component_metadata.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * component_metadata.h
- *
- *  \date       Nov 3, 2015
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-#ifndef COMPONENT_METADATA_H_
-#define COMPONENT_METADATA_H_
-
-#include <stdbool.h>
-
-#include <celix_errno.h>
-
-#include "service_metadata.h"
-#include "reference_metadata.h"
-
-typedef struct component *component_t;
-
-celix_status_t component_create(apr_pool_t *pool, component_t *component);
-
-celix_status_t component_getName(component_t component, char **name);
-celix_status_t component_setName(component_t component, char *name);
-
-celix_status_t component_isEnabled(component_t component, bool *enabled);
-celix_status_t component_setEnabled(component_t component, bool enabled);
-
-celix_status_t component_isImmediate(component_t component, bool *immediate);
-celix_status_t component_setImmediate(component_t component, bool immediate);
-
-celix_status_t component_getFactoryIdentifier(component_t component, char **factoryIdentifier);
-celix_status_t component_setFactoryIdentifier(component_t component, char *factoryIdentifier);
-
-celix_status_t component_getConfigurationPolicy(component_t component, char **configurationPolicy);
-celix_status_t component_setConfigurationPolicy(component_t component, char *configurationPolicy);
-
-celix_status_t component_getActivate(component_t component, char **activate);
-celix_status_t component_setActivate(component_t component, char *activate);
-
-celix_status_t component_getActivate(component_t component, char **activate);
-celix_status_t component_setActivate(component_t component, char *activate);
-
-celix_status_t component_getActivate(component_t component, char **activate);
-celix_status_t component_setActivate(component_t component, char *activate);
-
-celix_status_t component_getDeactivate(component_t component, char **deactivate);
-celix_status_t component_setDeactivate(component_t component, char *deactivate);
-
-celix_status_t component_getModified(component_t component, char **modified);
-celix_status_t component_setModified(component_t component, char *modified);
-
-celix_status_t component_getImplementationClassName(component_t component, char **implementationClassName);
-celix_status_t component_setImplementationClassName(component_t component, char *implementationClassName);
-
-celix_status_t componentMetadata_getService(component_t component, service_t *service);
-celix_status_t componentMetadata_setService(component_t component, service_t service);
-
-celix_status_t componentMetadata_getDependencies(component_t component, reference_metadata_t *reference[], int *size);
-celix_status_t componentMetadata_addDependency(component_t component, reference_metadata_t reference);
-
-#endif /* COMPONENT_METADATA_H_ */
diff --git a/scr/scr/private/include/reference_metadata.h b/scr/scr/private/include/reference_metadata.h
deleted file mode 100644
index cf2db48..0000000
--- a/scr/scr/private/include/reference_metadata.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * reference_metadata.h
- *
- *  \date       Nov 3, 2015
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#ifndef REFERENCE_METADATA_H_
-#define REFERENCE_METADATA_H_
-
-#include <stdbool.h>
-#include <apr_general.h>
-
-#include <celix_errno.h>
-
-typedef struct reference_metadata *reference_metadata_t;
-
-celix_status_t referenceMetadata_create(apr_pool_t *pool, reference_metadata_t *reference);
-
-celix_status_t referenceMetadata_setName(reference_metadata_t reference, char *name);
-celix_status_t referenceMetadata_getName(reference_metadata_t reference, char **name);
-
-celix_status_t referenceMetadata_setInterface(reference_metadata_t reference, char *interface);
-celix_status_t referenceMetadata_getInterface(reference_metadata_t reference, char **interface);
-
-celix_status_t referenceMetadata_setCardinality(reference_metadata_t reference, char *cardinality);
-celix_status_t referenceMetadata_getCardinality(reference_metadata_t reference, char **cardinality);
-
-celix_status_t referenceMetadata_setPolicy(reference_metadata_t reference, char *policy);
-celix_status_t referenceMetadata_getPolicy(reference_metadata_t reference, char **policy);
-
-celix_status_t referenceMetadata_setTarget(reference_metadata_t reference, char *target);
-celix_status_t referenceMetadata_getTarget(reference_metadata_t reference, char **target);
-
-celix_status_t referenceMetadata_setBind(reference_metadata_t reference, char *bind);
-celix_status_t referenceMetadata_getBind(reference_metadata_t reference, char **bind);
-
-celix_status_t referenceMetadata_setUpdated(reference_metadata_t reference, char *updated);
-celix_status_t referenceMetadata_getUpdated(reference_metadata_t reference, char **updated);
-
-celix_status_t referenceMetadata_setUnbind(reference_metadata_t reference, char *unbind);
-celix_status_t referenceMetadata_getUnbind(reference_metadata_t reference, char **unbind);
-
-
-
-#endif /* REFERENCE_METADATA_H_ */
diff --git a/scr/scr/private/include/service_metadata.h b/scr/scr/private/include/service_metadata.h
deleted file mode 100644
index fe46863..0000000
--- a/scr/scr/private/include/service_metadata.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * service_metadata.h
- *
- *  \date       Nov 3, 2015
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#ifndef SERVICE_METADATA_H_
-#define SERVICE_METADATA_H_
-
-#include <stdbool.h>
-#include <apr_general.h>
-
-#include <celix_errno.h>
-
-typedef struct service *service_t;
-
-celix_status_t service_create(apr_pool_t *pool, service_t *component);
-
-celix_status_t serviceMetadata_setServiceFactory(service_t currentService, bool serviceFactory);
-celix_status_t serviceMetadata_isServiceFactory(service_t currentService, bool *serviceFactory);
-
-celix_status_t serviceMetadata_addProvide(service_t service, char *provide);
-celix_status_t serviceMetadata_getProvides(service_t service, char **provides[], int *size);
-
-#endif /* SERVICE_METADATA_H_ */
diff --git a/scr/scr/private/include/xml_parser_impl.h b/scr/scr/private/include/xml_parser_impl.h
deleted file mode 100644
index 5465606..0000000
--- a/scr/scr/private/include/xml_parser_impl.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * xml_parser_impl.h
- *
- *  \date       Nov 3, 2015
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#ifndef XML_PARSER_IMPL_H_
-#define XML_PARSER_IMPL_H_
-
-#include "component_metadata.h"
-
-typedef struct xml_parser *xml_parser_t;
-
-celix_status_t xmlParser_create(apr_pool_t *pool, xml_parser_t *parser);
-celix_status_t xmlParser_parseComponent(xml_parser_t parser, char *componentEntry, component_t *component);
-
-#endif /* XML_PARSER_IMPL_H_ */
diff --git a/scr/scr/private/src/component_metadata.c b/scr/scr/private/src/component_metadata.c
deleted file mode 100644
index f55788f..0000000
--- a/scr/scr/private/src/component_metadata.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * comopnent_metadata.c
- *
- *  \date       Nov 3, 2015
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdlib.h>
-
-#include <array_list.h>
-
-#include "component_metadata.h"
-
-struct component {
-	apr_pool_t *pool;
-
-	char *name;
-	bool enabled;
-	bool immediate;
-	char *factoryIdentifier;
-	char *configurationPolicy;
-	char *activate;
-	char *deactivate;
-	char *modified;
-
-	char *implementationClassName;
-
-	service_t service;
-
-	ARRAY_LIST references;
-};
-
-celix_status_t component_create(apr_pool_t *pool, component_t *component) {
-	*component = malloc(sizeof(**component));
-	(*component)->pool = pool;
-
-	(*component)->name = NULL;
-	(*component)->enabled = true;
-	(*component)->immediate = false;
-	(*component)->factoryIdentifier = NULL;
-	(*component)->configurationPolicy = NULL;
-	(*component)->activate = NULL;
-	(*component)->deactivate = NULL;
-	(*component)->modified = NULL;
-
-	(*component)->implementationClassName = NULL;
-
-	(*component)->service = NULL;
-
-	arrayList_create(pool, &(*component)->references);
-
-	return CELIX_SUCCESS;
-}
-
-celix_status_t component_getName(component_t component, char **name) {
-	*name = component->name;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t component_setName(component_t component, char *name) {
-	component->name = name;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t component_isEnabled(component_t component, bool *enabled) {
-	*enabled = component->enabled;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t component_setEnabled(component_t component, bool enabled) {
-	component->enabled = enabled;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t component_isImmediate(component_t component, bool *immediate) {
-	*immediate = component->immediate;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t component_setImmediate(component_t component, bool immediate) {
-	component->enabled = immediate;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t component_getFactoryIdentifier(component_t component, char **factoryIdentifier) {
-	*factoryIdentifier = component->factoryIdentifier;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t component_setFactoryIdentifier(component_t component, char *factoryIdentifier) {
-	component->factoryIdentifier = factoryIdentifier;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t component_getConfigurationPolicy(component_t component, char **configurationPolicy) {
-	*configurationPolicy = component->configurationPolicy;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t component_setConfigurationPolicy(component_t component, char *configurationPolicy) {
-	component->configurationPolicy = configurationPolicy;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t component_getActivate(component_t component, char **activate) {
-	*activate = component->activate;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t component_setActivate(component_t component, char *activate) {
-	component->activate = activate;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t component_getDeactivate(component_t component, char **deactivate) {
-	*deactivate = component->deactivate;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t component_setDeactivate(component_t component, char *deactivate) {
-	component->deactivate = deactivate;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t component_getModified(component_t component, char **modified) {
-	*modified = component->modified;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t component_setModified(component_t component, char *modified) {
-	component->modified = modified;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t component_getImplementationClassName(component_t component, char **implementationClassName) {
-	*implementationClassName = component->implementationClassName;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t component_setImplementationClassName(component_t component, char *implementationClassName) {
-	component->implementationClassName = implementationClassName;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t componentMetadata_getService(component_t component, service_t *service) {
-	*service = component->service;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t componentMetadata_setService(component_t component, service_t service) {
-	component->service = service;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t componentMetadata_getDependencies(component_t component, reference_metadata_t *references[], int *size) {
-	*size = arrayList_size(component->references);
-	reference_metadata_t *referencesA = malloc(*size * sizeof(*referencesA));
-	int i;
-	for (i = 0; i < *size; i++) {
-		reference_metadata_t ref = arrayList_get(component->references, i);
-		referencesA[i] = ref;
-	}
-	*references = referencesA;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t componentMetadata_addDependency(component_t component, reference_metadata_t reference) {
-	arrayList_add(component->references, reference);
-	return CELIX_SUCCESS;
-}
diff --git a/scr/scr/private/src/reference_metadata.c b/scr/scr/private/src/reference_metadata.c
deleted file mode 100644
index 8545eb1..0000000
--- a/scr/scr/private/src/reference_metadata.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * reference_metadata.c
- *
- *  \date       Nov 3, 2015
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdlib.h>
-
-#include "reference_metadata.h"
-
-struct reference_metadata {
-	char *name;
-	char *interface;
-	char *cardinality;
-	char *policy;
-	char *target;
-	char *bind;
-	char *updated;
-	char *unbind;
-};
-
-celix_status_t referenceMetadata_create(apr_pool_t *pool, reference_metadata_t *reference) {
-	*reference = apr_palloc(pool, sizeof(**reference));
-	(*reference)->name = NULL;
-
-	return CELIX_SUCCESS;
-}
-
-celix_status_t referenceMetadata_setName(reference_metadata_t reference, char *name) {
-	reference->name = name;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t referenceMetadata_getName(reference_metadata_t reference, char **name) {
-	*name = reference->name;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t referenceMetadata_setInterface(reference_metadata_t reference, char *interface) {
-	reference->interface = interface;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t referenceMetadata_getInterface(reference_metadata_t reference, char **interface) {
-	*interface = reference->interface;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t referenceMetadata_setCardinality(reference_metadata_t reference, char *cardinality) {
-	reference->cardinality = cardinality;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t referenceMetadata_getCardinality(reference_metadata_t reference, char **cardinality) {
-	*cardinality = reference->cardinality;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t referenceMetadata_setPolicy(reference_metadata_t reference, char *policy) {
-	reference->policy = policy;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t referenceMetadata_getPolicy(reference_metadata_t reference, char **policy) {
-	*policy = reference->policy;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t referenceMetadata_setTarget(reference_metadata_t reference, char *target) {
-	reference->target = target;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t referenceMetadata_getTarget(reference_metadata_t reference, char **target) {
-	*target = reference->target;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t referenceMetadata_setBind(reference_metadata_t reference, char *bind) {
-	reference->bind = bind;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t referenceMetadata_getBind(reference_metadata_t reference, char **bind) {
-	*bind = reference->bind;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t referenceMetadata_setUpdated(reference_metadata_t reference, char *updated) {
-	reference->updated = updated;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t referenceMetadata_getUpdated(reference_metadata_t reference, char **updated) {
-	*updated = reference->updated;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t referenceMetadata_setUnbind(reference_metadata_t reference, char *unbind) {
-	reference->unbind = unbind;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t referenceMetadata_getUnbind(reference_metadata_t reference, char **unbind) {
-	*unbind = reference->unbind;
-	return CELIX_SUCCESS;
-}
-
-
diff --git a/scr/scr/private/src/service_metadata.c b/scr/scr/private/src/service_metadata.c
deleted file mode 100644
index e935cfe..0000000
--- a/scr/scr/private/src/service_metadata.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * service_metadata.c
- *
- *  \date       Nov 3, 2015
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdlib.h>
-
-#include "array_list.h"
-
-#include "service_metadata.h"
-
-struct service {
-	bool serviceFactory;
-
-	ARRAY_LIST provides;
-
-};
-
-celix_status_t service_create(apr_pool_t *pool, service_t *service) {
-	*service = malloc(sizeof(**service));
-	(*service)->serviceFactory = false;
-	arrayList_create(pool, &(*service)->provides);
-
-	return CELIX_SUCCESS;
-}
-
-celix_status_t serviceMetadata_setServiceFactory(service_t currentService, bool serviceFactory) {
-	currentService->serviceFactory = serviceFactory;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t serviceMetadata_isServiceFactory(service_t currentService, bool *serviceFactory) {
-	*serviceFactory = currentService->serviceFactory;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t serviceMetadata_addProvide(service_t service, char *provide) {
-	arrayList_add(service->provides, provide);
-	return CELIX_SUCCESS;
-}
-
-celix_status_t serviceMetadata_getProvides(service_t service, char **provides[], int *size) {
-	*size = arrayList_size(service->provides);
-	char **providesA = malloc(*size * sizeof(*providesA));
-	int i;
-	for (i = 0; i < *size; i++) {
-		providesA[i] = arrayList_get(service->provides, i);
-	}
-
-	*provides = providesA;
-	return CELIX_SUCCESS;
-}
diff --git a/scr/scr/private/src/xml_parser.c b/scr/scr/private/src/xml_parser.c
deleted file mode 100644
index b6ec3eb..0000000
--- a/scr/scr/private/src/xml_parser.c
+++ /dev/null
@@ -1,220 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * xml_paser.c
- *
- *  \date       Nov 3, 2015
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdbool.h>
-
-#include <apr_general.h>
-
-#include <celix_errno.h>
-
-#include <libxml/xmlreader.h>
-
-#include "xml_parser_impl.h"
-#include "service_metadata.h"
-
-struct xml_parser {
-	apr_pool_t *pool;
-};
-
-celix_status_t xmlParser_create(apr_pool_t *pool, xml_parser_t *parser) {
-	*parser = apr_palloc(pool, sizeof(**parser));
-	(*parser)->pool = pool;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t xmlParser_parseComponent(xml_parser_t parser, char *componentEntry, component_t *component) {
-	celix_status_t status = CELIX_SUCCESS;
-
-	xmlTextReaderPtr reader = xmlReaderForFile(componentEntry, NULL, 0);
-	if (reader != NULL) {
-		bool pendingProperty = false;
-		component_t currentComponent;
-		service_t currentService;
-		int read = xmlTextReaderRead(reader);
-		while (read == 1) {
-			int type = xmlTextReaderNodeType(reader);
-			if (type == 1) {
-				pendingProperty = false;
-				const char *localname = xmlTextReaderConstLocalName(reader);
-				if (strcmp(localname, "component") == 0) {
-					printf("Component:\n");
-
-					component_create(parser->pool, &currentComponent);
-
-					char *name = xmlTextReaderGetAttribute(reader, "name");
-					char *enabled = xmlTextReaderGetAttribute(reader, "enabled");
-					char *immediate = xmlTextReaderGetAttribute(reader, "immediate");
-					char *factory = xmlTextReaderGetAttribute(reader, "factory");
-					char *configurationPolicy = xmlTextReaderGetAttribute(reader, "configuration-policy");
-					char *activate = xmlTextReaderGetAttribute(reader, "activate");
-					char *deactivate = xmlTextReaderGetAttribute(reader, "deactivate");
-					char *modified = xmlTextReaderGetAttribute(reader, "modified");
-					if (name != NULL) {
-						printf("\tName: %s\n", name);
-						component_setName(currentComponent, name);
-					}
-					if (enabled != NULL) {
-						printf("\tEnabled: %s\n", enabled);
-						component_setEnabled(currentComponent, strcmp("true", enabled) == 0);
-					}
-					if (immediate != NULL) {
-						printf("\tImmediate: %s\n", immediate);
-						component_setEnabled(currentComponent, strcmp("true", enabled) == 0);
-					}
-					if (factory != NULL) {
-						printf("\tFactory: %s\n", factory);
-						component_setFactoryIdentifier(currentComponent, factory);
-					}
-					if (configurationPolicy != NULL) {
-						printf("\tConfiguration policy: %s\n", configurationPolicy);
-						component_setConfigurationPolicy(currentComponent, configurationPolicy);
-					}
-					if (activate != NULL) {
-						printf("\tActivate: %s\n", activate);
-						component_setActivate(currentComponent, activate);
-					}
-					if (deactivate != NULL) {
-						printf("\tDeactivate: %s\n", deactivate);
-						component_setDeactivate(currentComponent, deactivate);
-					}
-					if (modified != NULL) {
-						printf("\tModified: %s\n", modified);
-						component_setModified(currentComponent, modified);
-					}
-
-					// components.add(currentComponent);
-
-				} else if (strcmp(localname, "implementation") == 0) {
-					printf("Implementation:\n");
-					char *class = xmlTextReaderGetAttribute(reader, "class");
-					printf("\tClass: %s\n", class);
-					component_setImplementationClassName(currentComponent, class);
-				} else if (strcmp(localname, "property") == 0) {
-					printf("Property:\n");
-					char *name = xmlTextReaderGetAttribute(reader, "name");
-					char *value = xmlTextReaderGetAttribute(reader, "value");
-					printf("\tName: %s\n", name);
-					if (value != NULL) {
-						printf("\tValue: %s\n", value);
-					} else {
-						pendingProperty = true;
-					}
-				} else if (strcmp(localname, "properties") == 0) {
-					printf("Properties:\n");
-				} else if (strcmp(localname, "service") == 0) {
-					printf("Service:\n");
-
-					service_create(parser->pool, &currentService);
-
-					char *serviceFactory = xmlTextReaderGetAttribute(reader, "servicefactory");
-					if (serviceFactory != NULL) {
-						printf("\tService factory: %s\n", serviceFactory);
-						serviceMetadata_setServiceFactory(currentService, strcmp("true", serviceFactory) == 0);
-					}
-
-					componentMetadata_setService(currentComponent, currentService);
-				} else if (strcmp(localname, "provide") == 0) {
-					printf("Provide:\n");
-					char *interface = xmlTextReaderGetAttribute(reader, "interface");
-					printf("\tInterface: %s\n", interface);
-					serviceMetadata_addProvide(currentService, interface);
-				} else if (strcmp(localname, "reference") == 0) {
-					printf("Reference:\n");
-					reference_metadata_t reference;
-					referenceMetadata_create(parser->pool, &reference);
-
-					char *name = xmlTextReaderGetAttribute(reader, "name");
-					char *interface = xmlTextReaderGetAttribute(reader, "interface");
-					char *cardinality = xmlTextReaderGetAttribute(reader, "cardinality");
-					char *policy = xmlTextReaderGetAttribute(reader, "policy");
-					char *target = xmlTextReaderGetAttribute(reader, "target");
-					char *bind = xmlTextReaderGetAttribute(reader, "bind");
-					char *updated = xmlTextReaderGetAttribute(reader, "updated");
-					char *unbind = xmlTextReaderGetAttribute(reader, "unbind");
-
-					if (name != NULL) {
-						printf("\tName: %s\n", name);
-						referenceMetadata_setName(reference, name);
-					}
-					printf("\tInterface: %s\n", interface);
-					referenceMetadata_setInterface(reference, interface);
-					if (cardinality != NULL) {
-						printf("\tCardinality: %s\n", cardinality);
-						referenceMetadata_setCardinality(reference, cardinality);
-					}
-					if (policy != NULL) {
-						printf("\tPolicy: %s\n", policy);
-						referenceMetadata_setPolicy(reference, policy);
-					}
-					if (target != NULL) {
-						printf("\tCardinality: %s\n", target);
-						referenceMetadata_setCardinality(reference, cardinality);
-					}
-					if (bind != NULL) {
-						printf("\tBind: %s\n", bind);
-						referenceMetadata_setBind(reference, bind);
-					}
-					if (updated != NULL) {
-						printf("\tUpdated: %s\n", updated);
-						referenceMetadata_setUpdated(reference, updated);
-					}
-					if (unbind != NULL) {
-						printf("\tUnbind: %s\n", unbind);
-						referenceMetadata_setUnbind(reference, unbind);
-					}
-
-					componentMetadata_addDependency(currentComponent, reference);
-				} else {
-					printf("Unsupported element:\n");
-				}
-			} else if (type == 3) {
-				if (pendingProperty) {
-					const char *value = xmlTextReaderConstValue(reader);
-					if (value != NULL) {
-						printf("\tValue text: %s\n", value);
-						pendingProperty = false;
-					}
-				}
-			}
-
-			read = xmlTextReaderRead(reader);
-		}
-		if (currentComponent != NULL) {
-			reference_metadata_t *refs;
-			int size;
-			componentMetadata_getDependencies(currentComponent, &refs, &size);
-			int i;
-			for (i = 0; i < size; i++) {
-				reference_metadata_t ref = refs[i];
-				char *in = NULL;
-				referenceMetadata_getInterface(ref, &in);
-				printf("AS: %s\n", in);
-			}
-			printf("ASD\n");
-		}
-	}
-
-	return CELIX_SUCCESS;
-}
diff --git a/scr/scr/scr.c b/scr/scr/scr.c
deleted file mode 100644
index ce27600..0000000
--- a/scr/scr/scr.c
+++ /dev/null
@@ -1,165 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * scr.c
- *
- *  \date       Nov 3, 2015
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdio.h>
-#include <dlfcn.h>
-
-#include <libxml/xmlreader.h>
-
-#include <bundle_activator.h>
-
-#include "xml_parser_impl.h"
-
-struct component {
-	char *name;
-};
-
-celix_status_t scr_bundleChanged(void *listener, bundle_event_t event);
-
-celix_status_t scrParser_processComponent(xmlTextReaderPtr reader) {
-
-
-	return CELIX_SUCCESS;
-}
-
-static void
-processNode(xmlTextReaderPtr reader) {
-    const xmlChar *name, *value;
-
-    name = xmlTextReaderConstLocalName(reader);
-
-    if (name == NULL)
-	name = BAD_CAST "--";
-
-    if (strcmp(name, "component") == 0) {
-    	char *att = xmlTextReaderGetAttribute(reader, "name");
-    	printf("Handle cmp: %s\n", att);
-    }
-
-    value = xmlTextReaderConstValue(reader);
-
-    printf("%d %d %s %d %d",
-	    xmlTextReaderDepth(reader),
-	    xmlTextReaderNodeType(reader),
-	    name,
-	    xmlTextReaderIsEmptyElement(reader),
-	    xmlTextReaderHasValue(reader));
-    if (value == NULL)
-	printf("\n");
-    else {
-        if (xmlStrlen(value) > 40)
-            printf(" %.40s...\n", value);
-        else
-	    printf(" %s\n", value);
-    }
-}
-
-celix_status_t bundleActivator_create(BUNDLE_CONTEXT context, void **userData) {
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_start(void * userData, BUNDLE_CONTEXT context) {
-	ARRAY_LIST bundles = NULL;
-	bundleContext_getBundles(context, &bundles);
-
-	apr_pool_t *pool = NULL;
-	bundleContext_getMemoryPool(context, &pool);
-
-	xml_parser_t parser = NULL;
-	xmlParser_create(pool, &parser);
-
-	int size;
-	size = arrayList_size(bundles);
-	int i;
-	for (i = 0; i < size; i++) {
-		MANIFEST man = NULL;
-		BUNDLE bundle = arrayList_get(bundles, i);
-		bundle_getManifest(bundle, &man);
-		if (man != NULL) {
-			char *sc = manifest_getValue(man, "Service-Component");
-			if (sc != NULL) {
-				printf("SC: %s\n", sc);
-				char *path = NULL;
-				bundle_getEntry(bundle, sc, pool, &path);
-
-
-				xmlParser_parseComponent(parser, path, NULL);
-
-//				xmlTextReaderPtr reader;
-//				    int ret;
-//
-//				    reader = xmlReaderForFile(path, NULL, 0);
-//				    if (reader != NULL) {
-//				        ret = xmlTextReaderRead(reader);
-//				        while (ret == 1) {
-//				            processNode(reader);
-//				            ret = xmlTextReaderRead(reader);
-//				        }
-//				        xmlFreeTextReader(reader);
-//				        if (ret != 0) {
-//				            fprintf(stderr, "%s : failed to parse\n", path);
-//				        }
-//				    } else {
-//				        fprintf(stderr, "Unable to open %s\n", path);
-//				    }
-//
-
-				void *handle = bundle_getHandle(bundle);
-
-				void (*start)(void * userData, BUNDLE_CONTEXT context);
-				start = dlsym(bundle_getHandle(bundle), "bundleActivator_start");
-
-				void (*activate)();
-				activate = dlsym(handle, "activate");
-				activate();
-
-				void *type;
-				type = dlsym(handle, "service_t");
-			}
-		}
-	}
-
-	bundle_listener_t listener = apr_palloc(pool, sizeof(*listener));
-	listener->pool = pool;
-	listener->bundleChanged = scr_bundleChanged;
-	listener->handle = parser;
-
-	bundleContext_addBundleListener(context, listener);
-
-	return CELIX_SUCCESS;
-}
-
-celix_status_t scr_bundleChanged(void *listener, bundle_event_t event) {
-	printf("BUNDLE CHANGED\n");
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_stop(void * userData, BUNDLE_CONTEXT context) {
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, BUNDLE_CONTEXT context) {
-	return CELIX_SUCCESS;
-}
diff --git a/scr/test/CMakeLists.txt b/scr/test/CMakeLists.txt
deleted file mode 100644
index bcbcdb2..0000000
--- a/scr/test/CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-SET_HEADERS("Service-Component: test.xml")
-
-add_bundle(scr_test SOURCES
-	test.c 
-	FILES test.xml
-	)
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-target_link_libraries(scr_test celix_framework)
-
-
diff --git a/scr/test/META-INF/MANIFEST.MF b/scr/test/META-INF/MANIFEST.MF
deleted file mode 100644
index 17ba865..0000000
--- a/scr/test/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,21 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-Bundle-SymbolicName: scr_test
-Bundle-Version: 1.0.0
-Service-Component: test.xml
-library: scr_test
diff --git a/scr/test/test.c b/scr/test/test.c
deleted file mode 100644
index 48cc53f..0000000
--- a/scr/test/test.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * test.c
- *
- *  \date       Nov 3, 2015
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdio.h>
-
-#include <bundle_activator.h>
-
-struct service {
-	char *a;
-};
-
-typedef struct service *service_t;
-
-celix_status_t bundleActivator_create(BUNDLE_CONTEXT context, void **userData) {
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_start(void * userData, BUNDLE_CONTEXT context) {
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_stop(void * userData, BUNDLE_CONTEXT context) {
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, BUNDLE_CONTEXT context) {
-	return CELIX_SUCCESS;
-}
-
-void activate() {
-	printf("Activate!\n");
-}
diff --git a/scr/test/test.xml b/scr/test/test.xml
deleted file mode 100644
index 6006a74..0000000
--- a/scr/test/test.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
--->
-<scr:component enabled="true" name="example.activator" xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0">
-	<implementation class="{componentName}_{createName}">
-		<!-- 
-			class points to the constructor function of the component. 
-			It's signature has to be: celix_status_t {compontenName_create}(void **instance);
-			In this function {instance} is a return pointer to some data object representing the instance of the component.
-			This pointer will be supplied as first argument to all calls made to the component.
-		-->
-	</implementation>
-	<property name="{propName}">{textValue}</property>
-	<service>
-		<provide interface="{ServiceName1}" getter="{componentName}_{serviceGetter}"/>
-		<provide interface="{ServiceName2}" getter="{componentName}_{serviceGetter}"/>
-		<provide interface="{ServiceName3}" getter="{componentName}_{serviceGetter}"/>
-		<provide interface="{ServiceName4}" getter="{componentName}_{serviceGetter}"/>
-			<!-- 
-				This is where we have a problem. Within Celix a service isn't simply an interface that can be registered.
-				The user has to create a struct instance with function pointers.
-				A possible solution is to let the user implement a function which return this struct instance.
-			-->
-	</service>
-	<reference 
-		name="{ReferenceName}" 	
-		interface="{ServiceName1}" 
-		target="{someFilter}"
-		bind="{componentName}_{bindName}"
-		unbind="myComponent_{unbindName}"/>
-		<reference 
-		name="{ReferenceName}" 	
-		interface="{ServiceName2}" 
-		target="{someFilter}"
-		bind="{componentName}_{bindName}"
-		unbind="myComponent_{unbindName}"/>
-		<reference 
-		name="{ReferenceName}" 	
-		interface="{ServiceName3}" 
-		target="{someFilter}"
-		bind="{componentName}_{bindName}"
-		unbind="myComponent_{unbindName}"/>
-</scr:component>
-	
\ No newline at end of file
diff --git a/shell/CMakeLists.txt b/shell/CMakeLists.txt
index f1f7ab2..3ffb9e1 100644
--- a/shell/CMakeLists.txt
+++ b/shell/CMakeLists.txt
@@ -20,7 +20,7 @@
 
     add_bundle(shell
         SYMBOLIC_NAME "apache_celix_shell"
-        VERSION "1.0.0"
+        VERSION "2.0.0"
         NAME "Apache Celix Shell"
 
         SOURCES
diff --git a/shell/private/src/activator.c b/shell/private/src/activator.c
index b98cb26..3dddf07 100644
--- a/shell/private/src/activator.c
+++ b/shell/private/src/activator.c
@@ -29,6 +29,7 @@
 #include "bundle_activator.h"
 #include "std_commands.h"
 #include "service_tracker.h"
+#include "constants.h"
 
 #define NUMBER_OF_COMMANDS 10
 
@@ -150,6 +151,7 @@
             properties_set(instance_ptr->std_commands[i].props, OSGI_SHELL_COMMAND_NAME, instance_ptr->std_commands[i].name);
             properties_set(instance_ptr->std_commands[i].props, OSGI_SHELL_COMMAND_USAGE, instance_ptr->std_commands[i].usage);
             properties_set(instance_ptr->std_commands[i].props, OSGI_SHELL_COMMAND_DESCRIPTION, instance_ptr->std_commands[i].description);
+            properties_set(instance_ptr->std_commands[i].props, CELIX_FRAMEWORK_SERVICE_LANGUAGE, CELIX_FRAMEWORK_SERVICE_C_LANGUAGE);
 
             instance_ptr->std_commands[i].service = calloc(1, sizeof(*instance_ptr->std_commands[i].service));
             if (!instance_ptr->std_commands[i].service) {
@@ -186,7 +188,9 @@
     }
 
     if (status == CELIX_SUCCESS) {
-        status = bundleContext_registerService(context_ptr, (char *) OSGI_SHELL_SERVICE_NAME, instance_ptr->shellService, NULL, &instance_ptr->registration);
+        properties_pt props = properties_create();
+        properties_set(props, CELIX_FRAMEWORK_SERVICE_LANGUAGE, CELIX_FRAMEWORK_SERVICE_C_LANGUAGE);
+        status = bundleContext_registerService(context_ptr, (char *) OSGI_SHELL_SERVICE_NAME, instance_ptr->shellService, props, &instance_ptr->registration);
     }
 
 	if (status == CELIX_SUCCESS) {
diff --git a/shell/private/src/inspect_command.c b/shell/private/src/inspect_command.c
index 24a343b..cb93e9c 100644
--- a/shell/private/src/inspect_command.c
+++ b/shell/private/src/inspect_command.c
@@ -123,7 +123,7 @@
 
 				if (bundle_getRegisteredServices(bundle, &refs) == CELIX_SUCCESS) {
 					module_pt module = NULL;
-					char * name = NULL;
+					const char * name = NULL;
 					status = bundle_getCurrentModule(bundle, &module);
 					if (status == CELIX_SUCCESS) {
 						status = module_getSymbolicName(module, &name);
@@ -143,12 +143,14 @@
 									serviceReference_getPropertyKeys(ref, &keys, &size);
 									for (int k = 0; k < size; k++) {
 									    char *key = keys[k];
-									    char *value = NULL;
+									    const char *value = NULL;
 									    serviceReference_getProperty(ref, key, &value);
 
 										fprintf(outStream, "%s = %s\n", key, value);
 									}
 
+									free(keys);
+
 //									objectClass = properties_get(props, (char *) OSGI_FRAMEWORK_OBJECTCLASS);
 //									sprintf(line, "ObjectClass = %s\n", objectClass);
 									if ((j + 1) < arrayList_size(refs)) {
@@ -159,6 +161,10 @@
 						}
 					}
 				}
+
+				if(refs!=NULL){
+					arrayList_destroy(refs);
+				}
 			}
 		}
 	}
@@ -207,7 +213,7 @@
 
                 if (bundle_getServicesInUse(bundle, &refs) == CELIX_SUCCESS) {
                     module_pt module = NULL;
-                    char * name = NULL;
+                    const char * name = NULL;
                     status = bundle_getCurrentModule(bundle, &module);
                     if (status == CELIX_SUCCESS) {
                         status = module_getSymbolicName(module, &name);
@@ -223,7 +229,7 @@
                                     service_reference_pt ref = (service_reference_pt) arrayList_get(refs, j);
                                     bundle_pt usedBundle = NULL;
                                     module_pt usedModule = NULL;
-                                    char *usedSymbolicName = NULL;
+                                    const char *usedSymbolicName = NULL;
                                     long usedBundleId;
 
                                     serviceReference_getBundle(ref, &usedBundle);
@@ -239,7 +245,7 @@
                                     serviceReference_getPropertyKeys(ref, &keys, &size);
                                     for (int k = 0; k < size; k++) {
                                         char *key = keys[k];
-                                        char *value = NULL;
+                                        const char *value = NULL;
                                         serviceReference_getProperty(ref, key, &value);
 
 										fprintf(outStream, "%s = %s\n", key, value);
@@ -256,6 +262,10 @@
                         }
                     }
                 }
+
+                if(refs!=NULL){
+                	arrayList_destroy(refs);
+                }
             }
         }
     }
diff --git a/shell/private/src/lb_command.c b/shell/private/src/lb_command.c
index 9a1eb3f..82812d5 100644
--- a/shell/private/src/lb_command.c
+++ b/shell/private/src/lb_command.c
@@ -115,9 +115,9 @@
             bundle_archive_pt archive_ptr = NULL;
             long id = 0;
             bundle_state_e state = OSGI_FRAMEWORK_BUNDLE_UNKNOWN;
-            char *state_str = NULL;
+            const char *state_str = NULL;
             module_pt module_ptr = NULL;
-            char *name_str = NULL;
+            const char *name_str = NULL;
 
             sub_status = bundle_getArchive(bundle_ptr, &archive_ptr);
             if (sub_status == CELIX_SUCCESS) {
diff --git a/shell/private/src/shell.c b/shell/private/src/shell.c
index 8f8241e..e4fef47 100644
--- a/shell/private/src/shell.c
+++ b/shell/private/src/shell.c
@@ -110,10 +110,10 @@
 celix_status_t shell_addCommand(shell_pt shell_ptr, service_reference_pt reference_ptr, void *svc) {
     celix_status_t status = CELIX_SUCCESS;
     command_service_pt command_ptr = NULL;
-    char *name_str = NULL;
+    const char *name_str = NULL;
 
     if (!shell_ptr || !reference_ptr) {
-        status = CELIX_ILLEGAL_ARGUMENT;
+        return CELIX_ILLEGAL_ARGUMENT;
     }
 
     if (status == CELIX_SUCCESS) {
@@ -129,7 +129,7 @@
     }
 
     if (status == CELIX_SUCCESS) {
-        hashMap_put(shell_ptr->command_name_map_ptr, name_str, command_ptr);
+        hashMap_put(shell_ptr->command_name_map_ptr, (char *)name_str, command_ptr);
         hashMap_put(shell_ptr->command_reference_map_ptr, reference_ptr, command_ptr);
     }
 
@@ -147,7 +147,7 @@
     celix_status_t status = CELIX_SUCCESS;
 
     command_service_pt command_ptr = NULL;
-    char *name_str = NULL;
+    const char *name_str = NULL;
 
     if (!shell_ptr || !reference_ptr) {
         status = CELIX_ILLEGAL_ARGUMENT;
@@ -168,7 +168,7 @@
     }
 
     if (status == CELIX_SUCCESS) {
-        hashMap_remove(shell_ptr->command_name_map_ptr, name_str);
+        hashMap_remove(shell_ptr->command_name_map_ptr, (char *)name_str);
     }
 
     return status;
@@ -220,7 +220,7 @@
 	}
 
 	if (status == CELIX_SUCCESS) {
-		status = serviceReference_getProperty(reference, "command.usage", usage_pstr);
+		status = serviceReference_getProperty(reference, "command.usage", (const char**)usage_pstr);
 	}
 
 	return status;
@@ -243,7 +243,7 @@
 	}
 
 	if (status == CELIX_SUCCESS) {
-		serviceReference_getProperty(reference, "command.description", command_description_pstr);
+		serviceReference_getProperty(reference, "command.description", (const char**)command_description_pstr);
 	}
 
 	return status;
@@ -262,7 +262,7 @@
 		while (hashMapIterator_hasNext(iter)) {
 			hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
 			service_reference_pt reference = hashMapEntry_getKey(entry);
-			char *name_str = NULL;
+			const char *name_str = NULL;
 			serviceReference_getProperty(reference, "command.name", &name_str);
 			if (strcmp(name_str, command_name_str) == 0) {
 				*command_reference_ptr = (service_reference_pt) hashMapEntry_getKey(entry);
diff --git a/shell/private/src/update_command.c b/shell/private/src/update_command.c
index 84a5d2f..0e45fd7 100644
--- a/shell/private/src/update_command.c
+++ b/shell/private/src/update_command.c
@@ -27,6 +27,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <curl/curl.h>
+#include <sys/stat.h>
 
 #include "array_list.h"
 #include "bundle_context.h"
@@ -74,29 +75,35 @@
 
 celix_status_t updateCommand_download(bundle_context_pt context, char * url, char **inputFile) {
 	CURL *curl = NULL;
-	CURLcode res = 0;
+	CURLcode res = CURLE_FILE_COULDNT_READ_FILE;
 	curl = curl_easy_init();
 	if (curl) {
 		FILE *fp = NULL;
 		snprintf(*inputFile, 13,"updateXXXXXX");
+		umask(0011);
 		int fd = mkstemp(*inputFile);
 		if (fd) {
 		    fp = fopen(*inputFile, "wb+");
-            printf("Temp file: %s\n", *inputFile);
-            curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
-            curl_easy_setopt(curl, CURLOPT_URL, url);
-            curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, updateCommand_writeData);
-            curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
-            //curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0);
-            //curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, updateCommand_downloadProgress);
-            res = curl_easy_perform(curl);
-            printf("Error: %d\n", res);
-            /* always cleanup */
-            curl_easy_cleanup(curl);
-            fclose(fp);
+		    if(fp!=NULL){
+		    	printf("Temp file: %s\n", *inputFile);
+		    	curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
+		    	curl_easy_setopt(curl, CURLOPT_URL, url);
+		    	curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, updateCommand_writeData);
+		    	curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
+		    	//curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0);
+		    	//curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, updateCommand_downloadProgress);
+		    	res = curl_easy_perform(curl);
+		    	fclose(fp);
+		    }
+		    /* always cleanup */
+		    curl_easy_cleanup(curl);
+		    if(fp==NULL){
+		    	return CELIX_FILE_IO_EXCEPTION;
+		    }
 		}
 	}
 	if (res != CURLE_OK) {
+		printf("Error: %d\n", res);
 		*inputFile[0] = '\0';
 		return CELIX_ILLEGAL_STATE;
 	} else {
diff --git a/shell/public/include/command.h b/shell/public/include/command.h
index 9abe789..0e86dcc 100644
--- a/shell/public/include/command.h
+++ b/shell/public/include/command.h
@@ -36,7 +36,8 @@
 
 static const char * const OSGI_SHELL_COMMAND_SERVICE_NAME = "commandService";
 
-typedef struct commandService * command_service_pt;
+typedef struct commandService command_service_t;
+typedef command_service_t * command_service_pt;
 
 /**
  * The command service can be used to register additional shell commands.
diff --git a/shell/public/include/shell.h b/shell/public/include/shell.h
index f7c5edd..c8e7d60 100644
--- a/shell/public/include/shell.h
+++ b/shell/public/include/shell.h
@@ -32,7 +32,8 @@
 
 static const char * const OSGI_SHELL_SERVICE_NAME = "shellService";
 
-typedef struct shell * shell_pt;
+typedef struct shell shell_t;
+typedef shell_t* shell_pt;
 
 struct shellService {
 	shell_pt shell;
@@ -44,6 +45,7 @@
 	celix_status_t (*executeCommand)(shell_pt shell_ptr, char * command_line_str, FILE *out, FILE *err);
 };
 
-typedef struct shellService * shell_service_pt;
+typedef struct shellService shell_service_t;
+typedef shell_service_t* shell_service_pt;
 
 #endif /* SHELL_H_ */
diff --git a/shell_bonjour/CMakeLists.txt b/shell_bonjour/CMakeLists.txt
index d1990fd..300fef0 100644
--- a/shell_bonjour/CMakeLists.txt
+++ b/shell_bonjour/CMakeLists.txt
@@ -17,9 +17,6 @@
 
 celix_subproject(SHELL_BONJOUR "Option to enable building the Bonjour Shell (shell access by chat clients)" OFF DEPS LAUNCHER shell)
 if (SHELL_BONJOUR)
-	if(NOT ${WITH_APR})
-		message(FATAL_ERROR "SHELL_BONJOUR requires APR, enable WITH_APR option.")
-	endif()
 	find_package(LibXml2 REQUIRED)
 	
 	#TODO create/add FindDNS_SD.cmake and use it (with required)
@@ -33,16 +30,23 @@
 	include_directories("${PROJECT_SOURCE_DIR}/shell/public/include")
 	include_directories("${LIBXML2_INCLUDE_DIR}")
 	include_directories("private/include")
-	
+
+	set(MEMSTREAM_SOURCES )
+	if (APPLE OR ANDROID)
+		set(MEMSTREAM_SOURCES ${PROJECT_SOURCE_DIR}/utils/private/src/memstream/open_memstream.c  ${PROJECT_SOURCE_DIR}/utils/private/src/memstream/fmemopen.c)
+		include_directories(${PROJECT_SOURCE_DIR}/utils/public/include/memstream)
+	endif()
 	add_bundle(bonjour_shell
+                VERSION "1.0.0"
 		SOURCES
 		 	private/src/activator.c
 		 	private/src/bonjour_shell.c
+			${MEMSTREAM_SOURCES}
 	)
 	
 	target_link_libraries(bonjour_shell celix_framework celix_utils ${LIBXML2_LIBRARIES} ${DNS_SD_LIB})
 
-	add_deploy("bonjour_shell" BUNDLES 
+	add_deploy("bonjour_shell_deploy" BUNDLES 
 		shell
 		bonjour_shell
 		PROPERTIES "bonjour.shell.id=Apache Celix"
diff --git a/shell_bonjour/private/include/bonjour_shell.h b/shell_bonjour/private/include/bonjour_shell.h
index b506179..1072f0e 100644
--- a/shell_bonjour/private/include/bonjour_shell.h
+++ b/shell_bonjour/private/include/bonjour_shell.h
@@ -27,15 +27,13 @@
 #ifndef BONJOUR_SHELL_H_
 #define BONJOUR_SHELL_H_
 
-#include <apr_pools.h>
-
 #include <service_reference.h>
 
 #include "celix_errno.h"
 
 typedef struct bonjour_shell *bonjour_shell_pt;
 
-celix_status_t bonjourShell_create(apr_pool_t *pool, char *id, bonjour_shell_pt *shell);
+celix_status_t bonjourShell_create(char *id, bonjour_shell_pt *shell);
 celix_status_t bonjourShell_destroy(bonjour_shell_pt shell);
 
 celix_status_t bonjourShell_addShellService(void * handle, service_reference_pt reference, void * service);
diff --git a/shell_bonjour/private/src/activator.c b/shell_bonjour/private/src/activator.c
index eaba835..e05211d 100644
--- a/shell_bonjour/private/src/activator.c
+++ b/shell_bonjour/private/src/activator.c
@@ -27,7 +27,6 @@
 #include <celix_errno.h>
 
 #include <stdlib.h>
-#include <apr_pools.h>
 
 #include "bundle_activator.h"
 #include "bundle_context.h"
@@ -40,79 +39,72 @@
 #include <shell.h>
 
 struct bundle_instance {
-	apr_pool_t *pool;
-	bonjour_shell_pt shell;
-	service_tracker_pt tracker;
+        bonjour_shell_pt shell;
+        service_tracker_pt tracker;
 };
 
 typedef struct bundle_instance *bundle_instance_pt;
 
 celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
-	celix_status_t status = CELIX_SUCCESS;
-    apr_pool_t *ctxpool;
-    apr_pool_t *pool;
-
-    status = bundleContext_getMemoryPool(context, &ctxpool);
-    apr_pool_create(&pool, ctxpool);
-    if (status == CELIX_SUCCESS) {
-    	bundle_instance_pt bi = (bundle_instance_pt) apr_palloc(pool, sizeof(struct bundle_instance));
-        if (userData != NULL) {
-        	bi->pool = pool;
-        	bi->shell = NULL;
-        	bi->tracker = NULL;
-        	(*userData) = bi;
+        celix_status_t status = CELIX_SUCCESS;
+        struct bundle_instance *bi = calloc(1, sizeof(*bi));
+        
+        if (bi) {
+                bi->shell = NULL;
+                bi->tracker = NULL;
+                (*userData) = bi;
         } else {
-        	status = CELIX_ENOMEM;
+                status = CELIX_ENOMEM;
+                
         }
-    }
-    return status;
+        return status;
 }
 
 celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
-    celix_status_t status = CELIX_SUCCESS;
-    bundle_instance_pt bi = (bundle_instance_pt)userData;
+        celix_status_t status = CELIX_SUCCESS;
+        bundle_instance_pt bi = (bundle_instance_pt) userData;
 
-    char *uuid = NULL;
-    bundleContext_getProperty(context, OSGI_FRAMEWORK_FRAMEWORK_UUID, &uuid);
-    char *hostname = NULL;
-    bundleContext_getProperty(context, "HOSTNAME", &hostname);
-    char *bonjourShellId = NULL;
-    bundleContext_getProperty(context, "bonjour.shell.id", &bonjourShellId);
+        const char *uuid = NULL;
+        bundleContext_getProperty(context, OSGI_FRAMEWORK_FRAMEWORK_UUID, &uuid);
+        const char *hostname = NULL;
+        bundleContext_getProperty(context, "HOSTNAME", &hostname);
+        const char *bonjourShellId = NULL;
+        bundleContext_getProperty(context, "bonjour.shell.id", &bonjourShellId);
 
-    char id[128];
-    if (bonjourShellId != NULL) {
-    	snprintf(id, 128, bonjourShellId);
-    } else if (hostname != NULL) {
-    	snprintf(id, 128, "Celix-%.8s@%s", uuid, hostname);
-    } else {
-    	snprintf(id, 128, "Celix-%.8s", uuid);
-    }
-    status = bonjourShell_create(bi->pool, id, &bi->shell);
+        char id[128];
+        if (bonjourShellId != NULL) {
+                snprintf(id, 128, "%s", bonjourShellId);
+        } else if (hostname != NULL) {
+                snprintf(id, 128, "Celix-%.8s@%s", uuid, hostname);
+        } else {
+                snprintf(id, 128, "Celix-%.8s", uuid);
+        }
+        status = bonjourShell_create(id, &bi->shell);
 
-    service_tracker_customizer_pt cust = NULL;
-    serviceTrackerCustomizer_create(bi->shell,  NULL, bonjourShell_addShellService, NULL, bonjourShell_removeShellService, &cust);
-    serviceTracker_create(context, (char *)OSGI_SHELL_SERVICE_NAME, cust, &bi->tracker);
-    serviceTracker_open(bi->tracker);
+        service_tracker_customizer_pt cust = NULL;
+        serviceTrackerCustomizer_create(bi->shell, NULL, bonjourShell_addShellService, NULL, bonjourShell_removeShellService, &cust);
+        serviceTracker_create(context, (char *) OSGI_SHELL_SERVICE_NAME, cust, &bi->tracker);
+        serviceTracker_open(bi->tracker);
 
 
-    return status;
+        return status;
 }
 
 celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
-    celix_status_t status = CELIX_SUCCESS;
-    bundle_instance_pt bi = (bundle_instance_pt)userData;
+        celix_status_t status = CELIX_SUCCESS;
+        bundle_instance_pt bi = (bundle_instance_pt) userData;
 
-    serviceTracker_close(bi->tracker);
+        serviceTracker_close(bi->tracker);
 
-    return status;
+        return status;
 }
 
 celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
-	 celix_status_t status = CELIX_SUCCESS;
-	    bundle_instance_pt bi = (bundle_instance_pt)userData;
+        celix_status_t status = CELIX_SUCCESS;
+        bundle_instance_pt bi = (bundle_instance_pt) userData;
 
-	    serviceTracker_destroy(bi->tracker);
-	    bonjourShell_destroy(bi->shell);
+        serviceTracker_destroy(bi->tracker);
+        bonjourShell_destroy(bi->shell);
 
-	    return status;
+        return status;
 }
diff --git a/shell_bonjour/private/src/bonjour_shell.c b/shell_bonjour/private/src/bonjour_shell.c
index f463a6b..59ee18a 100644
--- a/shell_bonjour/private/src/bonjour_shell.c
+++ b/shell_bonjour/private/src/bonjour_shell.c
@@ -28,6 +28,7 @@
 
 #include <stdint.h>
 #include <stdio.h>
+#include <string.h>
 #include <pthread.h>
 #include <arpa/inet.h>
 #include <sys/time.h>
@@ -39,6 +40,11 @@
 #include <celixbool.h>
 #include <shell.h>
 
+#if defined(BSD) || defined(__APPLE__)  || defined(ANDROID)
+#include "open_memstream.h"
+#include "fmemopen.h"
+#endif
+
 #define MAX_BUFFER_SIZE 5120
 
 //static xmlBufferPtr buf; //FOR DEBUG
@@ -78,7 +84,7 @@
 
 static struct connection_context *currentContext = NULL; //TODO update shell to accept void * data next to callback
 
-static void bonjourShell_addDataToCurrentContext(char *buff);
+static void bonjourShell_addDataToCurrentContext(const char* out, const char* err);
 static void bonjourShell_sendData(struct connection_context *context);
 
 static celix_status_t bonjourShell_register(bonjour_shell_pt shell);
@@ -92,9 +98,9 @@
 static void bonjourShell_parseStream(bonjour_shell_pt shell, struct connection_context *context);
 static void bonjourShell_parseCommand(bonjour_shell_pt shell, struct connection_context *context);
 
-celix_status_t bonjourShell_create(apr_pool_t *parentPool, char *id, bonjour_shell_pt *result) {
+celix_status_t bonjourShell_create(char *id, bonjour_shell_pt *result) {
 	celix_status_t status = CELIX_SUCCESS;
-	bonjour_shell_pt shell = (bonjour_shell_pt) malloc(sizeof(struct bonjour_shell));
+	bonjour_shell_pt shell = (bonjour_shell_pt) calloc(1, sizeof(*shell));
 	if (shell != NULL) {
 		shell->id = strdup(id);
 		shell->running = true;
@@ -262,7 +268,7 @@
 			xmlFreeTextWriter(context.writer);
 		}
 	}
-
+        arrayList_destroy(context.dataList);
 
 }
 
@@ -322,29 +328,48 @@
 	}
 }
 
+static void bonjourShell_parseCommand(bonjour_shell_pt shell, struct connection_context *context)
+{
+        xmlChar *command = xmlTextReaderReadString(context->reader);
 
-static void bonjourShell_parseCommand(bonjour_shell_pt shell, struct connection_context *context)  {
-    xmlChar *command = xmlTextReaderReadString(context->reader);
+        if (command != NULL) {
+                context->gotCommand = true;
+                currentContext = context;
+                pthread_mutex_lock(&shell->mutex);
+                if (shell->service != NULL) {
+                        char *outbuf;
+                        size_t outsize;
+                        char *errbuf;
+                        size_t errsize;
 
-	if (command != NULL) {
-		context->gotCommand = true;
-		currentContext = context;
-		pthread_mutex_lock(&shell->mutex);
-		if (shell->service != NULL) {
-			shell->service->executeCommand(shell->service->shell, (char *)command, bonjourShell_addDataToCurrentContext, bonjourShell_addDataToCurrentContext);
-		}
-		pthread_mutex_unlock(&shell->mutex);
-	} 
+                        FILE *out = open_memstream(&outbuf, &outsize);
+                        FILE *err = open_memstream(&errbuf, &errsize);
 
-	if (command != NULL) {
-		xmlFree(command);
-	}
+                        shell->service->executeCommand(shell->service->shell, (char *) command, out, err);
+
+                        fclose(out);
+                        fclose(err);
+                        bonjourShell_addDataToCurrentContext(outbuf, errbuf);
+                        free(outbuf);
+                        free(errbuf);
+                }
+                pthread_mutex_unlock(&shell->mutex);
+        }
+
+        if (command != NULL) {
+                xmlFree(command);
+        }
 }
 
-static void bonjourShell_addDataToCurrentContext(char *buff) {
+static void bonjourShell_addDataToCurrentContext(const char* out, const char* err) {
 	pthread_mutex_lock(&currentContext->mutex);
-	arrayList_add(currentContext->dataList, strdup(buff));
-	gettimeofday(&currentContext->lastUpdated, NULL);
+    if (out != NULL) {
+	    arrayList_add(currentContext->dataList, strdup(out));
+    }
+	if (err != NULL) {
+        arrayList_add(currentContext->dataList, strdup(err));
+    }
+    gettimeofday(&currentContext->lastUpdated, NULL);
 	pthread_mutex_unlock(&currentContext->mutex);
 	pthread_cond_signal(&currentContext->dataAvailCond);
 }
@@ -396,7 +421,7 @@
 
 	close(shell->listenSocket);
 	pthread_join(shell->listenThread, NULL);
-
+        free(shell->id);
 	free(shell);
 	return CELIX_SUCCESS;
 }
diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
index 6c273bd..3c20b90 100644
--- a/utils/CMakeLists.txt
+++ b/utils/CMakeLists.txt
@@ -63,7 +63,7 @@
         target_link_libraries(celix_utils m)
     ENDIF()
     
-    install(TARGETS celix_utils DESTINATION lib COMPONENT framework)
+    install(TARGETS celix_utils DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT framework)
     FILE(GLOB files "public/include/*.h")
     INSTALL(FILES ${files} DESTINATION include/celix COMPONENT framework)
     
diff --git a/utils/private/include/hash_map_private.h b/utils/private/include/hash_map_private.h
index fe2a065..cddf7a1 100644
--- a/utils/private/include/hash_map_private.h
+++ b/utils/private/include/hash_map_private.h
@@ -30,17 +30,17 @@
 #include "exports.h"
 #include "hash_map.h"
 
-UTILS_EXPORT unsigned int hashMap_hashCode(void * toHash);
-UTILS_EXPORT int hashMap_equals(void * toCompare, void * compare);
+UTILS_EXPORT unsigned int hashMap_hashCode(const void* toHash);
+UTILS_EXPORT int hashMap_equals(const void* toCompare, const void* compare);
 
 void hashMap_resize(hash_map_pt map, int newCapacity);
-void * hashMap_removeEntryForKey(hash_map_pt map, void * key);
+hash_map_entry_pt hashMap_removeEntryForKey(hash_map_pt map, const void* key);
 UTILS_EXPORT hash_map_entry_pt hashMap_removeMapping(hash_map_pt map, hash_map_entry_pt entry);
-void hashMap_addEntry(hash_map_pt map, int hash, void * key, void * value, int bucketIndex);
+void hashMap_addEntry(hash_map_pt map, int hash, void* key, void* value, int bucketIndex);
 
 struct hashMapEntry {
-	void * key;
-	void * value;
+	void* key;
+	void* value;
 	hash_map_entry_pt next;
 	unsigned int hash;
 };
@@ -52,18 +52,10 @@
 	unsigned int modificationCount;
 	unsigned int tablelength;
 
-	unsigned int (*hashKey)(void * key);
-	unsigned int (*hashValue)(void * value);
-	int (*equalsKey)(void * key1, void * key2);
-	int (*equalsValue)(void * value1, void * value2);
-};
-
-struct hashMapIterator {
-	hash_map_pt map;
-	hash_map_entry_pt next;
-	hash_map_entry_pt current;
-	int expectedModCount;
-	int index;
+	unsigned int (*hashKey)(const void* key);
+	unsigned int (*hashValue)(const void* value);
+	int (*equalsKey)(const void* key1, const void* key2);
+	int (*equalsValue)(const void* value1, const void* value2);
 };
 
 struct hashMapKeySet {
diff --git a/utils/private/src/array_list.c b/utils/private/src/array_list.c
index c59f014..e7a2e30 100644
--- a/utils/private/src/array_list.c
+++ b/utils/private/src/array_list.c
@@ -30,7 +30,7 @@
 #include "array_list.h"
 #include "array_list_private.h"
 
-static celix_status_t arrayList_elementEquals(void *a, void *b, bool *equals);
+static celix_status_t arrayList_elementEquals(const void *a, const void *b, bool *equals);
 
 celix_status_t arrayList_create(array_list_pt *list) {
 	return arrayList_createWithEquals(arrayList_elementEquals, list);
@@ -55,7 +55,7 @@
 	free(list);
 }
 
-static celix_status_t arrayList_elementEquals(void *a, void *b, bool *equals) {
+static celix_status_t arrayList_elementEquals(const void *a, const void *b, bool *equals) {
 	*equals = (a == b);
 	return CELIX_SUCCESS;
 }
diff --git a/utils/private/src/hash_map.c b/utils/private/src/hash_map.c
index 177cf0d..bc514a7 100644
--- a/utils/private/src/hash_map.c
+++ b/utils/private/src/hash_map.c
@@ -28,6 +28,7 @@
 #include <stdlib.h>
 #include <math.h>
 #include <stdint.h>
+#include <string.h>
 
 #include "hash_map.h"
 #include "hash_map_private.h"
@@ -36,12 +37,12 @@
 static float DEFAULT_LOAD_FACTOR = 0.75f;
 static unsigned int MAXIMUM_CAPACITY = 1 << 30;
 
-unsigned int hashMap_hashCode(void * toHash) {
+unsigned int hashMap_hashCode(const void * toHash) {
 	intptr_t address = (intptr_t) toHash;
 	return address;
 }
 
-int hashMap_equals(void * toCompare, void * compare) {
+int hashMap_equals(const void * toCompare, const void * compare) {
 	return toCompare == compare;
 }
 
@@ -66,8 +67,8 @@
 	return h & (length - 1);
 }
 
-hash_map_pt hashMap_create(unsigned int (*keyHash)(void *), unsigned int (*valueHash)(void *),
-		int (*keyEquals)(void *, void *), int (*valueEquals)(void *, void *)) {
+hash_map_pt hashMap_create(unsigned int (*keyHash)(const void *), unsigned int (*valueHash)(const void *),
+		int (*keyEquals)(const void *, const void *), int (*valueEquals)(const void *, const void *)) {
 	hash_map_pt map = (hash_map_pt) malloc(sizeof(*map));
 	map->treshold = (unsigned int) (DEFAULT_INITIAL_CAPACITY * DEFAULT_LOAD_FACTOR);
 	map->table = (hash_map_entry_pt *) calloc(DEFAULT_INITIAL_CAPACITY, sizeof(hash_map_entry_pt));
@@ -109,7 +110,7 @@
 	return hashMap_size(map) == 0;
 }
 
-void * hashMap_get(hash_map_pt map, void * key) {
+void * hashMap_get(hash_map_pt map, const void* key) {
 	unsigned int hash;
 	if (key == NULL) {
 		hash_map_entry_pt entry;
@@ -131,11 +132,11 @@
 	return NULL;
 }
 
-bool hashMap_containsKey(hash_map_pt map, void * key) {
+bool hashMap_containsKey(hash_map_pt map, const void* key) {
 	return hashMap_getEntry(map, key) != NULL;
 }
 
-hash_map_entry_pt hashMap_getEntry(hash_map_pt map, void * key) {
+hash_map_entry_pt hashMap_getEntry(hash_map_pt map, const void* key) {
 	unsigned int hash = (key == NULL) ? 0 : hashMap_hash(map->hashKey(key));
 	hash_map_entry_pt entry;
 	int index = hashMap_indexFor(hash, map->tablelength);
@@ -207,7 +208,7 @@
 	map->treshold = (unsigned int) ceil(newCapacity * DEFAULT_LOAD_FACTOR);
 }
 
-void * hashMap_remove(hash_map_pt map, void * key) {
+void * hashMap_remove(hash_map_pt map, const void* key) {
 	hash_map_entry_pt entry = hashMap_removeEntryForKey(map, key);
 	void * value = (entry == NULL ? NULL : entry->value);
 	if (entry != NULL) {
@@ -218,7 +219,7 @@
 	return value;
 }
 
-void * hashMap_removeEntryForKey(hash_map_pt map, void * key) {
+hash_map_entry_pt hashMap_removeEntryForKey(hash_map_pt map, const void* key) {
 	unsigned int hash = (key == NULL) ? 0 : hashMap_hash(map->hashKey(key));
 	int i = hashMap_indexFor(hash, map->tablelength);
 	hash_map_entry_pt prev = map->table[i];
@@ -297,7 +298,7 @@
 	map->size = 0;
 }
 
-bool hashMap_containsValue(hash_map_pt map, void * value) {
+bool hashMap_containsValue(hash_map_pt map, const void* value) {
 	unsigned int i;
 	if (value == NULL) {
 		for (i = 0; i < map->tablelength; i++) {
@@ -321,7 +322,7 @@
 	return false;
 }
 
-void hashMap_addEntry(hash_map_pt map, int hash, void * key, void * value, int bucketIndex) {
+void hashMap_addEntry(hash_map_pt map, int hash, void* key, void* value, int bucketIndex) {
 	hash_map_entry_pt entry = map->table[bucketIndex];
 	hash_map_entry_pt new = (hash_map_entry_pt) malloc(sizeof(*new));
 	new->hash = hash;
@@ -334,8 +335,28 @@
 	}
 }
 
+hash_map_iterator_pt hashMapIterator_alloc(void) {
+    return calloc(1, sizeof(hash_map_iterator_t));
+}
+
+void hashMapIterator_dealloc(hash_map_iterator_pt iterator) {
+    free(iterator);
+}
+
 hash_map_iterator_pt hashMapIterator_create(hash_map_pt map) {
-	hash_map_iterator_pt iterator = (hash_map_iterator_pt) malloc(sizeof(*iterator));
+	hash_map_iterator_pt iterator = hashMapIterator_alloc();
+    hashMapIterator_init(map, iterator);
+    return iterator;
+}
+
+UTILS_EXPORT hash_map_iterator_t hashMapIterator_construct(hash_map_pt map) {
+    hash_map_iterator_t iter;
+    memset(&iter, 0, sizeof(iter));
+    hashMapIterator_init(map, &iter);
+    return iter;
+}
+
+void hashMapIterator_init(hash_map_pt map, hash_map_iterator_pt iterator) {
 	iterator->map = map;
 	iterator->expectedModCount = map->modificationCount;
 	iterator->index = 0;
@@ -345,16 +366,19 @@
 		while (iterator->index < map->tablelength && (iterator->next = map->table[iterator->index++]) == NULL) {
 		}
 	}
-	return iterator;
+}
+
+void hashMapIterator_deinit(hash_map_iterator_pt iterator) {
+    iterator->current = NULL;
+    iterator->expectedModCount = 0;
+    iterator->index = 0;
+    iterator->map = NULL;
+    iterator->next = NULL;
 }
 
 void hashMapIterator_destroy(hash_map_iterator_pt iterator) {
-	iterator->current = NULL;
-	iterator->expectedModCount = 0;
-	iterator->index = 0;
-	iterator->map = NULL;
-	iterator->next = NULL;
-	free(iterator);
+	hashMapIterator_deinit(iterator);
+    hashMapIterator_dealloc(iterator);
 }
 
 bool hashMapIterator_hasNext(hash_map_iterator_pt iterator) {
@@ -444,11 +468,11 @@
 	return keySet->map->size;
 }
 
-bool hashMapKeySet_contains(hash_map_key_set_pt keySet, void * key) {
+bool hashMapKeySet_contains(hash_map_key_set_pt keySet, const void* key) {
 	return hashMap_containsKey(keySet->map, key);
 }
 
-bool hashMapKeySet_remove(hash_map_key_set_pt keySet, void * key) {
+bool hashMapKeySet_remove(hash_map_key_set_pt keySet, const void* key) {
 	hash_map_entry_pt entry = hashMap_removeEntryForKey(keySet->map, key);
 	bool removed = entry != NULL;
 	free(entry);
@@ -483,27 +507,24 @@
 	return values->map->size;
 }
 
-bool hashMapValues_contains(hash_map_values_pt values, void * value) {
+bool hashMapValues_contains(hash_map_values_pt values, const void* value) {
 	return hashMap_containsValue(values->map, value);
 }
 
 void hashMapValues_toArray(hash_map_values_pt values, void* *array[], unsigned int *size) {
 	hash_map_iterator_pt it;
-	int i;
+	int i = 0;
 	int vsize = hashMapValues_size(values);
 	*size = vsize;
-	*array = malloc(vsize * sizeof(*array));
+	*array = malloc(vsize * sizeof(**array));
 	it = hashMapValues_iterator(values);
-	for (i = 0; i < vsize; i++) {
-		if (!hashMapIterator_hasNext(it)) {
-			return;
-		}
-		(*array)[i] = hashMapIterator_nextValue(it);
+	while(hashMapIterator_hasNext(it) && i<vsize){
+		(*array)[i++] = hashMapIterator_nextValue(it);
 	}
 	hashMapIterator_destroy(it);
 }
 
-bool hashMapValues_remove(hash_map_values_pt values, void * value) {
+bool hashMapValues_remove(hash_map_values_pt values, const void* value) {
 	hash_map_iterator_pt iterator = hashMapValues_iterator(values);
 	if (value == NULL) {
 		while (hashMapIterator_hasNext(iterator)) {
diff --git a/dfi/private/src/memstream/fmemopen.c b/utils/private/src/memstream/fmemopen.c
similarity index 100%
rename from dfi/private/src/memstream/fmemopen.c
rename to utils/private/src/memstream/fmemopen.c
diff --git a/dfi/private/src/memstream/open_memstream.c b/utils/private/src/memstream/open_memstream.c
similarity index 100%
rename from dfi/private/src/memstream/open_memstream.c
rename to utils/private/src/memstream/open_memstream.c
diff --git a/utils/private/src/thpool.c b/utils/private/src/thpool.c
index 5a58218..5121fca 100644
--- a/utils/private/src/thpool.c
+++ b/utils/private/src/thpool.c
@@ -135,7 +135,7 @@
 	}
 
 	/* Make threads in pool */
-	thpool_p->threads = (struct thread**)malloc(num_threads * sizeof(struct thread));
+	thpool_p->threads = (struct thread**)malloc(num_threads * sizeof(struct thread*));
 	if (thpool_p->threads == NULL){
 		fprintf(stderr, "thpool_init(): Could not allocate memory for threads\n");
 		jobqueue_destroy(thpool_p);
@@ -264,7 +264,7 @@
 static void thread_init (thpool_* thpool_p, struct thread** thread_p, int id){
 	
 	*thread_p = (struct thread*)malloc(sizeof(struct thread));
-	if (thread_p == NULL){
+	if (*thread_p == NULL){
 		fprintf(stderr, "thpool_init(): Could not allocate memory for thread\n");
 		exit(1);
 	}
diff --git a/utils/private/src/version.c b/utils/private/src/version.c
index 73ade95..cb2703d 100644
--- a/utils/private/src/version.c
+++ b/utils/private/src/version.c
@@ -97,7 +97,7 @@
 	return CELIX_SUCCESS;
 }
 
-celix_status_t version_createVersionFromString(char * versionStr, version_pt *version) {
+celix_status_t version_createVersionFromString(const char * versionStr, version_pt *version) {
 	celix_status_t status = CELIX_SUCCESS;
 
 	int major = 0;
@@ -194,7 +194,7 @@
 	return status;
 }
 
-celix_status_t version_getQualifier(version_pt version, char **qualifier) {
+celix_status_t version_getQualifier(version_pt version, const char **qualifier) {
 	celix_status_t status = CELIX_SUCCESS;
 	*qualifier = version->qualifier;
 	return status;
diff --git a/utils/private/src/version_range.c b/utils/private/src/version_range.c
index d73a522..ed681fd 100644
--- a/utils/private/src/version_range.c
+++ b/utils/private/src/version_range.c
@@ -177,7 +177,7 @@
 }
 
 
-celix_status_t versionRange_parse(char * rangeStr, version_range_pt *range) {
+celix_status_t versionRange_parse(const char * rangeStr, version_range_pt *range) {
 	celix_status_t status;
 	if (strchr(rangeStr, ',') != NULL) {
 			int vlowL = strcspn(rangeStr+1, ",");
diff --git a/utils/private/test/celix_threads_test.cpp b/utils/private/test/celix_threads_test.cpp
index f75f8db..b22ba9d 100644
--- a/utils/private/test/celix_threads_test.cpp
+++ b/utils/private/test/celix_threads_test.cpp
@@ -67,7 +67,7 @@
 static char * celix_thread_t_toString(const void * object){
 	celix_thread_t * thread = (celix_thread_t*) object;
 	char buff[512];
-	snprintf(buff, 512, "thread: %lu, threadInitialized: %s", thread->thread, (thread->threadInitialized ? "true" : "false"));
+	snprintf(buff, 512, "thread: %lu, threadInitialized: %s", (unsigned long)thread->thread, (thread->threadInitialized ? "true" : "false"));
 
 	return my_strdup(buff);
 }
@@ -343,6 +343,7 @@
 
 	celixThreadCondition_wait(&param->cond, &param->mu);
 	LONGS_EQUAL(666, param->i);
+	celixThreadMutex_unlock(&param->mu);
 
 	celixThread_join(thread, NULL);
 	free(param);
@@ -360,17 +361,17 @@
 	celixThread_create(&thread2, NULL, thread_test_func_cond_broadcast, param);
 
 	sleep(1);
-	celixThreadMutex_lock(&param->mu2);
+	celixThreadMutex_lock(&param->mu);
 	LONGS_EQUAL(0, param->i);
-	celixThreadMutex_unlock(&param->mu2);
+	celixThreadMutex_unlock(&param->mu);
 
 	celixThreadMutex_lock(&param->mu);
 	celixThreadCondition_broadcast(&param->cond);
 	celixThreadMutex_unlock(&param->mu);
 	sleep(1);
-	celixThreadMutex_lock(&param->mu2);
+	celixThreadMutex_lock(&param->mu);
 	LONGS_EQUAL(2, param->i);
-	celixThreadMutex_unlock(&param->mu2);
+	celixThreadMutex_unlock(&param->mu);
 
 	celixThread_join(thread, NULL);
 	celixThread_join(thread2, NULL);
@@ -494,9 +495,9 @@
 	celixThreadMutex_lock(&param->mu);
 	celixThreadCondition_wait(&param->cond, &param->mu);
 	celixThreadMutex_unlock(&param->mu);
-	celixThreadMutex_lock(&param->mu2);
+	celixThreadMutex_lock(&param->mu);
 	param->i++;
-	celixThreadMutex_unlock(&param->mu2);
+	celixThreadMutex_unlock(&param->mu);
 	return NULL;
 }
 
diff --git a/utils/private/test/hash_map_test.cpp b/utils/private/test/hash_map_test.cpp
index eac9ea0..a50b377 100644
--- a/utils/private/test/hash_map_test.cpp
+++ b/utils/private/test/hash_map_test.cpp
@@ -61,7 +61,7 @@
 }
 
 //Callback functions
-unsigned int test_hashKeyChar(void * k) {
+unsigned int test_hashKeyChar(const void * k) {
 	char * str = (char *) k;
 
 	unsigned int hash = 1315423911;
@@ -76,16 +76,16 @@
 	return hash;
 }
 
-unsigned int test_hashValueChar(void * v) {
+unsigned int test_hashValueChar(const void * v) {
 	(void)(v);
 	return 0;
 }
 
-int test_equalsKeyChar(void * k, void * o) {
+int test_equalsKeyChar(const void * k, const void * o) {
 	return strcmp((char *)k, (char *) o) == 0;
 }
 
-int test_equalsValueChar(void * v, void * o) {
+int test_equalsValueChar(const void * v, const void * o) {
 	return strcmp((char *)v, (char *) o) == 0;
 }
 
diff --git a/utils/public/include/array_list.h b/utils/public/include/array_list.h
index c1fc30d..e824b9b 100644
--- a/utils/public/include/array_list.h
+++ b/utils/public/include/array_list.h
@@ -35,7 +35,7 @@
 
 typedef struct arrayListIterator * array_list_iterator_pt;
 
-typedef celix_status_t (*array_list_element_equals_pt)(void *, void *, bool *equals);
+typedef celix_status_t (*array_list_element_equals_pt)(const void*, const void*, bool *equals);
 
 UTILS_EXPORT celix_status_t arrayList_create(array_list_pt *list);
 UTILS_EXPORT celix_status_t arrayList_createWithEquals(array_list_element_equals_pt equals, array_list_pt *list);
diff --git a/utils/public/include/hash_map.h b/utils/public/include/hash_map.h
index f4f0acd..0a5410d 100644
--- a/utils/public/include/hash_map.h
+++ b/utils/public/include/hash_map.h
@@ -33,27 +33,43 @@
 typedef struct hashMapEntry * hash_map_entry_pt;
 typedef struct hashMap * hash_map_pt;
 
-typedef struct hashMapIterator * hash_map_iterator_pt;
+struct hashMapIterator {
+    hash_map_pt map;
+    hash_map_entry_pt next;
+    hash_map_entry_pt current;
+    int expectedModCount;
+    int index;
+};
+
+typedef struct hashMapIterator hash_map_iterator_t;
+typedef hash_map_iterator_t * hash_map_iterator_pt;
 
 typedef struct hashMapKeySet * hash_map_key_set_pt;
 typedef struct hashMapValues * hash_map_values_pt;
 typedef struct hashMapEntrySet * hash_map_entry_set_pt;
 
-UTILS_EXPORT hash_map_pt hashMap_create(unsigned int (*keyHash)(void *), unsigned int (*valueHash)(void *),
-		int (*keyEquals)(void *, void *), int (*valueEquals)(void *, void *));
+UTILS_EXPORT hash_map_pt hashMap_create(unsigned int (*keyHash)(const void*), unsigned int (*valueHash)(const void*),
+		int (*keyEquals)(const void*, const void*), int (*valueEquals)(const void*, const void*));
 UTILS_EXPORT void hashMap_destroy(hash_map_pt map, bool freeKeys, bool freeValues);
 UTILS_EXPORT int hashMap_size(hash_map_pt map);
 UTILS_EXPORT bool hashMap_isEmpty(hash_map_pt map);
-UTILS_EXPORT void * hashMap_get(hash_map_pt map, void * key);
-UTILS_EXPORT bool hashMap_containsKey(hash_map_pt map, void * key);
-UTILS_EXPORT hash_map_entry_pt hashMap_getEntry(hash_map_pt map, void * key);
-UTILS_EXPORT void * hashMap_put(hash_map_pt map, void * key, void * value);
-UTILS_EXPORT void * hashMap_remove(hash_map_pt map, void * key);
+UTILS_EXPORT void * hashMap_get(hash_map_pt map, const void* key);
+UTILS_EXPORT bool hashMap_containsKey(hash_map_pt map, const void* key);
+UTILS_EXPORT hash_map_entry_pt hashMap_getEntry(hash_map_pt map, const void* key);
+UTILS_EXPORT void * hashMap_put(hash_map_pt map, void* key, void* value);
+UTILS_EXPORT void * hashMap_remove(hash_map_pt map, const void* key);
 UTILS_EXPORT void hashMap_clear(hash_map_pt map, bool freeKey, bool freeValue);
-UTILS_EXPORT bool hashMap_containsValue(hash_map_pt map, void * value);
+UTILS_EXPORT bool hashMap_containsValue(hash_map_pt map, const void* value);
 
 UTILS_EXPORT hash_map_iterator_pt hashMapIterator_create(hash_map_pt map);
 UTILS_EXPORT void hashMapIterator_destroy(hash_map_iterator_pt iterator);
+UTILS_EXPORT hash_map_iterator_pt hashMapIterator_alloc(void);
+UTILS_EXPORT void hashMapIterator_dealloc(hash_map_iterator_pt iterator);
+UTILS_EXPORT void hashMapIterator_init(hash_map_pt map, hash_map_iterator_pt iterator);
+UTILS_EXPORT void hashMapIterator_deinit(hash_map_iterator_pt iterator);
+UTILS_EXPORT hash_map_iterator_t hashMapIterator_construct(hash_map_pt map);
+
+
 UTILS_EXPORT bool hashMapIterator_hasNext(hash_map_iterator_pt iterator);
 UTILS_EXPORT void hashMapIterator_remove(hash_map_iterator_pt iterator);
 UTILS_EXPORT void * hashMapIterator_nextValue(hash_map_iterator_pt iterator);
@@ -63,8 +79,8 @@
 UTILS_EXPORT hash_map_key_set_pt hashMapKeySet_create(hash_map_pt map);
 UTILS_EXPORT void hashMapKeySet_destroy(hash_map_key_set_pt keySet);
 UTILS_EXPORT int hashMapKeySet_size(hash_map_key_set_pt keySet);
-UTILS_EXPORT bool hashMapKeySet_contains(hash_map_key_set_pt keySet, void * key);
-UTILS_EXPORT bool hashMapKeySet_remove(hash_map_key_set_pt keySet, void * key);
+UTILS_EXPORT bool hashMapKeySet_contains(hash_map_key_set_pt keySet, const void* key);
+UTILS_EXPORT bool hashMapKeySet_remove(hash_map_key_set_pt keySet, const void* key);
 UTILS_EXPORT void hashMapKeySet_clear(hash_map_key_set_pt keySet);
 UTILS_EXPORT bool hashMapKeySet_isEmpty(hash_map_key_set_pt keySet);
 
@@ -72,9 +88,9 @@
 UTILS_EXPORT void hashMapValues_destroy(hash_map_values_pt values);
 UTILS_EXPORT hash_map_iterator_pt hashMapValues_iterator(hash_map_values_pt values);
 UTILS_EXPORT int hashMapValues_size(hash_map_values_pt values);
-UTILS_EXPORT bool hashMapValues_contains(hash_map_values_pt values, void * o);
+UTILS_EXPORT bool hashMapValues_contains(hash_map_values_pt values, const void* o);
 UTILS_EXPORT void hashMapValues_toArray(hash_map_values_pt values, void* *array[], unsigned int *size);
-UTILS_EXPORT bool hashMapValues_remove(hash_map_values_pt values, void * o);
+UTILS_EXPORT bool hashMapValues_remove(hash_map_values_pt values, const void* o);
 UTILS_EXPORT void hashMapValues_clear(hash_map_values_pt values);
 UTILS_EXPORT bool hashMapValues_isEmpty(hash_map_values_pt values);
 
diff --git a/dfi/public/include/memstream/README.md b/utils/public/include/memstream/README.md
similarity index 100%
rename from dfi/public/include/memstream/README.md
rename to utils/public/include/memstream/README.md
diff --git a/dfi/public/include/memstream/fmemopen.h b/utils/public/include/memstream/fmemopen.h
similarity index 100%
rename from dfi/public/include/memstream/fmemopen.h
rename to utils/public/include/memstream/fmemopen.h
diff --git a/dfi/public/include/memstream/open_memstream.h b/utils/public/include/memstream/open_memstream.h
similarity index 100%
rename from dfi/public/include/memstream/open_memstream.h
rename to utils/public/include/memstream/open_memstream.h
diff --git a/utils/public/include/version.h b/utils/public/include/version.h
index 3144740..16f4809 100644
--- a/utils/public/include/version.h
+++ b/utils/public/include/version.h
@@ -93,7 +93,7 @@
  * 		- CELIX_ILLEGAL_ARGUMENT If the numerical components are negative,
  * 		  	the qualifier string is invalid or <code>versionStr</code> is improperly formatted.
  */
-celix_status_t version_createVersionFromString(char * versionStr, version_pt *version);
+celix_status_t version_createVersionFromString(const char * versionStr, version_pt *version);
 
 /**
  * The empty version "0.0.0".
@@ -110,7 +110,7 @@
 celix_status_t version_getMajor(version_pt version, int *major);
 celix_status_t version_getMinor(version_pt version, int *minor);
 celix_status_t version_getMicro(version_pt version, int *micro);
-celix_status_t version_getQualifier(version_pt version, char **qualifier);
+celix_status_t version_getQualifier(version_pt version, const char **qualifier);
 
 /**
  * Compares this <code>Version</code> object to another object.
diff --git a/utils/public/include/version_range.h b/utils/public/include/version_range.h
index bf468a8..e0e80b0 100644
--- a/utils/public/include/version_range.h
+++ b/utils/public/include/version_range.h
@@ -146,7 +146,7 @@
  * 		- CELIX_ILLEGAL_ARGUMENT If the numerical components are negative,
  * 		  	the qualifier string is invalid or <code>versionStr</code> is impropertly formatted.
  */
-celix_status_t versionRange_parse(char * rangeStr, version_range_pt *range);
+celix_status_t versionRange_parse(const char* rangeStr, version_range_pt *range);
 
 /**
  * @}