[SCM] openni-sensor-primesense/master: Revert "Merge tag 'upstream/5.1.2.1'"

jspricke-guest at users.alioth.debian.org jspricke-guest at users.alioth.debian.org
Thu Jun 13 09:31:28 UTC 2013


The following commit has been merged in the master branch:
commit d7894bb5746c79f1d206e3917ae6cd32b8736e2a
Author: Jochen Sprickerhof <jochen at sprickerhof.de>
Date:   Thu Jun 13 10:36:59 2013 +0200

    Revert "Merge tag 'upstream/5.1.2.1'"
    
    This reverts commit 042172f41f2403e8cdabaac80af5ff22e6107ca5, reversing
    changes made to 6d4a27bc2863208c0fd2dd24110dfbed6937a00a.

diff --git a/CHANGES b/CHANGES
index 2a5fb04..8a05479 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,57 +1,6 @@
 Detailed Change log:
 --------------------
 
-Version 5.1.2.1 (Unstable version - May 15th 2012)
---------------------------------------------------
-  * Redist: fix identification of ARM.
-  * Adding support for new command: get usb core type. Also add different USB handling for different cores.
-  * Remove annoying (and misleading) warning messages from the log. 
-  * Starting with firmware 5.7.0 - add the platform string to the firmware version (to support different platforms running the same FW version).
-  * Improved the hardware version information.
-  * Bug Fix: changing resolution might cause a crash when working without a server.
-  * Adding "Lean Init" mode which only gets version (no other FW queries).
-  * Adding -safe option to command console. If applied, lean init is used and chances of failing to open sensor are dramatically reduced.
-  * Bug Fix: If upload file fails, file remains open by process.
-  * Fix printing values during upload.
-  * Starting with 5.6.9 - check if image is supported using fixed params (instead of VSync ugly patch). Also moved fixed params to be part of SensorFirmware class.
-  * BIST: host now always performs soft reset before running BIST.
-  * Allowing AHB operations.
-  * Bug Fix: device is always opened on interface 0 (should be ISO on x86 and BULK on ARM).
-  * Added support to convert the uncompressed bayer image format into RGB24.
-  * Added the 720p & 1280x960 image resolutions in the Xiron.ini and GlobalDefaults.ini files.
-  * Added support for real uncompressed bayer image format.
-  * ARM depth defaults are now QQ and 12-bit.
-  * Allowing an application to provide buffers for map streams (instead of using the shared memory).
-  * Add some logs to the server session.
-  * Audio buffer (shared memory) and indexes are now owned by stream (and not the device).
-  * Workaround a FW bug which returns a preset with FPS 0 (causes DirectShow filter to crash).
-  * Using new data containers (XnListT, XnHashT, XnEventT).
-  * Added new server property: "ServerLogFile" (string) for getting log file name.
-  * Fix some static analysis warnings.
-  * Fix some minor, rare, never-gonna-happen, memory leaks.
-  * Moving "service discovery" into one location - takes place during init (instead of as part of the get version command).
-  * Adding support for FW 5.3.29 (like previous, with the get presets opcode).
-  * Adding a warning log when trying to set a non-supported mode.
-  * Bug Fix: enumerating for image caused soft-reset of the device when server is off. This is problematic if working from different contexts and this device is streaming in another context.
-  * Bug Fix: image resolution possible values were hard-coded, even when taking presets from FW.
-  * Fixed some bugs in the software registration:
-    1) The start/end padding code was removed. It was not really necessary and caused the result to be incorrect.
-    2) In the depth-to-shift table calculation, the distance between the cameras was truncated from bad float/int conversions.
-    3) Removed the code which stops building the registration table if the max Y was reached. The correct solution is not to stop the loop, but to mark the values as invalid.
-    4) Enabled software registration to also work in QVGA 30 mode.
-  * Using USB connection event instead of old single callback.
-  * Bug Fix: corrupt memory if resolution is changed *after* a frame was received but not read by application yet (#1950)
-  * Shifts map is stored as part of the frame.
-  * Added 12-bit depth processor.
-  * Optimizations for Arm Cortex A8 (neon).
-  * Adding interface for general i2c operations.
-  * Update device frequency whenever a stream is opened (frequency might change on setting to specific mode).
-  * Added a property "HostTimestamps" for making the code create timestamps according to host clock and disregard firmware timestamps.
-  * Added support for the Depth at QVGA and IR at VGA mode in FW 5.6 and above.
-  * Added support for QQVGA Depth.
-  * Now, when opening sensor without reset (for enumeration purposes), also not setting interface.
-  * Adding the 'CloseRange' property to the depth stream (supported by FW 5.6)
-
 Version 5.1.0.41 (Stable version - Dec 28th 2011)
 -------------------------------------------------
   * No code changes, build is based on latest OpenNI.	
diff --git a/Data/GlobalDefaults.ini b/Data/GlobalDefaults.ini
index eee0d2c..fcfec6c 100644
--- a/Data/GlobalDefaults.ini
+++ b/Data/GlobalDefaults.ini
@@ -41,9 +41,6 @@ LogWriteToFile=1
 ; Stream Data Timestamps. 0 - milliseconds, 1 - microseconds (default)
 ;HighResTimestamps=1
 
-; Stream Data Timestamps Source. 0 - Firmware (default), 1 - Host
-;HostTimestamps=0
-
 ; A filter for the firmware log. Default is determined by firmware.
 ;FirmwareLogFilter=0
 
@@ -63,13 +60,13 @@ LogWriteToFile=1
 ;UsbInterface=2
 
 [Depth]
-; Output format. 0 - Shift values, 1 - depth values (default)
+; Output format. 0 - Shift values, 1 - 12-bit depth values (default)
 ;OutputFormat=1
 
 ; Is stream mirrored. 0 - Off, 1 - On
 ;Mirror=1
 
-; 0 - QVGA, 1 - VGA, 4 - QQVGA. Default: Arm - 4, other platforms - 0
+; 0 - QVGA (default), 1 - VGA
 ;Resolution=1
 
 ; Frames per second (default is 30)
@@ -81,7 +78,7 @@ LogWriteToFile=1
 ; Max depth cutoff. 0-10000 mm (default is 10000)
 ;MaxDepthValue=10000
 
-; Input format. 0 - Uncompressed 16-bit, 1 - PS Compression, 3 - Packed 11-bit, 4 - Packed 12-bit. Default: Arm - 4, other platforms - 3
+; Input format. 0 - Uncompressed 16-bit, 1 - PS Compression, 3 - Packed 11-bit (default)
 ;InputFormat=1
 
 ; Registration. 0 - Off (default), 1 - On
@@ -99,9 +96,6 @@ LogWriteToFile=1
 ; Gain. 0-50 (0 - Auto, 1 - Min., 50 - Max.). Default value is set by firmware.
 ;Gain=0
 
-; Close Range Mode. 0 - Off (default), 1 - On
-;CloseRange=0
-
 ; GMC Mode. 0 - Off, 1 - On (default)
 ;GMCMode=0
 
@@ -139,7 +133,7 @@ LogWriteToFile=1
 ; Is stream mirrored. 0 - Off, 1 - On
 ;Mirror=1
 
-; 0 - QVGA (default), 1 - VGA, 2 - SXGA (1.3MP), 3 - UXGA (2.0MP), 14 - 720p, 15 - 1280x960
+; 0 - QVGA (default), 1 - VGA, 2- SXGA (1.3MP) 3 - UXGA (2.0MP)
 ;Resolution=1
 
 ; Frames per second (default is 30)
diff --git a/GPL.txt b/GPL.txt
index 94a9ed0..818433e 100644
--- a/GPL.txt
+++ b/GPL.txt
@@ -1,674 +1,674 @@
-                    GNU GENERAL PUBLIC LICENSE
-                       Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-                            Preamble
-
-  The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
-  The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works.  By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users.  We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors.  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
-  To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights.  Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received.  You must make sure that they, too, receive
-or can get the source code.  And you must show them these terms so they
-know their rights.
-
-  Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
-  For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software.  For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
-  Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so.  This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software.  The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable.  Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products.  If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
-  Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary.  To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-                       TERMS AND CONDITIONS
-
-  0. Definitions.
-
-  "This License" refers to version 3 of the GNU General Public License.
-
-  "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
-  "The Program" refers to any copyrightable work licensed under this
-License.  Each licensee is addressed as "you".  "Licensees" and
-"recipients" may be individuals or organizations.
-
-  To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy.  The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
-  A "covered work" means either the unmodified Program or a work based
-on the Program.
-
-  To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy.  Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
-  To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies.  Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
-  An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License.  If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
-  1. Source Code.
-
-  The "source code" for a work means the preferred form of the work
-for making modifications to it.  "Object code" means any non-source
-form of a work.
-
-  A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
-  The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form.  A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
-  The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities.  However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work.  For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
-  The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
-  The Corresponding Source for a work in source code form is that
-same work.
-
-  2. Basic Permissions.
-
-  All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met.  This License explicitly affirms your unlimited
-permission to run the unmodified Program.  The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work.  This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
-  You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force.  You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright.  Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
-  Conveying under any other circumstances is permitted solely under
-the conditions stated below.  Sublicensing is not allowed; section 10
-makes it unnecessary.
-
-  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
-  No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
-  When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
-  4. Conveying Verbatim Copies.
-
-  You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
-  You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
-  5. Conveying Modified Source Versions.
-
-  You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
-    a) The work must carry prominent notices stating that you modified
-    it, and giving a relevant date.
-
-    b) The work must carry prominent notices stating that it is
-    released under this License and any conditions added under section
-    7.  This requirement modifies the requirement in section 4 to
-    "keep intact all notices".
-
-    c) You must license the entire work, as a whole, under this
-    License to anyone who comes into possession of a copy.  This
-    License will therefore apply, along with any applicable section 7
-    additional terms, to the whole of the work, and all its parts,
-    regardless of how they are packaged.  This License gives no
-    permission to license the work in any other way, but it does not
-    invalidate such permission if you have separately received it.
-
-    d) If the work has interactive user interfaces, each must display
-    Appropriate Legal Notices; however, if the Program has interactive
-    interfaces that do not display Appropriate Legal Notices, your
-    work need not make them do so.
-
-  A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit.  Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
-  6. Conveying Non-Source Forms.
-
-  You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
-    a) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by the
-    Corresponding Source fixed on a durable physical medium
-    customarily used for software interchange.
-
-    b) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by a
-    written offer, valid for at least three years and valid for as
-    long as you offer spare parts or customer support for that product
-    model, to give anyone who possesses the object code either (1) a
-    copy of the Corresponding Source for all the software in the
-    product that is covered by this License, on a durable physical
-    medium customarily used for software interchange, for a price no
-    more than your reasonable cost of physically performing this
-    conveying of source, or (2) access to copy the
-    Corresponding Source from a network server at no charge.
-
-    c) Convey individual copies of the object code with a copy of the
-    written offer to provide the Corresponding Source.  This
-    alternative is allowed only occasionally and noncommercially, and
-    only if you received the object code with such an offer, in accord
-    with subsection 6b.
-
-    d) Convey the object code by offering access from a designated
-    place (gratis or for a charge), and offer equivalent access to the
-    Corresponding Source in the same way through the same place at no
-    further charge.  You need not require recipients to copy the
-    Corresponding Source along with the object code.  If the place to
-    copy the object code is a network server, the Corresponding Source
-    may be on a different server (operated by you or a third party)
-    that supports equivalent copying facilities, provided you maintain
-    clear directions next to the object code saying where to find the
-    Corresponding Source.  Regardless of what server hosts the
-    Corresponding Source, you remain obligated to ensure that it is
-    available for as long as needed to satisfy these requirements.
-
-    e) Convey the object code using peer-to-peer transmission, provided
-    you inform other peers where the object code and Corresponding
-    Source of the work are being offered to the general public at no
-    charge under subsection 6d.
-
-  A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
-  A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling.  In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage.  For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product.  A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
-  "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source.  The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
-  If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information.  But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
-  The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed.  Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
-  Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
-  7. Additional Terms.
-
-  "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law.  If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
-  When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it.  (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.)  You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
-  Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
-    a) Disclaiming warranty or limiting liability differently from the
-    terms of sections 15 and 16 of this License; or
-
-    b) Requiring preservation of specified reasonable legal notices or
-    author attributions in that material or in the Appropriate Legal
-    Notices displayed by works containing it; or
-
-    c) Prohibiting misrepresentation of the origin of that material, or
-    requiring that modified versions of such material be marked in
-    reasonable ways as different from the original version; or
-
-    d) Limiting the use for publicity purposes of names of licensors or
-    authors of the material; or
-
-    e) Declining to grant rights under trademark law for use of some
-    trade names, trademarks, or service marks; or
-
-    f) Requiring indemnification of licensors and authors of that
-    material by anyone who conveys the material (or modified versions of
-    it) with contractual assumptions of liability to the recipient, for
-    any liability that these contractual assumptions directly impose on
-    those licensors and authors.
-
-  All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10.  If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term.  If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
-  If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
-  Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
-  8. Termination.
-
-  You may not propagate or modify a covered work except as expressly
-provided under this License.  Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
-  However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
-  Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
-  Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License.  If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
-  9. Acceptance Not Required for Having Copies.
-
-  You are not required to accept this License in order to receive or
-run a copy of the Program.  Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance.  However,
-nothing other than this License grants you permission to propagate or
-modify any covered work.  These actions infringe copyright if you do
-not accept this License.  Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
-  10. Automatic Licensing of Downstream Recipients.
-
-  Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License.  You are not responsible
-for enforcing compliance by third parties with this License.
-
-  An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations.  If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
-  You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License.  For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
-  11. Patents.
-
-  A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based.  The
-work thus licensed is called the contributor's "contributor version".
-
-  A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version.  For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
-  Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
-  In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement).  To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
-  If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients.  "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
-  If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
-  A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License.  You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
-  Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
-  12. No Surrender of Others' Freedom.
-
-  If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all.  For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
-  13. Use with the GNU Affero General Public License.
-
-  Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work.  The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
-  14. Revised Versions of this License.
-
-  The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-  Each version is given a distinguishing version number.  If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation.  If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
-  If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
-  Later license versions may give you additional or different
-permissions.  However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
-  15. Disclaimer of Warranty.
-
-  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-  16. Limitation of Liability.
-
-  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
-  17. Interpretation of Sections 15 and 16.
-
-  If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
-                     END OF TERMS AND CONDITIONS
-
-            How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This program is free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-Also add information on how to contact you by electronic and paper mail.
-
-  If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
-    <program>  Copyright (C) <year>  <name of author>
-    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
-  You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-<http://www.gnu.org/licenses/>.
-
-  The GNU General Public License does not permit incorporating your program
-into proprietary programs.  If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library.  If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.  But first, please read
-<http://www.gnu.org/philosophy/why-not-lgpl.html>.
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Use with the GNU Affero General Public License.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+    <program>  Copyright (C) <year>  <name of author>
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+  The GNU General Public License does not permit incorporating your program
+into proprietary programs.  If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.  But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/Include/XnDevice.h b/Include/XnDevice.h
index 70b00e7..e5400e5 100644
--- a/Include/XnDevice.h
+++ b/Include/XnDevice.h
@@ -96,22 +96,9 @@ typedef enum XnStreamsChangeEventType
 	XN_DEVICE_STREAM_DELETED,
 } XnStreamsChangeEventType;
 
-typedef struct XnStreamCollectionChangedEventArgs
-{
-	XnDeviceHandle deviceHandle; 
-	const XnChar* strStreamName; 
-	XnStreamsChangeEventType eventType;
-} XnStreamCollectionChangedEventArgs;
-
-typedef struct XnNewStreamDataEventArgs
-{
-	XnDeviceHandle deviceHandle;
-	const XnChar* strStreamName;
-} XnNewStreamDataEventArgs;
-
-typedef void (XN_CALLBACK_TYPE* XnDeviceOnStreamsChangedEventHandler)(const XnStreamCollectionChangedEventArgs& args, void* pCookie);
+typedef void (XN_CALLBACK_TYPE* XnDeviceOnStreamsChangedEventHandler)(XnDeviceHandle pDeviceHandle, const XnChar* StreamName, XnStreamsChangeEventType EventType, void* pCookie);
 typedef void (XN_CALLBACK_TYPE* XnDeviceOnPropertyChangedEventHandler)(XnDeviceHandle pDeviceHandle, const XnChar* ModuleName, const XnChar* PropertyName, void* pCookie);
-typedef void (XN_CALLBACK_TYPE* XnDeviceOnNewStreamDataEventHandler)(const XnNewStreamDataEventArgs& args, void* pCookie);
+typedef void (XN_CALLBACK_TYPE* XnDeviceOnNewStreamDataEventHandler)(XnDeviceHandle pDeviceHandle, const XnChar* StreamName, void* pCookie);
 
 //---------------------------------------------------------------------------
 // Exported Functions Declaration. Every Device Must Implement Them All!
diff --git a/Include/XnDeviceProto.inl b/Include/XnDeviceProto.inl
index fc3dd93..ebb23dd 100644
--- a/Include/XnDeviceProto.inl
+++ b/Include/XnDeviceProto.inl
@@ -130,9 +130,9 @@ XN_DEVICE_INTERFACE_FUNCTION(DoesModuleExist,(const XnDeviceHandle DeviceHandle,
 * @param	DeviceHandle	[in]	The requested device handle.
 * @param	Handler			[in]	A pointer to the function that will handle the event.
 * @param	pCookie			[in]	User cookie that will be passed as an argument to the event handler.
-* @param	hCallback		[out]	A handle for unregister.
+* @param	phCallback		[out]	A handle for unregister.
 */
-XN_DEVICE_INTERFACE_FUNCTION(RegisterToStreamsChange,(const XnDeviceHandle DeviceHandle, XnDeviceOnStreamsChangedEventHandler Handler, void* pCookie, XnCallbackHandle& hCallback))
+XN_DEVICE_INTERFACE_FUNCTION(RegisterToStreamsChange,(const XnDeviceHandle DeviceHandle, XnDeviceOnStreamsChangedEventHandler Handler, void* pCookie, XnCallbackHandle* phCallback))
 
 /**
 * Unregisters from the event of streams change (stream created / destroyed)
@@ -165,9 +165,9 @@ XN_DEVICE_INTERFACE_FUNCTION(DestroyStreamData,(XnStreamData** ppStreamData))
 * @param	DeviceHandle	[in]	The requested device handle.
 * @param	Handler			[in]	A pointer to the function that will handle the event.
 * @param	pCookie			[in]	User cookie that will be passed as an argument to the event handler.
-* @param	hCallback		[out]	A handle for unregister.
+* @param	phCallback		[out]	A handle for unregister.
 */
-XN_DEVICE_INTERFACE_FUNCTION(RegisterToNewStreamData,(const XnDeviceHandle DeviceHandle, XnDeviceOnNewStreamDataEventHandler Handler, void* pCookie, XnCallbackHandle& hCallback))
+XN_DEVICE_INTERFACE_FUNCTION(RegisterToNewStreamData,(const XnDeviceHandle DeviceHandle, XnDeviceOnNewStreamDataEventHandler Handler, void* pCookie, XnCallbackHandle* phCallback))
 
 /**
 * Unregisters from the event of new data from a stream.
@@ -385,9 +385,9 @@ XN_DEVICE_INTERFACE_FUNCTION(GetAllProperties,(const XnDeviceHandle DeviceHandle
 * @param	PropertyName	[in]	Name of the property to register to.
 * @param	Handler			[in]	A pointer to the function that will handle the event.
 * @param	pCookie			[in]	User cookie that will be passed as an argument to the event handler.
-* @param	hCallback		[out]	A handle for unregister.
+* @param	phCallback		[out]	A handle for unregister.
 */
-XN_DEVICE_INTERFACE_FUNCTION(RegisterToPropertyChange,(const XnDeviceHandle DeviceHandle, const XnChar* Module, const XnChar* PropertyName, XnDeviceOnPropertyChangedEventHandler Handler, void* pCookie, XnCallbackHandle& hCallback))
+XN_DEVICE_INTERFACE_FUNCTION(RegisterToPropertyChange,(const XnDeviceHandle DeviceHandle, const XnChar* Module, const XnChar* PropertyName, XnDeviceOnPropertyChangedEventHandler Handler, void* pCookie, XnCallbackHandle* phCallback))
 
 /**
 * Unregisters an event handler from the Property Changed event.
diff --git a/Include/XnEE/XnVDevice.h b/Include/XnEE/XnVDevice.h
index 236fe50..b18b333 100644
--- a/Include/XnEE/XnVDevice.h
+++ b/Include/XnEE/XnVDevice.h
@@ -294,9 +294,9 @@ public:
 
 	XnStatus FindStreamOfType(const XnChar* strType, XnVStream& stream);
 
-	XnStatus RegisterForPropertyChangedEvent(const XnChar* strModule, const XnChar* strProperty, XnVModulePropertyChangedHandler* pHandler, XnCallbackHandle& hCallback);
-	XnStatus RegisterForNewDataFromStreamEvent(XnVNewDataFromStreamHandler* pHandler, XnCallbackHandle& hCallback);
-	XnStatus RegisterForStreamCollectionChangedEvent(XnVStreamCollectionChangedHandler* pHandler, XnCallbackHandle& hCallback);
+	XnStatus RegisterForPropertyChangedEvent(const XnChar* strModule, const XnChar* strProperty, XnVModulePropertyChangedHandler* pHandler, XnCallbackHandle* phCallback);
+	XnStatus RegisterForNewDataFromStreamEvent(XnVNewDataFromStreamHandler* pHandler, XnCallbackHandle* phCallback);
+	XnStatus RegisterForStreamCollectionChangedEvent(XnVStreamCollectionChangedHandler* pHandler, XnCallbackHandle* phCallback);
 
 	XnStatus UnregisterFromPropertyChangedEvent(const XnChar* strModule, const XnChar* strProperty, XnCallbackHandle hCallback);
 	XnStatus UnregisterFromNewDataFromStreamEvent(XnCallbackHandle hCallback);
@@ -456,9 +456,9 @@ private:
 
 	static XnBool IsXnVDeviceStreamProp(const XnChar* strProperty);
 
-	static void XN_CALLBACK_TYPE OnStreamsChangedCallback(const XnStreamCollectionChangedEventArgs& args, void* pCookie);
+	static void XN_CALLBACK_TYPE OnStreamsChangedCallback(XnDeviceHandle pDeviceHandle, const XnChar* StreamName, XnStreamsChangeEventType EventType, void* pCookie);
 	static void XN_CALLBACK_TYPE OnPropertyChangedCallback(XnDeviceHandle pDeviceHandle, const XnChar* ModuleName, const XnChar* PropertyName, void* pCookie);
-	static void XN_CALLBACK_TYPE OnNewStreamDataCallback(const XnNewStreamDataEventArgs& args, void* pCookie);
+	static void XN_CALLBACK_TYPE OnNewStreamDataCallback(XnDeviceHandle pDeviceHandle, const XnChar* StreamName, void* pCookie);
 	static XnStatus XN_CALLBACK_TYPE OnXnVDevicePropertyChanged(const XnProperty* pSender, void* pCookie);
 
 	XnDeviceHandle m_DeviceHandle;
@@ -686,7 +686,7 @@ private:
 	XN_3_6_API XnStatus InitS2DTables36() const;
 	XN_3_6_API XnStatus GetProperty36(const XnChar* strModule, const XnChar* strProperty, XnDouble& fValue) const;
 	static void XN_CALLBACK_TYPE OnS2DTableChanged36(XnDeviceHandle pDeviceHandle, const XnChar* ModuleName, const XnChar* PropertyName, void* pCookie);
-	static void XN_CALLBACK_TYPE OnNewStreamDataCallback36(const XnNewStreamDataEventArgs& args, void* pCookie);
+	static void XN_CALLBACK_TYPE OnNewStreamDataCallback36(XnDeviceHandle pDeviceHandle, const XnChar* StreamName, void* pCookie);
 };
 
 #pragma warning (pop)
diff --git a/Include/XnEE/XnVModule.h b/Include/XnEE/XnVModule.h
index 02472ff..93a37d4 100644
--- a/Include/XnEE/XnVModule.h
+++ b/Include/XnEE/XnVModule.h
@@ -97,7 +97,7 @@ public:
 	XnStatus SetProperty(const XnChar* strProperty, const XnChar* strValue);
 	XnStatus SetProperty(const XnChar* strProperty, const XnGeneralBuffer& gbValue);
 
-	XnStatus RegisterForPropertyChangedEvent(const XnChar* strProperty, XnVModulePropertyChangedHandler* pHandler, XnCallbackHandle& hCallback);
+	XnStatus RegisterForPropertyChangedEvent(const XnChar* strProperty, XnVModulePropertyChangedHandler* pHandler, XnCallbackHandle* phCallback);
 	XnStatus UnregisterFromPropertyChangedEvent(const XnChar* strProperty, XnCallbackHandle hCallback);
 
 	XN_3_6_API XnStatus GetProperty(const XnChar* strProperty, XnUInt8& nValue) const;
diff --git a/Include/XnEE/XnVStreamContainer.h b/Include/XnEE/XnVStreamContainer.h
index fc0ba86..bb77ab9 100644
--- a/Include/XnEE/XnVStreamContainer.h
+++ b/Include/XnEE/XnVStreamContainer.h
@@ -60,8 +60,8 @@ public:
 	virtual XnStatus SetProperty(const XnChar* strModule, const XnChar* strProperty, const XnChar* csValue) = 0;
 	virtual XnStatus SetProperty(const XnChar* strModule, const XnChar* strProperty, const XnGeneralBuffer& gbValue) = 0;
 
-	virtual XnStatus RegisterForPropertyChangedEvent(const XnChar* strModule, const XnChar* strProperty, XnVModulePropertyChangedHandler* pHandler, XnCallbackHandle& hCallback) = 0;
-	virtual XnStatus RegisterForStreamCollectionChangedEvent(XnVStreamCollectionChangedHandler* pHandler, XnCallbackHandle& hCallback) = 0;
+	virtual XnStatus RegisterForPropertyChangedEvent(const XnChar* strModule, const XnChar* strProperty, XnVModulePropertyChangedHandler* pHandler, XnCallbackHandle* phCallback) = 0;
+	virtual XnStatus RegisterForStreamCollectionChangedEvent(XnVStreamCollectionChangedHandler* pHandler, XnCallbackHandle* phCallback) = 0;
 	virtual XnStatus UnregisterFromPropertyChangedEvent(const XnChar* strModule, const XnChar* strProperty, XnCallbackHandle hCallback) = 0;
 	virtual XnStatus UnregisterFromStreamCollectionChangedEvent(XnCallbackHandle hCallback) = 0;
 
diff --git a/Include/XnEE/XnVStreamData.h b/Include/XnEE/XnVStreamData.h
index d09f176..2f547d9 100644
--- a/Include/XnEE/XnVStreamData.h
+++ b/Include/XnEE/XnVStreamData.h
@@ -27,7 +27,7 @@
 //---------------------------------------------------------------------------
 #include "XnVEventHandlers.h"
 #include "XnVStream.h"
-#include <XnListT.h>
+#include <XnList.h>
 
 //---------------------------------------------------------------------------
 // Types
@@ -82,7 +82,7 @@ private:
 		XnCallbackHandle hCallback;
 	} XnWatchedProperty;
 
-	typedef XnListT<XnWatchedProperty> XnWatchedPropertiesList;
+	XN_DECLARE_LIST_DECL(XN_EE_CORE_API, XnWatchedProperty, XnWatchedPropertiesList)
 
 	XnBool m_bIsLive;
 	XnBool m_bWaitForDataUpdate;
diff --git a/Include/XnPsVersion.h b/Include/XnPsVersion.h
index ba3e2c8..223375c 100644
--- a/Include/XnPsVersion.h
+++ b/Include/XnPsVersion.h
@@ -35,9 +35,9 @@
 /** Xiron minor version. */ 
 #define XN_PS_MINOR_VERSION 1
 /** Xiron maintenance version. */ 
-#define XN_PS_MAINTENANCE_VERSION 2
+#define XN_PS_MAINTENANCE_VERSION 0
 /** Xiron build version. */ 
-#define XN_PS_BUILD_VERSION 1
+#define XN_PS_BUILD_VERSION 41
 
 /** Xiron version (in brief string format): "Major.Minor.Maintenance (Build)" */ 
 #define XN_PS_BRIEF_VERSION_STRING \
diff --git a/Include/XnStreamParams.h b/Include/XnStreamParams.h
index 218aafc..9647fec 100644
--- a/Include/XnStreamParams.h
+++ b/Include/XnStreamParams.h
@@ -117,8 +117,6 @@
 #define XN_STREAM_PROPERTY_INPUT_FORMAT				"InputFormat"
 /** XnDynamicSizeBuffer */
 #define XN_STREAM_PROPERTY_LAST_RAW_FRAME			"LastRawFrame"
-/** XnGeneralBuffer array */
-#define XN_STREAM_PROPERTY_EXTERNAL_BUFFER_POOL		"ExternalBufferPool"
 
 //---------------------------------------------------------------------------
 // Pixel-Based Stream Properties (Depth, Image, IR)
@@ -188,10 +186,6 @@
 #define XN_STREAM_PROPERTY_DCMOS_RCMOS_DISTANCE		"DCRCDIS"
 /** Boolean */
 #define XN_STREAM_PROPERTY_GMC_MODE					"GmcMode"
-/** Boolean */
-#define XN_STREAM_PROPERTY_CLOSE_RANGE				"CloseRange"
-/** XnUInt16* (general) */
-#define XN_STREAM_PROPERTY_SHIFTS_MAP				"ShiftsMap"
 
 //---------------------------------------------------------------------------
 // Shifts Properties (up to v3.6)
@@ -306,8 +300,6 @@
 #define XN_MODULE_PROPERTY_READ_ENDPOINT_3			"ReadEndpoint3"
 /** Boolean */
 #define XN_MODULE_PROPERTY_RESET_SENSOR_ON_STARTUP	"ResetSensorOnStartup"
-/** Boolean */
-#define XN_MODULE_PROPERTY_LEAN_INIT				"LeanInit"
 /** String */
 #define XN_MODULE_PROPERTY_ID						"ID"
 /** String */ 
@@ -341,15 +333,11 @@
 /** Boolean */
 #define XN_MODULE_PROPERTY_HIGH_RES_TIMESTAMPS		"HighResTimestamps"
 /** Boolean */
-#define XN_MODULE_PROPERTY_HOST_TIMESTAMPS			"HostTimestamps"
-/** Boolean */
 #define XN_MODULE_PROPERTY_CLOSE_STREAMS_ON_SHUTDOWN	"CloseStreamsOnShutdown"
 /** Integer */
 #define XN_MODULE_PROPERTY_SERVER_NO_CLIENTS_TIMEOUT	"ServerNoClientsTimeout"
 /** Integer */
 #define XN_MODULE_PROPERTY_SERVER_START_NEW_LOG_FILE	"ServerStartNewLogFile"
-/** String */
-#define XN_MODULE_PROPERTY_SERVER_LOG_FILE			"ServerLogFile"
 /** Integer */
 #define XN_MODULE_PROPERTY_ERROR_STATE				"ErrorState"
 /** Boolean */
@@ -360,15 +348,8 @@
 #define XN_MODULE_PROPERTY_PHYSICAL_DEVICE_NAME		"PhysicalDeviceName"
 /** String */
 #define XN_MODULE_PROPERTY_VENDOR_SPECIFIC_DATA		"VendorSpecificData"
-/** String */
-#define XN_MODULE_PROPERTY_SENSOR_PLATFORM_STRING	"SensorPlatformString"
 /** Boolean */
 #define XN_MODULE_PROPERTY_AUDIO_SUPPORTED			"AudioSupported"
-/** Boolean */
-#define XN_MODULE_PROPERTY_IMAGE_SUPPORTED			"ImageSupported"
-#define XN_MODULE_PROPERTY_IMAGE_CONTROL			"ImageControl"
-#define XN_MODULE_PROPERTY_DEPTH_CONTROL			"DepthControl"
-#define XN_MODULE_PROPERTY_AHB						"AHB"
 
 
 //---------------------------------------------------------------------------
@@ -390,7 +371,6 @@
 #define XN_UXGA_X_RES	1600
 #define XN_UXGA_Y_RES	1200
 
-#define XN_IO_MAX_I2C_BUFFER_SIZE 10
 
 //---------------------------------------------------------------------------
 // Enums - values of various properties
@@ -431,7 +411,6 @@ typedef enum
 	XN_SENSOR_FW_VER_5_4 = 10,
 	XN_SENSOR_FW_VER_5_5 = 11,
 	XN_SENSOR_FW_VER_5_6 = 12,
-	XN_SENSOR_FW_VER_5_7 = 13,
 } XnFWVer;
 
 typedef enum
@@ -454,16 +433,13 @@ typedef enum {
 	XN_SENSOR_HW_VER_FPDB_10 = 1,
 	XN_SENSOR_HW_VER_CDB_10  = 2,
 	XN_SENSOR_HW_VER_RD_3  = 3,
-	XN_SENSOR_HW_VER_RD_5  = 4,
-	XN_SENSOR_HW_VER_RD1081  = 5,
-	XN_SENSOR_HW_VER_RD1082  = 6
+	XN_SENSOR_HW_VER_RD_5  = 4
 } XnHWVer;
 
 typedef enum {
 	XN_SENSOR_CHIP_VER_UNKNOWN = 0,
 	XN_SENSOR_CHIP_VER_PS1000 = 1,
-	XN_SENSOR_CHIP_VER_PS1080 = 2,
-	XN_SENSOR_CHIP_VER_PS1080A6 = 3
+	XN_SENSOR_CHIP_VER_PS1080 = 2
 } XnChipVer;
 
 typedef enum
@@ -602,37 +578,6 @@ typedef struct XnCmosPreset
 	XnUInt16 nFPS;
 } XnCmosPreset;
 
-typedef struct XnI2CWriteData
-{
-	XnUInt16 nBus;
-	XnUInt16 nSlaveAddress;
-	XnUInt16 cpWriteBuffer[XN_IO_MAX_I2C_BUFFER_SIZE];
-	XnUInt16 nWriteSize;
-} XnI2CWriteData;
-
-typedef struct XnI2CReadData
-{
-	XnUInt16 nBus;
-	XnUInt16 nSlaveAddress;
-	XnUInt16 cpReadBuffer[XN_IO_MAX_I2C_BUFFER_SIZE];
-	XnUInt16 cpWriteBuffer[XN_IO_MAX_I2C_BUFFER_SIZE];
-	XnUInt16 nReadSize;
-	XnUInt16 nWriteSize;
-} XnI2CReadData;
-
-typedef struct XnControlProcessingData
-{
-	XnUInt16 nRegister;
-	XnUInt16 nValue;
-} XnControlProcessingData;
-
-typedef struct
-{
-	XnUInt32 nRegister;
-	XnUInt32 nValue;
-	XnUInt32 nMask;
-} XnAHBData;
-
 
 #pragma pack (pop)
 
diff --git a/LGPL.txt b/LGPL.txt
index 65c5ca8..b14ca0a 100644
--- a/LGPL.txt
+++ b/LGPL.txt
@@ -1,165 +1,165 @@
-                   GNU LESSER GENERAL PUBLIC LICENSE
-                       Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
-  This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
-  0. Additional Definitions.
-
-  As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
-  "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
-  An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
-  A "Combined Work" is a work produced by combining or linking an
-Application with the Library.  The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
-  The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
-  The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
-  1. Exception to Section 3 of the GNU GPL.
-
-  You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
-  2. Conveying Modified Versions.
-
-  If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
-   a) under this License, provided that you make a good faith effort to
-   ensure that, in the event an Application does not supply the
-   function or data, the facility still operates, and performs
-   whatever part of its purpose remains meaningful, or
-
-   b) under the GNU GPL, with none of the additional permissions of
-   this License applicable to that copy.
-
-  3. Object Code Incorporating Material from Library Header Files.
-
-  The object code form of an Application may incorporate material from
-a header file that is part of the Library.  You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
-   a) Give prominent notice with each copy of the object code that the
-   Library is used in it and that the Library and its use are
-   covered by this License.
-
-   b) Accompany the object code with a copy of the GNU GPL and this license
-   document.
-
-  4. Combined Works.
-
-  You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
-   a) Give prominent notice with each copy of the Combined Work that
-   the Library is used in it and that the Library and its use are
-   covered by this License.
-
-   b) Accompany the Combined Work with a copy of the GNU GPL and this license
-   document.
-
-   c) For a Combined Work that displays copyright notices during
-   execution, include the copyright notice for the Library among
-   these notices, as well as a reference directing the user to the
-   copies of the GNU GPL and this license document.
-
-   d) Do one of the following:
-
-       0) Convey the Minimal Corresponding Source under the terms of this
-       License, and the Corresponding Application Code in a form
-       suitable for, and under terms that permit, the user to
-       recombine or relink the Application with a modified version of
-       the Linked Version to produce a modified Combined Work, in the
-       manner specified by section 6 of the GNU GPL for conveying
-       Corresponding Source.
-
-       1) Use a suitable shared library mechanism for linking with the
-       Library.  A suitable mechanism is one that (a) uses at run time
-       a copy of the Library already present on the user's computer
-       system, and (b) will operate properly with a modified version
-       of the Library that is interface-compatible with the Linked
-       Version.
-
-   e) Provide Installation Information, but only if you would otherwise
-   be required to provide such information under section 6 of the
-   GNU GPL, and only to the extent that such information is
-   necessary to install and execute a modified version of the
-   Combined Work produced by recombining or relinking the
-   Application with a modified version of the Linked Version. (If
-   you use option 4d0, the Installation Information must accompany
-   the Minimal Corresponding Source and Corresponding Application
-   Code. If you use option 4d1, you must provide the Installation
-   Information in the manner specified by section 6 of the GNU GPL
-   for conveying Corresponding Source.)
-
-  5. Combined Libraries.
-
-  You may place library facilities that are a work based on the
-Library side by side in a single library together with other library
-facilities that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
-   a) Accompany the combined library with a copy of the same work based
-   on the Library, uncombined with any other library facilities,
-   conveyed under the terms of this License.
-
-   b) Give prominent notice with the combined library that part of it
-   is a work based on the Library, and explaining where to find the
-   accompanying uncombined form of the same work.
-
-  6. Revised Versions of the GNU Lesser General Public License.
-
-  The Free Software Foundation may publish revised and/or new versions
-of the GNU Lesser General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
-  Each version is given a distinguishing version number. If the
-Library as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
-  If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
-Library.
+                   GNU LESSER GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+  This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+  0. Additional Definitions.
+
+  As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+  "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+  An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+  A "Combined Work" is a work produced by combining or linking an
+Application with the Library.  The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+  The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+  The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+  1. Exception to Section 3 of the GNU GPL.
+
+  You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+  2. Conveying Modified Versions.
+
+  If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+   a) under this License, provided that you make a good faith effort to
+   ensure that, in the event an Application does not supply the
+   function or data, the facility still operates, and performs
+   whatever part of its purpose remains meaningful, or
+
+   b) under the GNU GPL, with none of the additional permissions of
+   this License applicable to that copy.
+
+  3. Object Code Incorporating Material from Library Header Files.
+
+  The object code form of an Application may incorporate material from
+a header file that is part of the Library.  You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+   a) Give prominent notice with each copy of the object code that the
+   Library is used in it and that the Library and its use are
+   covered by this License.
+
+   b) Accompany the object code with a copy of the GNU GPL and this license
+   document.
+
+  4. Combined Works.
+
+  You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+   a) Give prominent notice with each copy of the Combined Work that
+   the Library is used in it and that the Library and its use are
+   covered by this License.
+
+   b) Accompany the Combined Work with a copy of the GNU GPL and this license
+   document.
+
+   c) For a Combined Work that displays copyright notices during
+   execution, include the copyright notice for the Library among
+   these notices, as well as a reference directing the user to the
+   copies of the GNU GPL and this license document.
+
+   d) Do one of the following:
+
+       0) Convey the Minimal Corresponding Source under the terms of this
+       License, and the Corresponding Application Code in a form
+       suitable for, and under terms that permit, the user to
+       recombine or relink the Application with a modified version of
+       the Linked Version to produce a modified Combined Work, in the
+       manner specified by section 6 of the GNU GPL for conveying
+       Corresponding Source.
+
+       1) Use a suitable shared library mechanism for linking with the
+       Library.  A suitable mechanism is one that (a) uses at run time
+       a copy of the Library already present on the user's computer
+       system, and (b) will operate properly with a modified version
+       of the Library that is interface-compatible with the Linked
+       Version.
+
+   e) Provide Installation Information, but only if you would otherwise
+   be required to provide such information under section 6 of the
+   GNU GPL, and only to the extent that such information is
+   necessary to install and execute a modified version of the
+   Combined Work produced by recombining or relinking the
+   Application with a modified version of the Linked Version. (If
+   you use option 4d0, the Installation Information must accompany
+   the Minimal Corresponding Source and Corresponding Application
+   Code. If you use option 4d1, you must provide the Installation
+   Information in the manner specified by section 6 of the GNU GPL
+   for conveying Corresponding Source.)
+
+  5. Combined Libraries.
+
+  You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+   a) Accompany the combined library with a copy of the same work based
+   on the Library, uncombined with any other library facilities,
+   conveyed under the terms of this License.
+
+   b) Give prominent notice with the combined library that part of it
+   is a work based on the Library, and explaining where to find the
+   accompanying uncombined form of the same work.
+
+  6. Revised Versions of the GNU Lesser General Public License.
+
+  The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+  Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+  If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
diff --git a/PSCommon/Platform/Win32/CreateRedist/CopyToRepository.py b/PSCommon/Platform/Win32/CreateRedist/CopyToRepository.py
deleted file mode 100644
index 2c39d0d..0000000
--- a/PSCommon/Platform/Win32/CreateRedist/CopyToRepository.py
+++ /dev/null
@@ -1,78 +0,0 @@
-import os
-import sys
-import re
-import time
-import traceback
-
-packageFullPath = "..\..\..\..\..\PrimeSenseVersions.nsh"
-
-def find_package_number(findStr, text):
-    for line in text:
-        temp = re.search(findStr, line)
-        if temp != None:
-            packageNumber = temp.group(1)
-            return packageNumber
-
-def copy_files_to_repository(SourcePath,RepositoryPath, BuildDate, PackageVersion, Bits, ProjectName,
-                             Major_version, Minor_version, Maintenance_version, Build_version):
-    fullVersion = Major_version + "." + Minor_version + "." + Maintenance_version + "." + Build_version
-    destPath = os.path.join(RepositoryPath, BuildDate + "__" + PackageVersion, "Win" + Bits,
-                            ProjectName + "-" + fullVersion)
-    os.system("rmdir /S /q " + destPath)
-    os.system("mkdir " + destPath)
-    os.system("xcopy /E /I " + SourcePath + " " + destPath)
-
-def copy_zip_to_repository(SourcePath,RepositoryPath, BuildDate, PackageVersion, Bits, ProjectName,
-                             Major_version, Minor_version, Maintenance_version, Build_version):
-    fullVersion = Major_version + "." + Minor_version + "." + Maintenance_version + "." + Build_version
-    destPath = os.path.join(RepositoryPath, BuildDate + "__" + PackageVersion, "Win" + Bits,
-                            ProjectName + "-" + fullVersion)
-    os.system("rmdir /S /q " + destPath)
-    os.system("mkdir " + destPath)
-    os.system("xcopy /I " + SourcePath + " " + destPath)
-
-def open_package_file(path):
-    files = open(path).readlines()
-    packageNumber = find_package_number("!define PACKAGE_VER\s+\"(\S+)\"", files)
-    return packageNumber
-
-if __name__ == "__main__":
-    try:
-        if len(sys.argv) != 10:
-            print (("Usage: copyToRepository.py <FinalPath> <RepositoryPath> <BuildDate> <bits> " \
-            + "<ProjectName> <Major_version> <Minor_version> <Maintenance_version> <Build_version>"))
-            sys.exit(1)
-
-        finalPath = sys.argv[1]
-        repositoryPath = sys.argv[2]
-        buildDate = sys.argv[3]
-        bits = sys.argv[4]
-        projectName = sys.argv[5]
-        major_version = sys.argv[6]
-        minor_version = sys.argv[7]
-        maintenance_version = sys.argv[8]
-        build_version = sys.argv[9]
-
-        packageNumber = ''
-        if not(os.path.exists(packageFullPath)):
-            # Redist of OpenNI openSource
-            packageFullPath = "..\..\..\..\..\..\PrimeSenseVersions.nsh"
-            packageNumber = open_package_file(packageFullPath)
-            if packageNumber == '':
-                sys.exit(1)
-            copy_zip_to_repository("..\..\..\..\*.zip",repositoryPath, buildDate, packageNumber, bits,
-                                 projectName, major_version, minor_version, maintenance_version, build_version)
-        else:
-            # Redist of OpenNI
-            packageNumber = open_package_file(packageFullPath)
-            if packageNumber == '':
-                sys.exit(1)
-            copy_files_to_repository(finalPath,repositoryPath, buildDate, packageNumber, bits,
-                                 projectName, major_version, minor_version, maintenance_version, build_version)
-
-        sys.exit(0)
-    except SystemExit as e:
-        sys.exit(e)
-    except:
-        print ((traceback.print_exc()))
-        sys.exit(1)
diff --git a/PSCommon/Platform/Win32/CreateRedist/__init__.py b/PSCommon/Platform/Win32/CreateRedist/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/PSCommon/Platform/Win32/CreateRedist/redist_base.py b/PSCommon/Platform/Win32/CreateRedist/redist_base.py
deleted file mode 100644
index f83c32c..0000000
--- a/PSCommon/Platform/Win32/CreateRedist/redist_base.py
+++ /dev/null
@@ -1,905 +0,0 @@
-#/****************************************************************************
-#*      THIS file should be DUPLICATED IN BOTH                               *
-#*      Engine\Platform\Win32\CreateRedist                                   *
-#*  AND OpenNI\Platform\Win32\CreateRedist                                   *
-#*                                                                           *
-#****************************************************************************/
-
-#/****************************************************************************
-#*                                                                           *
-#*  PrimeSense OpenNI & Sensor                                               *
-#*  Copyright (C) 2010 PrimeSense Ltd.                                       *
-#*                                                                           *
-#*  This file is part of PrimeSense Common.                                  *
-#*                                                                           *
-#*  PrimeSense OpenNI & Sensor are free software: you can redistribute       *
-#*  it and/or modify                                                         *
-#*  it under the terms of the GNU Lesser General Public License as published *
-#*  by the Free Software Foundation, either version 3 of the License, or     *
-#*  (at your option) any later version.                                      *
-#*                                                                           *
-#*  PrimeSense OpenNI & Sensor are distributed in the hope that they will    *
-#*  be useful,                                                               *
-#*  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
-#*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the             *
-#*  GNU Lesser General Public License for more details.                      *
-#*                                                                           *
-#*  You should have received a copy of the GNU Lesser General Public License *
-#*  along with PrimeSense OpenNI & Sensor.                                   *
-#*  If not, see <http://www.gnu.org/licenses/>.                              *
-#*                                                                           *
-#****************************************************************************/
-
-#-------------Imports----------------------------------------------------------#
-from xml.dom.minidom import parse, parseString
-import win32con,pywintypes,win32api
-from time import strftime
-import logging
-import glob
-import os
-import re
-import sys
-import subprocess
-import shutil
-import stat
-import threading
-
-#-------------Functions--------------------------------------------------------#
-
-def is_64_bit_platform():
-    result = False
-    import platform
-    (bits,linkage) = platform.architecture()
-    matchObject = re.search('64',bits)
-    result = matchObject is not None
-    return result
-
-def write_dependencides(sln_file, all_samples,sample):
-    sln_file.write("\tProjectSection(ProjectDependencies) = postProject\n")
-    for depend in sample.dependencies:
-        sln_file.write("\t\t" + all_samples[depend].project_guid + " = " + all_samples[depend].project_guid + "\n")
-    sln_file.write("\tEndProjectSection\n")
-
-def remove_readonly(path):
-    for root, dirs, files in os.walk(path):
-        for fname in files:
-            full_path = os.path.join(root, fname)
-            os.chmod(full_path ,stat.S_IWRITE)
-
-def regx_replace(findStr,repStr,filePath):
-    "replaces all findStr by repStr in file filePath using regualr expression"
-    findStrRegx = re.compile(findStr)
-    tempName=filePath+'~~~'
-    input = open(filePath)
-    output = open(tempName,'w')
-    for s in input:
-        output.write(findStrRegx.sub(repStr,s))
-    output.close()
-    input.close()
-    os.remove(filePath)
-    os.rename(tempName,filePath)
-
-def get_reg_values(reg_key, value_list):
-    # open the reg key
-    try:
-        reg_key = win32api.RegOpenKeyEx(*reg_key)
-    except pywintypes.error as e:
-        raise Exception("Failed to open registry key!")
-    # Get the values
-    try:
-        values = [(win32api.RegQueryValueEx(reg_key, name), data_type) for name, data_type in value_list]
-        # values list of ((value, type), expected_type)
-        for (value, data_type), expected in values:
-            if data_type != expected:
-                raise Exception("Bad registry value type! Expected %d, got %d instead." % (expected, data_type))
-        # values okay, leave only values
-        values = [value for ((value, data_type), expected) in values]
-    except pywintypes.error as e:
-        raise Exception("Failed to get registry value!")
-    finally:
-        try:
-            win32api.RegCloseKey(reg_key)
-        except pywintypes.error as e:
-            # We don't care if reg key close failed...
-            pass
-    return tuple(values)
-
-#-------------Classes----------------------------------------------------------#
-class SampleData(object):
-    def __init__(self):
-        self.name = ''
-        self.project_dir = ''
-        self.source_dir = ''
-        self.project_guid = ''
-        self.project_file = ''
-        self.is_net = False
-        self.is_other = False
-        self.project_name = ''
-        self.redist_dir = ''
-        self.dependencies = []
-
-    def print_():
-        print((self.name))
-
-    def __str__(self):
-        return self.name
-
-    def __eval__(self):
-        return self.name
-
-class RedistBase(object):
-    def __init__(self):
-        self.SCRIPT_DIR = ''
-        self.VC_version = 0
-        self.vc_build_bits = ""
-        self.output_dir = ""
-        self.final_dir = ""
-        self.config_xml_filename = ""
-        self.redist_name = ""
-        self.redist_internal_name = ''
-        self.product_name = ''
-        self.doxy_file_name = ""
-        self.write_2010_sample_dependency = False
-        self.all_samples = None
-        self.internal_conf_name = ''
-        self.TIMEOUT_UPGRADE_VS10_SEC = 180
-        self.project_is_2010 = False
-
-    def finish_script(self,exit_code):
-        os.chdir(self.SCRIPT_DIR)
-        #logging.shutdown()
-        exit(exit_code)
-
-    def check_args(self,args):
-        """
-        Parse cmdline args; along them are doxy,bitness,VC.
-        """
-        if len(sys.argv) not in [4,5]:
-            print ("Args: <Doxygen:y/n> <BuildTarget:32/64> <FullRebuild:y/n> [<VCVersion:9/10>]")
-            exit(1)
-        if sys.argv[1] == 'y' or sys.argv[1] == 'Yes':
-            self.Make_Doxy=1
-        elif sys.argv[1] == 'n' or sys.argv[1] == 'No':
-            self.Make_Doxy=0
-        else:
-            print("Args: <Doxygen:y/n> <BuildTarget:32/64> <FullRebuild:y/n>")
-            print("Doxygen param must be y or n!")
-            exit(1)
-
-        if sys.argv[2] == '32':
-            self.vc_build_bits = "32"
-        elif sys.argv[2] == '64':
-            self.vc_build_bits = "64"
-        else:
-            print("Args: <Doxygen:y/n> <BuildTarget:32/64> <FullRebuild:y/n>")
-            print("BuildTarget param must be 32 or 64!")
-            exit(1)
-
-        if sys.argv[3] == 'y' or sys.argv[3] == 'Yes':
-            self.vc_build_type = "/Rebuild"
-        elif sys.argv[3] == 'n' or sys.argv[3] == 'No':
-            self.vc_build_type = "/Build"
-        else:
-            print("Args: <Doxygen:y/n> <BuildTarget:32/64> <FullRebuild:y/n>")
-            print("FullRebuild param must be y or n!")
-            exit(1)
-
-        if self.project_is_2010:
-            self.VC_version = 10
-            if len(sys.argv) > 4:
-                if sys.argv[4] == '9':
-                    print("Project does not support VS2008!")
-                    exit(1)
-        else:
-            self.VC_version = 9
-            if len(sys.argv) > 4:
-                if sys.argv[4] == '10':
-                    self.VC_version = 10
-
-    def init_vs_vars(self):
-        """
-        Checks for the availablity of Visual Studio to compile with.
-        Currently supports VS2008 (vc9) and VS2010(vc10).
-        If 64-bit platform, registry key under Software/Wow6432Node/...
-        """
-        self.VS_NEED_UPGRADE = 0
-        try:
-            if self.is_64_bit_platform:
-                MSVC_KEY = (win32con.HKEY_LOCAL_MACHINE, r"SOFTWARE\Wow6432Node\Microsoft\VisualStudio\9.0")
-            else:
-                MSVC_KEY = (win32con.HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\VisualStudio\9.0")
-            MSVC_VALUES = [("InstallDir", win32con.REG_SZ)]
-            self.VS_INST_DIR = get_reg_values(MSVC_KEY, MSVC_VALUES)[0]
-        except Exception as e:
-            self.VC_version = 10
-            
-        if self.VC_version == 10:
-            if not self.project_is_2010:
-                self.VS_NEED_UPGRADE = 1
-                
-            if self.is_64_bit_platform:
-                MSVC_KEY = (win32con.HKEY_LOCAL_MACHINE, r"SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0")
-            else:
-                MSVC_KEY = (win32con.HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\VisualStudio\10.0")
-            MSVC_VALUES = [("InstallDir", win32con.REG_SZ)]
-            self.VS_INST_DIR = get_reg_values(MSVC_KEY, MSVC_VALUES)[0]
-
-    def init_vars(self):
-        """
-        Initializae misc variables.
-        Among them: is_64_bit_platform
-        """
-        self.inst_proj_path = 'Platform\\Win32\\Install\\%s\\'%self.redist_internal_name
-        self.is_64_bit_platform = is_64_bit_platform()
-        self.DateTimeSTR = strftime("%Y-%m-%d %H:%M:%S")
-        DateSTR = strftime("%Y-%m-%d")
-        CONFIG_XML = parse(self.config_xml_filename)
-        self.WORK_DIR = str(CONFIG_XML.getElementsByTagName("WORK_DIR")[0].firstChild.data)
-        # Fix to allow reletive path
-        os.chdir(self.WORK_DIR)
-        self.WORK_DIR = os.getcwd() + "\\"
-        os.chdir(self.SCRIPT_DIR)
-        self.VER = str(CONFIG_XML.getElementsByTagName("VERSION_NUMBER")[0].firstChild.data)
-        PLATFORM = str(CONFIG_XML.getElementsByTagName("PLATFORM")[0].firstChild.data)
-        self.PROJECT_SLN = str(CONFIG_XML.getElementsByTagName("PROJECT_SLN")[0].firstChild.data)
-        self.SAMPLES_SLN = str(CONFIG_XML.getElementsByTagName("SAMPLES_SLN")[0].firstChild.data)
-        self.PROJECT_NAME = str(CONFIG_XML.getElementsByTagName("PROJECT")[0].firstChild.data)
-        self.BUILD_DIR = os.path.join(self.WORK_DIR, "Platform", "Win32", "Build")
-
-        ver_regx = re.compile("SDK \d.*\s")
-        global samples_proj_list
-        global samples_guid_list
-        global samples_guid_list_net
-        samples_proj_list = []
-        samples_guid_list = []
-        samples_guid_list_net = []
-
-        if self.vc_build_bits=="32":
-            self.bin_dir = "Bin"
-            self.lib_dir = "Lib"
-            self.vc_build_platform = "Win32"
-            self.output_dir = "Output32"
-            self.final_dir = "Final32"
-        else:
-            self.bin_dir = "Bin64"
-            self.lib_dir = "Lib64"
-            self.vc_build_platform = "x64"
-            self.output_dir = "Output64"
-            self.final_dir = "Final64"
-
-    def init_logger(self,name):
-        """
-        Initilizes the logger.
-        """
-        #-------------Log--------------------------------------------------------------#
-        out_path = os.path.join(self.SCRIPT_DIR,self.output_dir)
-        if not(os.path.exists(out_path)):
-            os.mkdir(out_path)
-        self.logger = logging.getLogger(name)
-        hdlr = logging.FileHandler(os.path.join(self.output_dir, '%s_redist_maker.log'%name))
-        formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
-        hdlr.setFormatter(formatter)
-        self.logger.addHandler(hdlr)
-        self.logger.setLevel(logging.INFO)
-
-    def print_message(self):
-        """
-        TO DO: fix that function in Redist_OpenNi to resemble this (better) version.
-        """
-        #------------Welcome Messege--------=------------------------------------------#
-        print("\n");
-        print("*********************************")
-        print(("*   PrimeSense " + self.redist_name +  " Redist    *"))
-        print(("*     " + self.DateTimeSTR + "       *"))
-        print("*********************************")
-
-    def build_proj_solution(self):
-        #--------------Build Project---------------------------------------------------#
-        print(("* Building " + self.PROJECT_NAME + "..."))
-        path2output = os.path.join(self.SCRIPT_DIR,self.output_dir)
-        if not os.path.exists(path2output):
-            os.makedirs(path2output)
-        path2final = os.path.join(self.SCRIPT_DIR,self.final_dir)
-        if not os.path.exists(path2final):
-            os.makedirs(path2final)
-
-        self.logger.info(("Building " + self.PROJECT_NAME + "..."))
-        # Set Intel Env
-        os.system("set INTEL_LICENSE_FILE=C:\\Program Files\\Common Files\\Intel\\Licenses")
-        # Build project solution
-        os.chdir(self.WORK_DIR + self.PROJECT_SLN.rpartition("\\")[0])
-        print((os.getcwd()))
-
-        out_file = os.path.join(self.SCRIPT_DIR, self.output_dir, "Build"+self.PROJECT_NAME+".txt")
-        upg_out_file = os.path.join(self.SCRIPT_DIR, self.output_dir, "Build"+self.PROJECT_NAME+"UPG"+".txt")
-        if self.VS_NEED_UPGRADE == 1:
-            os.system("attrib -r * /s")
-            devenv_upg_cmd_str = "\""+self.VS_INST_DIR + "devenv\" " + self.PROJECT_SLN.rpartition("\\")[2]+\
-                         " /upgrade > " + upg_out_file
-            print(('upgrading. out put in %s'%out_file))
-            print(('command is %s'%devenv_upg_cmd_str))
-            my_rc = os.system(devenv_upg_cmd_str)
-            print(('upgrading finished w result %d'%my_rc))
-            #devenv_upg_cmd = Command(devenv_upg_cmd_str)
-            #devenv_upg_cmd.run(self.TIMEOUT_UPGRADE_VS10_SEC)
-
-        devenv_cmd = '\"'+self.VS_INST_DIR + 'devenv\" ' + self.PROJECT_SLN.rpartition("\\")[2]+\
-                     " " + self.vc_build_type + " \"release|" + self.vc_build_platform + "\" /out " + \
-                     out_file
-        self.logger.debug('Calling vs : %s'%devenv_cmd)
-        rc = subprocess.call(devenv_cmd, close_fds=True)
-        self.logger.debug('Calling vs, RC: %d'%rc)
-        # Get the build output
-        lines = open(out_file).readlines()
-        build_result = lines[-2]
-        print(build_result)
-        self.logger.info(build_result)
-        # Check for failed build
-        failed_builds = 0
-        fail_to_open = 0
-
-        temp = re.search("(\d*) failed",build_result)
-        if temp != None :
-            failed_builds = int(temp.group(1))
-
-        temp2 = re.search('cannot be opened',str(lines))
-        if temp2 != None :
-            fail_to_open = 1
-
-        if failed_builds != 0 or fail_to_open !=0:
-            print("Building Failed!!")
-            self.logger.critical("Building Failed!")
-            self.finish_script(1)
-
-        # return to work dir
-        os.chdir(self.WORK_DIR)
-
-    def make_doxy(self):
-        """
-        Make Doxy.
-        """
-        if self.Make_Doxy==1:
-            print("* Creating Doxygen...")
-            self.logger.info("Creating Doxygen...")
-            os.chdir(os.path.join(self.WORK_DIR,"Source\\Doxygen"));
-            # Replacing version number in the doxygen setup file
-            res = os.system("attrib -r " + self.doxy_file_name)
-            print(('removing readonly attribute for Doxyfile: ' + str(res)))
-            regx_replace(self.redist_name + " \d*.\d*.\d*\s",self.PROJECT_NAME +" " + self.VER + " ",self.doxy_file_name)
-            if os.path.exists(self.WORK_DIR + "\\Source\\Doxygen\\html\\"):
-                os.system("rmdir /S /Q html")
-            # Running doxygen
-            os.system("mkdir html > null")
-            #os.system("copy PSSmallLogo.jpg html > null") // where is this file ?
-            doxy_out_file = os.path.join(self.SCRIPT_DIR,self.output_dir,self.PROJECT_NAME + "Doxy.txt")
-            doxygen_cmd = "doxygen.exe %s > " % (self.doxy_file_name) + doxy_out_file
-            os.system(doxygen_cmd)
-            self.copy_doxy_files()
-            os.chdir(self.WORK_DIR)
-        else:
-            print("Skipping Doxygen...")
-
-    def create_redist_dir(self):
-        """
-        Creates directory structure for Redist.
-        """
-        #-------------Create Redist Dir------------------------------------------------#
-        print("* Creating Redist Dir...")
-        self.logger.info("Creating Redist Dir...")
-        os.chdir(os.path.join(self.WORK_DIR,"Platform","Win32"))
-        # Removing the old directory
-        os.system("rmdir /S /Q Redist")
-        # Creating new directory tree
-        os.system("mkdir Redist")
-        os.system("mkdir Redist\\" + self.bin_dir)
-        os.system("mkdir Redist\\" + self.lib_dir)
-        os.system("mkdir Redist\\Include")
-        os.system("mkdir Redist\\Documentation")
-        os.system("mkdir Redist\\Samples")
-        os.system("mkdir Redist\\Samples\\" + self.bin_dir)
-        os.system("mkdir Redist\\Samples\\" + self.bin_dir + "\\Debug")
-        os.system("mkdir Redist\\Samples\\" + self.bin_dir + "\\Release")
-        os.system("mkdir Redist\\Samples\\Build")
-        os.system("mkdir Redist\\Samples\\Res")
-        os.system("mkdir Redist\\Data")
-        os.chdir(self.WORK_DIR)
-
-    def find_samples(self):
-        # returns a dictionary of all samples
-        all_samples = dict()
-        os.chdir(self.WORK_DIR)
-        samples_list = os.listdir(os.path.join(self.BUILD_DIR,"Samples"))
-        if '.svn' in samples_list:
-            samples_list.remove('.svn')
-        for sample in samples_list:
-            sample_data = SampleData()
-            sample_data.name = sample
-            sample_data.source_dir = os.path.join(self.WORK_DIR, "Samples", sample)
-            sample_data.project_dir = os.path.join(self.BUILD_DIR, "Samples", sample)
-            sample_data.is_other = False;
-
-            vc_proj_name = sample_data.project_dir + "\\" + sample + ".vcproj"
-            cs_proj_name = sample_data.project_dir + "\\" + sample + ".csproj"
-            vcx_proj_name = sample_data.project_dir + "\\" + sample + ".vcxproj"
-            other_proj_name = os.path.join(sample_data.project_dir, "Build.bat")
-
-            # check if this is a VC project
-            if os.path.exists(vc_proj_name):
-                sample_data.project_file = vc_proj_name
-
-                # open it
-                prj = open(vc_proj_name, 'r')
-                lines = prj.readlines()
-                for line in lines:
-                    # Search for name
-                    if sample_data.project_name == "":
-                        ProjNametmp = re.search(r"Name=\"(.*)\"",line)
-                        if (ProjNametmp != None):
-                            sample_data.project_name = ProjNametmp.group(1)
-
-                    # Search for GUID
-                    if sample_data.project_guid == "":
-                        ProjGUIDtmp = re.search(r"ProjectGUID=\"(.*)\"",line)
-                        if (ProjGUIDtmp != None):
-                            sample_data.project_guid = ProjGUIDtmp.group(1)
-
-                prj.close()
-
-            elif os.path.exists(vcx_proj_name):
-                # a VC project for VS 2010
-                sample_data.project_file = vcx_proj_name
-                sample_data.project_name = sample
-
-                # open it
-                prj = open(vcx_proj_name, 'r')
-                lines = prj.readlines()
-                for line in lines:
-                    # Search for name
-                    if sample_data.project_name == "":
-                        ProjNametmp = re.search(r"Name=\"(.*)\"",line)
-                        if (ProjNametmp != None):
-                            sample_data.project_name = ProjNametmp.group(1)
-
-                    # Search for GUID
-                    if sample_data.project_guid == "":
-                        ProjGUIDtmp = re.search(r"<ProjectGuid>(.*)</ProjectGuid>", line)
-                        if (ProjGUIDtmp != None):
-                            sample_data.project_guid = ProjGUIDtmp.group(1)
-
-                prj.close()
-            
-            elif os.path.exists(cs_proj_name):
-                # a .NET project
-                sample_data.project_file = cs_proj_name
-                sample_data.is_net = True
-
-                # open it
-                prj = open(cs_proj_name, 'r')
-                lines = prj.readlines()
-                for line in lines:
-                    # Search for name
-                    if sample_data.project_name == "":
-                        ProjNametmp = re.search(r"<AssemblyName>(.*)</AssemblyName>",line)
-                        if (ProjNametmp != None):
-                            sample_data.project_name = ProjNametmp.group(1)
-
-                    # Search for GUID
-                    if sample_data.project_guid == "":
-                        ProjGUIDtmp = re.search(r"<ProjectGuid>(.*)</ProjectGuid>",line)
-                        if (ProjGUIDtmp != None):
-                            sample_data.project_guid = ProjGUIDtmp.group(1)
-
-                prj.close()
-
-            elif os.path.exists(other_proj_name):
-                # some other type of project (java?)
-                sample_data.project_file = other_proj_name
-                sample_data.is_other = True
-                sample_data.project_name = sample
-
-            else:
-                print(('Sample ' + sample + ' does not have a valid project file'))
-                self.finish_script(1)
-
-            # check if it has a special configuration
-            redist_file_name = sample_data.source_dir + "\\.redist"
-            if os.path.exists(redist_file_name):
-                redist_file = open(redist_file_name, 'r')
-
-                for line in redist_file.readlines():
-                    # seach for dependencies
-                    match = re.search("^DEPENDS=(.*)$", line)
-                    if match != None:
-                        sample_data.dependencies.append(match.group(1))
-
-                redist_file.close()
-
-            sample_data.redist_dir = "Redist\\Samples\\" + sample_data.name
-            all_samples[sample_data.name] = sample_data
-
-        return all_samples
-
-    def get_samples(self):
-        # returns a dictionary of all samples
-        if self.all_samples == None:
-            self.all_samples = self.find_samples()
-
-        return self.all_samples
-
-    def build_other_proj(self, build_dir):
-        # build other (not Visual Studio) project
-        ret = subprocess.call(os.path.join(build_dir, "Build.bat") + " " + self.vc_build_bits)
-        if ret != 0:
-            print(("Building project " + build_dir + " failed!"))
-            self.logger.critical("Building project " + build_dir + " failed!")
-            self.finish_script(1)
-
-    def build_other_samples(self):
-        "Builds other samples (java?)"
-        all_samples = self.get_samples()
-        for sample in list(all_samples.values()):
-            if not sample.is_other:
-                continue
-            build_dir = os.path.join(self.BUILD_DIR, "Samples", sample.name)
-            self.build_other_proj(build_dir)
-
-    def creating_samples(self):
-        """
-        not exactly the same some further work needed.
-        """
-        #-------Creating samples-------------------------------------------------------#
-        print("* Creating samples...")
-        self.logger.info("Creating samples...")
-
-        all_samples = self.get_samples()
-
-        os.chdir(os.path.join(self.WORK_DIR, "Platform", "Win32"))
-
-        # open all solution files
-        if not self.project_is_2010:
-            OUTFILESLN2008 = open("Redist\\Samples\\Build\\All_2008.sln",'w')
-            OUTFILESLN2008.write("Microsoft Visual Studio Solution File, Format Version 10.00\n")
-            OUTFILESLN2008.write("# Visual Studio 2008\n")
-
-        if not self.project_is_2010:
-            OUTFILESLN2010 = open("Redist\\Samples\\Build\\All_2010.sln",'w')
-        else:
-            OUTFILESLN2010 = open("Redist\\Samples\\Build\\All.sln",'w')
-        
-        OUTFILESLN2010.write("Microsoft Visual Studio Solution File, Format Version 11.00\n")
-        OUTFILESLN2010.write("# Visual Studio 2010\n")
-
-        # copy java build script
-        try:
-            shutil.copy(os.path.join("Build", "BuildJava.py"), os.path.join("Redist", "Samples", "Build"))
-        except:
-            pass
-
-        # add projects
-        for sample in list(all_samples.values()):
-            # make dir
-            os.system ("mkdir " + sample.redist_dir)
-            # copy source
-            os.system ("xcopy /S " + sample.source_dir + " " + sample.redist_dir)
-
-            if sample.is_other:
-                shutil.copy(sample.project_file, sample.redist_dir)
-            else:
-                # copy the project file to 2008 and 2010:
-                prj_name_partitioned = os.path.splitext(sample.project_file);
-                prj2008_filename = sample.redist_dir + "\\" + sample.name + "_2008" + prj_name_partitioned[1]
-
-                if self.project_is_2010:
-                    prj2010_filename = sample.redist_dir + "\\" + sample.name + prj_name_partitioned[1]
-                else:
-                    prj2010_filename = sample.redist_dir + "\\" + sample.name + "_2010" + prj_name_partitioned[1]
-
-                if not self.project_is_2010:
-                    shutil.copy(sample.project_file, prj2008_filename)
-                shutil.copy(sample.project_file, prj2010_filename)
-
-                # create reletive path to samples
-                prj2008_path = "..\\" + prj2008_filename.partition("\\")[2].partition("\\")[2]
-                prj2010_path = "..\\" + prj2010_filename.partition("\\")[2].partition("\\")[2]
-
-                # add project to solution
-                if not self.project_is_2010:
-                    OUTFILESLN2008.write("Project(\"{19091980-2008-4CFA-1491-04CC20D8BCF9}\") = \""+\
-                                            sample.project_name + "\", \"" + prj2008_path + "\", \"" + sample.project_guid + "\"\n")
-                OUTFILESLN2010.write("Project(\"{19091980-2008-4CFA-1491-04CC20D8BCF9}\") = \""+\
-                                            sample.project_name + "\", \"" + prj2010_path + "\", \"" + sample.project_guid + "\"\n")
-
-                # write down dependencies
-                if len(sample.dependencies) > 0:
-                    if not self.project_is_2010:
-                        OUTFILESLN2008.write("\tProjectSection(ProjectDependencies) = postProject\n")
-                        for depend in sample.dependencies:
-                            OUTFILESLN2008.write("\t\t" + all_samples[depend].project_guid + " = " + all_samples[depend].project_guid + "\n")
-                        OUTFILESLN2008.write("\tEndProjectSection\n")
-                        if self.write_2010_sample_dependency == True:
-                            write_dependencides(OUTFILESLN2010,all_samples,sample)
-                            
-                if not self.project_is_2010:
-                    OUTFILESLN2008.write("EndProject\n")
-                OUTFILESLN2010.write("EndProject\n")
-
-        # Close files
-        if not self.project_is_2010:
-            OUTFILESLN2008.write("Global\n")
-            OUTFILESLN2008.write("	GlobalSection(SolutionConfigurationPlatforms) = preSolution\n")
-            OUTFILESLN2008.write("		Debug|Win32 = Debug|Win32\n")
-            OUTFILESLN2008.write("		Debug|x64 = Debug|x64\n")
-            OUTFILESLN2008.write("		Release|Win32 = Release|Win32\n")
-            OUTFILESLN2008.write("		Release|x64 = Release|x64\n")
-            OUTFILESLN2008.write("	EndGlobalSection\n")
-            OUTFILESLN2008.write("	GlobalSection(ProjectConfigurationPlatforms) = postSolution\n")
-        OUTFILESLN2010.write("Global\n")
-        OUTFILESLN2010.write("	GlobalSection(SolutionConfigurationPlatforms) = preSolution\n")
-        OUTFILESLN2010.write("		Debug|Win32 = Debug|Win32\n")
-        OUTFILESLN2010.write("		Debug|x64 = Debug|x64\n")
-        OUTFILESLN2010.write("		Release|Win32 = Release|Win32\n")
-        OUTFILESLN2010.write("		Release|x64 = Release|x64\n")
-        OUTFILESLN2010.write("	EndGlobalSection\n")
-        OUTFILESLN2010.write("	GlobalSection(ProjectConfigurationPlatforms) = postSolution\n")
-
-        for sample in list(all_samples.values()):
-            conf_32_name = "Win32"
-            if sample.is_net:
-                conf_32_name = "x86"
-
-            if not self.project_is_2010:
-                OUTFILESLN2008.write("		" + sample.project_guid + ".Debug|Win32.ActiveCfg = Debug|" + conf_32_name + "\n")
-                OUTFILESLN2008.write("		" + sample.project_guid + ".Debug|Win32.Build.0 = Debug|" + conf_32_name + "\n")
-                OUTFILESLN2008.write("		" + sample.project_guid + ".Debug|x64.ActiveCfg = Debug|x64\n")
-                OUTFILESLN2008.write("		" + sample.project_guid + ".Debug|x64.Build.0 = Debug|x64\n")
-                OUTFILESLN2008.write("		" + sample.project_guid + ".Release|Win32.ActiveCfg = Release|" + conf_32_name + "\n")
-                OUTFILESLN2008.write("		" + sample.project_guid + ".Release|Win32.Build.0 = Release|" + conf_32_name + "\n")
-                OUTFILESLN2008.write("		" + sample.project_guid + ".Release|x64.ActiveCfg = Release|x64\n")
-                OUTFILESLN2008.write("		" + sample.project_guid + ".Release|x64.Build.0 = Release|x64\n")
-            OUTFILESLN2010.write("		" + sample.project_guid + ".Debug|Win32.ActiveCfg = Debug|" + conf_32_name + "\n")
-            OUTFILESLN2010.write("		" + sample.project_guid + ".Debug|Win32.Build.0 = Debug|" + conf_32_name + "\n")
-            OUTFILESLN2010.write("		" + sample.project_guid + ".Debug|x64.ActiveCfg = Debug|x64\n")
-            OUTFILESLN2010.write("		" + sample.project_guid + ".Debug|x64.Build.0 = Debug|x64\n")
-            OUTFILESLN2010.write("		" + sample.project_guid + ".Release|Win32.ActiveCfg = Release|" + conf_32_name + "\n")
-            OUTFILESLN2010.write("		" + sample.project_guid + ".Release|Win32.Build.0 = Release|" + conf_32_name + "\n")
-            OUTFILESLN2010.write("		" + sample.project_guid + ".Release|x64.ActiveCfg = Release|x64\n")
-            OUTFILESLN2010.write("		" + sample.project_guid + ".Release|x64.Build.0 = Release|x64\n")
-
-        if not self.project_is_2010:
-            OUTFILESLN2008.write("	EndGlobalSection\n")
-            OUTFILESLN2008.write("	GlobalSection(SolutionProperties) = preSolution\n")
-            OUTFILESLN2008.write("		HideSolutionNode = FALSE\n")
-            OUTFILESLN2008.write("	EndGlobalSection\n")
-            OUTFILESLN2008.write("EndGlobal	\n")
-        OUTFILESLN2010.write("	EndGlobalSection\n")
-        OUTFILESLN2010.write("	GlobalSection(SolutionProperties) = preSolution\n")
-        OUTFILESLN2010.write("		HideSolutionNode = FALSE\n")
-        OUTFILESLN2010.write("	EndGlobalSection\n")
-        OUTFILESLN2010.write("EndGlobal	\n")
-
-        if not self.project_is_2010:
-            OUTFILESLN2008.close()
-        OUTFILESLN2010.close()
-
-        os.chdir(self.WORK_DIR)
-
-    def remove_read_only_attributes(self):
-        #-----Remove Read Only Attrib--------------------------------------------------#
-        print("* Removing Read Only Attributes...")
-        full_path = os.path.join(self.WORK_DIR,"Platform", "Win32" , "Redist")
-        self.logger.info("Removing Read Only Attributes... (%s)" % (full_path))
-        #os.system ("attrib -r -h -s /S Redist\\*.*")
-        remove_readonly(full_path)
-
-    def make_installer(self,msi_dest_path):
-        """
-        [dev_success,redist_success]
-        """
-        wix_var_file = '%sVariables.wxi'%self.redist_internal_name.replace('_','')
-
-        [dev_success,redist_success] = [False,False]
-        print("* Making Installer...")
-        self.logger.info("Making Installer...")
-        self.wix_inst_primitive_check()
-        os.chdir(os.path.join(self.WORK_DIR,self.inst_proj_path))
-        # Replace version in the WIX
-        self.wix_dev_var_set()
-        self.check_upgrade_install_sln()
-        print("calling WIX")
-        conf_name = self.internal_conf_name
-        dev_success = self.build_installer(conf_name)
-        print(("moving %s Msi"%conf_name))
-        src = ('.\\bin\Release\en-US\\%s.msi'%self.redist_internal_name)
-        dst = os.path.join( msi_dest_path ,self.final_dir,(self.product_name + '-Win' + self.vc_build_bits + "-" + self.VER + '-%s.msi'%conf_name))
-        os.system(("move %s %s"%(src,dst)))
-        self.dev_to_redist_hack()
-        self.wix_redist_var_set()
-        print("calling WIX")
-        conf_name = 'Redist'
-        redist_success = self.build_installer(conf_name)
-        print(("moving %s Msi"%conf_name))
-        os.system("move .\\bin\Release\en-US\\%s.msi %s"%(self.redist_internal_name,\
-                                                          os.path.join( msi_dest_path ,self.final_dir,self.product_name + '-Win' + self.vc_build_bits + "-" + self.VER + '-%s.msi'%conf_name)))
-
-        os.chdir(self.WORK_DIR)
-        return [dev_success,redist_success]
-
-    def build_installer(self,conf_name):
-        success = False
-        wix_log = 'Build%sWIX%s'%(self.redist_internal_name,conf_name)
-        wix_log.replace('_','') #because outside code expects EENI in the name instead of EE_NI
-        out_file = os.path.join('..\\..\\CreateRedist',self.output_dir,"%s.txt"%wix_log)
-        wix_rc = subprocess.call("\"" + self.VS_INST_DIR \
-            + "devenv\" %s.wixproj /Build \"release|%s"%(self.redist_internal_name, 'x86' if self.vc_build_bits=='32' else 'x64')  \
-            + "\" /out " + out_file, close_fds=True)
-        failed_builds = self.check_vs_report_failed(out_file)
-        if failed_builds > 0 or wix_rc != 0:
-            self.logger.info('Fail to build installer for %s version'%conf_name)
-        else:
-            success = True
-        return success
-
-    def wix_redist_var_set(self):
-        """preconsdition: CWD is where wix-variables-file is stored"""
-        temp = self.redist_internal_name.replace('_','')
-        os.system("attrib -r Includes\\%sVariables.wxi"%temp)
-        #print("setting WIX BuildPlatform")
-        #regx_replace("BuildPlatform=(.*)", "BuildPlatform=" + str(vc_build_bits) + "?>", "Includes\\OpenNIVariables.wxi")
-        print("setting WIX BinaryOnlyRedist=True")
-        regx_replace("BinaryOnlyRedist=(.*)", "BinaryOnlyRedist=True?>", "Includes\\%sVariables.wxi"%temp)
-
-    def wix_dev_var_set(self):
-        """preconsdition: CWD is where wix-variables-file is stored"""
-        print("setting WIX BinaryOnlyRedist=False")
-        temp = self.redist_internal_name.replace('_','')
-        os.system("attrib -r Includes\\%sVariables.wxi"%temp)
-        regx_replace("BinaryOnlyRedist=(.*)", "BinaryOnlyRedist=False?>", "Includes\\%sVariables.wxi"%temp)
-
-    def check_upgrade_install_sln(self):
-        """preconsdition: CWD is where wix-variables-file is stored"""
-        up_wix_file = os.path.join('..\\..\\CreateRedist',self.output_dir,"Upgrade%sWIX.txt"%(self.redist_internal_name))
-        if self.VS_NEED_UPGRADE == 1:
-            subprocess.call("\"" + self.VS_INST_DIR +  \
-            "devenv\" %s.sln /upgrade /out "%(self.redist_internal_name) + up_wix_file, close_fds=True)
-
-    def wix_inst_primitive_check(self):
-        wixPath = os.environ.get('WIX')
-        if wixPath == None:
-            print('*** no WIX env. var. defined ! use set WIX=C:\Program Files\Windows Installer XML v3.5\ or similar to set the path ***')
-            print('make installer is SERIOUSLY expected to fail')
-            self.logger.info('It seems that WIX is not installed and therefore teh installer cannot be built.')
-        else:
-            print(('WIX='+wixPath))
-
-    def dev_to_redist_hack(self):
-        pass
-
-    def check_vs_report_failed(self,file):
-        lines = open(file).readlines()
-        build_result = lines[-2]
-        failed_builds = 0
-        temp = re.search("(\d*) failed",build_result)
-        if temp != None :
-            failed_builds = int(temp.group(1))
-        return failed_builds
-
-    def fixing_files(self):
-        """
-        fixing files
-        """
-        #--------Fixing Files----------------------------------------------------------#
-        print("* Fixing Files...")
-        self.logger.info("Fixing Files...")
-        for dirpath, dirnames, filenames in os.walk(os.path.join(self.WORK_DIR, "Platform", "Win32", "Redist")):
-            self.fix_file('', dirpath, dirnames + filenames)
-
-    def build_samples(self):
-        """
-        Build Samples.
-        """
-        #-------------Build Samples---------------------------------------------------#
-        print("* Building Samples in release configuration......")
-        self.logger.info("Building Samples in release configuration...")
-        # Build project solution
-        os.chdir(self.WORK_DIR + self.SAMPLES_SLN.rpartition("\\")[0])
-
-        output_file = os.path.join(self.SCRIPT_DIR ,self.output_dir ,self.PROJECT_NAME + "SmpRelease.txt")
-
-        if self.VS_NEED_UPGRADE == 1:
-            os.system("\""+self.VS_INST_DIR + "devenv\" " +self.SAMPLES_SLN.rpartition("\\")[2]+\
-                       " /upgrade > " + output_file)
-
-        subprocess.call("\""+self.VS_INST_DIR + "devenv\" " +self.SAMPLES_SLN.rpartition("\\")[2]+\
-                 " " + self.vc_build_type + " \"release|" + self.vc_build_platform + "\" /out " + output_file)
-
-        # Get the build output
-        lines = open(output_file).readlines()
-        build_result = lines[-2]
-        print(build_result)
-        self.logger.info(build_result)
-        # Check for failed build
-
-        failed_builds = 0
-        temp = re.search("(\d*) failed",build_result)
-
-        if temp != None :
-            failed_builds = int(temp.group(1))
-        if failed_builds != 0:
-            print("Samples Building In Release Failed!!")
-            self.logger.critical("Samples Building Failed!")
-            self.finish_script(1)
-
-        print("* Building Samples in debug configuration......")
-        self.logger.info("Building Samples in debug configuration...")
-        # Build project solution
-        os.chdir(self.WORK_DIR +self.SAMPLES_SLN.rpartition("\\")[0])
-
-        output_file = os.path.join(self.SCRIPT_DIR ,self.output_dir ,self.PROJECT_NAME + "SmpDebug.txt")
-
-        if self.VS_NEED_UPGRADE == 1:
-            os.system("\""+self.VS_INST_DIR + "devenv\" " +self.SAMPLES_SLN.rpartition("\\")[2]+\
-                     " /upgrade > " + output_file)
-
-        subprocess.call("\""+self.VS_INST_DIR + "devenv\" " +self.SAMPLES_SLN.rpartition("\\")[2]+\
-                 " " + self.vc_build_type + " \"debug|" + self.vc_build_platform + "\" /out " + output_file)
-
-        # Get the build output
-        lines = open(output_file).readlines()
-        build_result = lines[-2]
-        print(build_result)
-        self.logger.info(build_result)
-        # Check for failed build
-
-        failed_builds = 0
-        tempReResult = re.search("(\d*) failed",build_result)
-
-        if tempReResult != None :
-            failed_builds = int(tempReResult.group(1))
-        if failed_builds != 0:
-            print("Samples Building In Debug Failed!!")
-            self.logger.critical("Samples Building Failed!")
-            self.finish_script(1)
-
-        # Build other samples
-        all_samples = self.get_samples()
-        for sample in list(all_samples.values()):
-            if sample.is_other:
-                self.build_other_proj(os.path.join(self.WORK_DIR, "Platform", "Win32", "Redist", "Samples", sample.name))
-
-        # --------------------Delete stuff
-        os.chdir(self.WORK_DIR + "\\Platform\\Win32\\Redist\\Samples\\" + self.bin_dir +"\\Release\\")
-        os.system("del *.pdb")
-        os.chdir(self.WORK_DIR + "\\Platform\\Win32\\Redist\\Samples\\" + self.bin_dir +"\\Debug\\")
-        os.system("del *.pdb")
-        os.system("del *.ilk")
-        os.chdir(self.WORK_DIR + "\\Platform\\Win32\\Redist\\" + self.lib_dir + "\\")
-        os.system("del nim*.*")
-
-        os.chdir(self.WORK_DIR)
-
-    def clean_up(self):
-        temp_str = "Redist "+ self.redist_name +" Ended."
-        print(temp_str)
-        self.logger.info(temp_str)
-        #self.finish_script(0)
-class Command(object):
-    def __init__(self, cmd):
-        self.cmd = cmd
-        self.process = None
-
-    def run(self, timeout):
-        def target():
-            print('Thread started')
-            self.process = subprocess.Popen(self.cmd, shell=True)
-            self.process.communicate()
-            print('Thread finished')
-
-        thread = threading.Thread(target=target)
-        thread.start()
-
-        thread.join(timeout)
-        if thread.is_alive():
-            print('Terminating process')
-            self.process.terminate()
-            thread.join()
-        print((self.process.returncode))
diff --git a/PSCommon/Platform/Win32/CreateRedist/redist_base.pyc b/PSCommon/Platform/Win32/CreateRedist/redist_base.pyc
deleted file mode 100644
index c533fab..0000000
Binary files a/PSCommon/Platform/Win32/CreateRedist/redist_base.pyc and /dev/null differ
diff --git a/Platform/Linux/Build/Common/CommonDefs.mak b/Platform/Linux/Build/Common/CommonDefs.mak
index cb142f8..11cb9d2 100644
--- a/Platform/Linux/Build/Common/CommonDefs.mak
+++ b/Platform/Linux/Build/Common/CommonDefs.mak
@@ -1,6 +1,3 @@
-ifndef _COMMON_DEFS_MAKE_
-_COMMON_DEFS_MAKE_=1
-
 # some defaults
 ifndef CFG
     CFG = Release
@@ -58,5 +55,3 @@ OSTYPE := $(shell uname -s)
 
 # platform specific args
 include $(COMMON_MAK_DIR)Platform.$(PLATFORM)
-
-endif # _COMMON_DEFS_MAKE_
\ No newline at end of file
diff --git a/Platform/Linux/Build/Makefile b/Platform/Linux/Build/Makefile
index 01de736..d482819 100644
--- a/Platform/Linux/Build/Makefile
+++ b/Platform/Linux/Build/Makefile
@@ -5,8 +5,6 @@
 #*   Copyright (C) 2010 PrimeSense Ltd.                                        *
 #*                                                                             *
 #******************************************************************************/
-include Common/CommonDefs.mak
-
 # default config is Release
 ifndef CFG
     CFG = Release
diff --git a/Platform/Linux/CreateRedist/RedistMaker b/Platform/Linux/CreateRedist/RedistMaker
old mode 100755
new mode 100644
index bb27bd4..cb4489c
--- a/Platform/Linux/CreateRedist/RedistMaker
+++ b/Platform/Linux/CreateRedist/RedistMaker
@@ -27,7 +27,7 @@ else
 		PLATFORM="x86" ;;
 	x86_64)
 		PLATFORM="x64" ;;
-	arm*)
+	arm)
 		PLATFORM="Arm" ;;
 	*)
 		echo "Unknown machine type: $MACHINE_TYPE"
diff --git a/Platform/Linux/CreateRedist/install.sh b/Platform/Linux/CreateRedist/install.sh
old mode 100755
new mode 100644
diff --git a/Platform/Win32/Build/Res/Resource-DDK.h b/Platform/Win32/Build/Res/Resource-DDK.h
index fb398c9..803fa35 100644
--- a/Platform/Win32/Build/Res/Resource-DDK.h
+++ b/Platform/Win32/Build/Res/Resource-DDK.h
@@ -1,37 +1,37 @@
-/****************************************************************************
-*                                                                           *
-*  PrimeSense Sensor 5.x Alpha                                              *
-*  Copyright (C) 2011 PrimeSense Ltd.                                       *
-*                                                                           *
-*  This file is part of PrimeSense Sensor.                                  *
-*                                                                           *
-*  PrimeSense Sensor is free software: you can redistribute it and/or modify*
-*  it under the terms of the GNU Lesser General Public License as published *
-*  by the Free Software Foundation, either version 3 of the License, or     *
-*  (at your option) any later version.                                      *
-*                                                                           *
-*  PrimeSense Sensor is distributed in the hope that it will be useful,     *
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the             *
-*  GNU Lesser General Public License for more details.                      *
-*                                                                           *
-*  You should have received a copy of the GNU Lesser General Public License *
-*  along with PrimeSense Sensor. If not, see <http://www.gnu.org/licenses/>.*
-*                                                                           *
-****************************************************************************/
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by DDK.rc
-//
-#define IDI_MAINICON                    110
-
-// Next default values for new objects
-// 
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE        116
-#define _APS_NEXT_COMMAND_VALUE         40001
-#define _APS_NEXT_CONTROL_VALUE         1016
-#define _APS_NEXT_SYMED_VALUE           101
-#endif
-#endif
+/****************************************************************************
+*                                                                           *
+*  PrimeSense Sensor 5.x Alpha                                              *
+*  Copyright (C) 2011 PrimeSense Ltd.                                       *
+*                                                                           *
+*  This file is part of PrimeSense Sensor.                                  *
+*                                                                           *
+*  PrimeSense Sensor is free software: you can redistribute it and/or modify*
+*  it under the terms of the GNU Lesser General Public License as published *
+*  by the Free Software Foundation, either version 3 of the License, or     *
+*  (at your option) any later version.                                      *
+*                                                                           *
+*  PrimeSense Sensor is distributed in the hope that it will be useful,     *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the             *
+*  GNU Lesser General Public License for more details.                      *
+*                                                                           *
+*  You should have received a copy of the GNU Lesser General Public License *
+*  along with PrimeSense Sensor. If not, see <http://www.gnu.org/licenses/>.*
+*                                                                           *
+****************************************************************************/
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by DDK.rc
+//
+#define IDI_MAINICON                    110
+
+// Next default values for new objects
+// 
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE        116
+#define _APS_NEXT_COMMAND_VALUE         40001
+#define _APS_NEXT_CONTROL_VALUE         1016
+#define _APS_NEXT_SYMED_VALUE           101
+#endif
+#endif
diff --git a/Platform/Win32/Build/XnCore/XnCore.vcproj b/Platform/Win32/Build/XnCore/XnCore.vcproj
index 78ac3a8..bbf14d6 100644
--- a/Platform/Win32/Build/XnCore/XnCore.vcproj
+++ b/Platform/Win32/Build/XnCore/XnCore.vcproj
@@ -28,7 +28,7 @@
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
-				CommandLine=""
+				CommandLine="xcopy /D /Y ..\..\..\..\Source\XnCommon\XnCommon.h ..\..\..\..\Include"
 			/>
 			<Tool
 				Name="VCCustomBuildTool"
@@ -111,7 +111,7 @@
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
-				CommandLine=""
+				CommandLine="xcopy /D /Y ..\..\..\..\Source\XnCommon\XnCommon.h ..\..\..\..\Include"
 			/>
 			<Tool
 				Name="VCCustomBuildTool"
@@ -196,7 +196,7 @@
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
-				CommandLine=""
+				CommandLine="xcopy /D /Y ..\..\..\..\Source\XnCommon\XnCommon.h ..\..\..\..\Include"
 			/>
 			<Tool
 				Name="VCCustomBuildTool"
@@ -289,7 +289,7 @@
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
-				CommandLine=""
+				CommandLine="xcopy /D /Y ..\..\..\..\Source\XnCommon\XnCommon.h ..\..\..\..\Include"
 			/>
 			<Tool
 				Name="VCCustomBuildTool"
@@ -392,7 +392,7 @@
 				Name="Core"
 				>
 				<File
-					RelativePath="..\..\..\..\Include\XnCommon.h"
+					RelativePath="..\..\..\..\Source\XnCommon\XnCommon.h"
 					>
 				</File>
 				<File
diff --git a/Platform/Win32/Build/XnDDK/XnDDK.vcproj b/Platform/Win32/Build/XnDDK/XnDDK.vcproj
index 3e7666c..731eca2 100644
--- a/Platform/Win32/Build/XnDDK/XnDDK.vcproj
+++ b/Platform/Win32/Build/XnDDK/XnDDK.vcproj
@@ -522,14 +522,6 @@
 					>
 				</File>
 				<File
-					RelativePath="..\..\..\..\Source\XnDDK\XnExternalBufferPool.cpp"
-					>
-				</File>
-				<File
-					RelativePath="..\..\..\..\Source\XnDDK\XnExternalBufferPool.h"
-					>
-				</File>
-				<File
 					RelativePath="..\..\..\..\Source\XnDDK\XnFrameBufferManager.cpp"
 					>
 				</File>
diff --git a/Platform/Win32/Build/XnDeviceSensorV2/XnDeviceSensorV2.vcproj b/Platform/Win32/Build/XnDeviceSensorV2/XnDeviceSensorV2.vcproj
index 09fbce1..f641088 100644
--- a/Platform/Win32/Build/XnDeviceSensorV2/XnDeviceSensorV2.vcproj
+++ b/Platform/Win32/Build/XnDeviceSensorV2/XnDeviceSensorV2.vcproj
@@ -425,6 +425,14 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\..\..\Source\XnDeviceSensorV2\XnSensorFixedParams.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\..\Source\XnDeviceSensorV2\XnSensorFixedParams.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\..\..\Source\XnDeviceSensorV2\XnSensorFPS.cpp"
 				>
 			</File>
@@ -543,14 +551,6 @@
 						>
 					</File>
 					<File
-						RelativePath="..\..\..\..\Source\XnDeviceSensorV2\XnPacked12DepthProcessor.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\..\Source\XnDeviceSensorV2\XnPacked12DepthProcessor.h"
-						>
-					</File>
-					<File
 						RelativePath="..\..\..\..\Source\XnDeviceSensorV2\XnPSCompressedDepthProcessor.cpp"
 						>
 					</File>
@@ -723,6 +723,14 @@
 					RelativePath="..\..\..\..\Source\XnDeviceSensorV2\XnSensorStreamHelper.h"
 					>
 				</File>
+				<File
+					RelativePath="..\..\..\..\Source\XnDeviceSensorV2\XnSharedMemoryBufferPool.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\..\..\..\Source\XnDeviceSensorV2\XnSharedMemoryBufferPool.h"
+					>
+				</File>
 			</Filter>
 			<Filter
 				Name="Firmware"
@@ -799,14 +807,6 @@
 					RelativePath="..\..\..\..\Source\XnDeviceSensorV2\XnSensorFirmwareParams.h"
 					>
 				</File>
-				<File
-					RelativePath="..\..\..\..\Source\XnDeviceSensorV2\XnSensorFixedParams.cpp"
-					>
-				</File>
-				<File
-					RelativePath="..\..\..\..\Source\XnDeviceSensorV2\XnSensorFixedParams.h"
-					>
-				</File>
 			</Filter>
 			<Filter
 				Name="ClientServer"
diff --git a/Platform/Win32/CreateRedist/EE_NI/Includes/EENIVariables.wxi b/Platform/Win32/CreateRedist/EE_NI/Includes/EENIVariables.wxi
index cae2903..3fef862 100644
--- a/Platform/Win32/CreateRedist/EE_NI/Includes/EENIVariables.wxi
+++ b/Platform/Win32/CreateRedist/EE_NI/Includes/EENIVariables.wxi
@@ -6,9 +6,9 @@
   -->
   <?define MajorVersion=5?>
   <?define MinorVersion=1?>
-  <?define MaintenanceVersion=2?>
+  <?define MaintenanceVersion=0?>
   <!-- BuildVersion is NOT used by WiX in the upgrade procedure -->
-  <?define BuildVersion=1?>
+  <?define BuildVersion=41?>
   
   <!-- Full version number to display -->
   <?define VersionNumber="$(var.MajorVersion).$(var.MinorVersion).$(var.MaintenanceVersion).$(var.BuildVersion)" ?>
diff --git a/Platform/Win32/CreateRedist/Engine_Config.xml b/Platform/Win32/CreateRedist/Engine_Config.xml
index 5291a51..8d793ce 100644
--- a/Platform/Win32/CreateRedist/Engine_Config.xml
+++ b/Platform/Win32/CreateRedist/Engine_Config.xml
@@ -1,8 +1,8 @@
-<root>
-  <PROJECT>EngineWin32</PROJECT>
-  <PLATFORM>WIN32</PLATFORM>
-  <VERSION_NUMBER>5.1.2</VERSION_NUMBER>
-  <WORK_DIR>..\..\..\</WORK_DIR>
-  <PROJECT_SLN>\Platform\Win32\Build\EngineWin32.sln</PROJECT_SLN>
-  <SAMPLES_SLN>\Platform\Win32\Redist\Samples\Build\All_2008.sln</SAMPLES_SLN>
-</root>
+<root>
+  <PROJECT>EngineWin32</PROJECT>
+  <PLATFORM>WIN32</PLATFORM>
+  <VERSION_NUMBER>5.1.0</VERSION_NUMBER>
+  <WORK_DIR>..\..\..\</WORK_DIR>
+  <PROJECT_SLN>\Platform\Win32\Build\EngineWin32.sln</PROJECT_SLN>
+  <SAMPLES_SLN>\Platform\Win32\Redist\Samples\Build\All_2008.sln</SAMPLES_SLN>
+</root>
diff --git a/README b/README
index c35683e..0f05376 100644
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
-PrimeSense Sensor Module for OpenNI (Version 5.1.2.1 - May 15th 2012)
----------------------------------------------------------------------
+PrimeSense Sensor Module for OpenNI (Version 5.1.0.41 version - Dec 28th 2011)
+------------------------------------------------------------------------------
 
 Website: http://www.primesense.com
 Forum: http://groups.google.com/group/openni-dev
@@ -35,7 +35,7 @@ Build Notes:
 ------------
 Windows:
 	Requirements:
-		1) Microsoft Visual Studio 2010
+		1) Microsoft Visual Studio 2008/2010
 		   From: http://msdn.microsoft.com/en-us/vstudio/bb984878.aspx
 		2) Python 2.6+/3.x
 		   From: http://www.python.org/download/
@@ -44,7 +44,7 @@ Windows:
 		   Please make sure you download the version that matches your exact python version.
 		4) WIX 3.5
 		   From: http://wix.codeplex.com/releases/view/60102
-		5) OpenNI 1.5.x.x
+		5) OpenNI 1.3.x.x
 		   From: http://www.openni.org/Downloads/OpenNIModules.aspx	
 
 	Optional Requirements (To build the documentation):
@@ -75,7 +75,7 @@ Linux:
 		   From: http://www.python.org/download/
 		   Or via apt:
 		   sudo apt-get install python
-		3) OpenNI 1.5.x.x
+		3) OpenNI 1.3.x.x
 		   From: http://www.openni.org/Downloads/OpenNIModules.aspx
 		   
 	Building Sensor:
@@ -123,25 +123,11 @@ Linux:
 		
 MacOSX:
 	Requirements:
-		1) For Mac OSX 10.7, Xcode 4.3.2
-		      From: http://developer.apple.com/devcenter/mac/index.action
-		      http://adcdownload.apple.com/Developer_Tools/xcode_4.3.2/xcode_432_lion.dmg    
-   
-		      You will also need to download and install the "Commandline Tools for XCode - Late March 2012" package:
-		      http://adcdownload.apple.com/Developer_Tools/command_line_tools_for_xcode_4.4__late_march_2012/cltools_lion_latemarch12.dmg
-		   
-		      Note: Since Xcode is now a normal application, it no longer automatically install itself. You have to copy&paste Xcode yourself into your Applications folder. 
-			        (or run the application "Install Xcode" from your Applications folder / LaunchPad). 		   
-			        It's also recommended to run the following command after you do the above:
-				      sudo xcode-select -switch /Applications/Xcode.app/
-		   
-		   For Mac OSX 10.6, Xcode 3.2.6:
-		      From: http://developer.apple.com/devcenter/mac/index.action
-		      http://developer.apple.com/devcenter/download.action?path=/Developer_Tools/xcode_3.2.6_and_ios_sdk_4.3__final/xcode_3.2.6_and_ios_sdk_4.3.dmg
-			   
-		   Please note that you need to register as a mac developer (It's free!).
-		   
-		2) OpenNI 1.5.x.x
+		1) Xcode 3.2.6
+		   From: http://developer.apple.com/devcenter/mac/index.action
+		   http://developer.apple.com/devcenter/download.action?path=/Developer_Tools/xcode_3.2.6_and_ios_sdk_4.3__final/xcode_3.2.6_and_ios_sdk_4.3.dmg
+		   Please note that you need to register as a mac developer (It's free!).		   
+		2) OpenNI 1.3.x.x
 		   From: http://www.openni.org/Downloads/OpenNIModules.aspx
 		   	   
 	Building Sensor:
diff --git a/Include/XnCommon.h b/Source/XnCommon/XnCommon.h
similarity index 100%
rename from Include/XnCommon.h
rename to Source/XnCommon/XnCommon.h
diff --git a/Source/XnDDK/IXnDevice.h b/Source/XnDDK/IXnDevice.h
index 8162dcf..073dcdf 100644
--- a/Source/XnDDK/IXnDevice.h
+++ b/Source/XnDDK/IXnDevice.h
@@ -111,9 +111,9 @@ public:
 	* 
 	* @param	Handler			[in]	A pointer to the function that will handle the event.
 	* @param	pCookie			[in]	User cookie that will be passed as an argument to the event handler.
-	* @param	hCallback		[out]	A handle for unregister.
+	* @param	phCallback		[out]	A handle for unregister.
 	*/
-	virtual XnStatus RegisterToStreamsChange(XnDeviceOnStreamsChangedEventHandler Handler, void* pCookie, XnCallbackHandle& hCallback) = 0;
+	virtual XnStatus RegisterToStreamsChange(XnDeviceOnStreamsChangedEventHandler Handler, void* pCookie, XnCallbackHandle* phCallback) = 0;
 
 	/**
 	* Unregisters from the event of streams change (stream created / destroyed)
@@ -135,9 +135,9 @@ public:
 	* 
 	* @param	Handler			[in]	A pointer to the function that will handle the event.
 	* @param	pCookie			[in]	User cookie that will be passed as an argument to the event handler.
-	* @param	hCallback		[out]	A handle for unregister.
+	* @param	phCallback		[out]	A handle for unregister.
 	*/
-	virtual XnStatus RegisterToNewStreamData(XnDeviceOnNewStreamDataEventHandler Handler, void* pCookie, XnCallbackHandle& hCallback) = 0;
+	virtual XnStatus RegisterToNewStreamData(XnDeviceOnNewStreamDataEventHandler Handler, void* pCookie, XnCallbackHandle* phCallback) = 0;
 
 	/**
 	* Unregisters from the event of new data from a stream.
@@ -331,9 +331,9 @@ public:
 	* @param	PropertyName	[in]	Name of the property to register to.
 	* @param	Handler			[in]	A pointer to the function that will handle the event.
 	* @param	pCookie			[in]	User cookie that will be passed as an argument to the event handler.
-	* @param	hCallback		[out]	A handle for unregister.
+	* @param	phCallback		[out]	A handle for unregister.
 	*/
-	virtual XnStatus RegisterToPropertyChange(const XnChar* Module, const XnChar* PropertyName, XnDeviceOnPropertyChangedEventHandler Handler, void* pCookie, XnCallbackHandle& hCallback) = 0;
+	virtual XnStatus RegisterToPropertyChange(const XnChar* Module, const XnChar* PropertyName, XnDeviceOnPropertyChangedEventHandler Handler, void* pCookie, XnCallbackHandle* phCallback) = 0;
 
 	/**
 	* Unregisters an event handler from the Property Changed event.
diff --git a/Source/XnDDK/XnActualPropertiesHash.cpp b/Source/XnDDK/XnActualPropertiesHash.cpp
index 281dea1..f0e4e64 100644
--- a/Source/XnDDK/XnActualPropertiesHash.cpp
+++ b/Source/XnDDK/XnActualPropertiesHash.cpp
@@ -34,9 +34,9 @@ XnActualPropertiesHash::XnActualPropertiesHash(const XnChar* strName)
 XnActualPropertiesHash::~XnActualPropertiesHash()
 {
 	// free all properties
-	for (Iterator it = Begin(); it != End(); ++it)
+	for (Iterator it = begin(); it != end(); ++it)
 	{
-		XN_DELETE(it->Value());
+		XN_DELETE(it.Value());
 	}
 }
 
@@ -44,7 +44,7 @@ XnStatus XnActualPropertiesHash::Add(const XnChar* strName, XnUInt64 nValue)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 
-	Iterator it = End();
+	Iterator it = end();
 	if (XN_STATUS_OK == Find(strName, it))
 	{
 		return XN_STATUS_DEVICE_PROPERTY_ALREADY_EXISTS;
@@ -69,7 +69,7 @@ XnStatus XnActualPropertiesHash::Add(const XnChar* strName, XnDouble dValue)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 
-	Iterator it = End();
+	Iterator it = end();
 	if (XN_STATUS_OK == Find(strName, it))
 	{
 		return XN_STATUS_DEVICE_PROPERTY_ALREADY_EXISTS;
@@ -94,7 +94,7 @@ XnStatus XnActualPropertiesHash::Add(const XnChar* strName, const XnChar* strVal
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 
-	Iterator it = End();
+	Iterator it = end();
 	if (XN_STATUS_OK == Find(strName, it))
 	{
 		return XN_STATUS_DEVICE_PROPERTY_ALREADY_EXISTS;
@@ -119,7 +119,7 @@ XnStatus XnActualPropertiesHash::Add(const XnChar* strName, const XnGeneralBuffe
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 
-	Iterator it = End();
+	Iterator it = end();
 	if (XN_STATUS_OK == Find(strName, it))
 	{
 		return XN_STATUS_DEVICE_PROPERTY_ALREADY_EXISTS;
@@ -154,18 +154,23 @@ XnStatus XnActualPropertiesHash::Remove(const XnChar* strName)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 	
-	ConstIterator it;
-	nRetVal = Find(strName, it);
+	XnProperty* pProp = NULL;
+	nRetVal = m_Hash.Remove(strName, pProp);
 	XN_IS_STATUS_OK(nRetVal);
 
-	return Remove(it);
+	if (pProp != NULL)
+	{
+		XN_DELETE(pProp);
+	}
+	
+	return (XN_STATUS_OK);
 }
 
 XnStatus XnActualPropertiesHash::Remove(ConstIterator where)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 
-	XnProperty* pProp = where->Value();
+	XnProperty* pProp = where.Value();
 
 	nRetVal = m_Hash.Remove(where);
 	XN_IS_STATUS_OK(nRetVal);
@@ -179,7 +184,7 @@ XnStatus XnActualPropertiesHash::Clear()
 {
 	while (!IsEmpty())
 	{
-		Remove(Begin());
+		Remove(begin());
 	}
 
 	return XN_STATUS_OK;
@@ -192,40 +197,40 @@ XnStatus XnActualPropertiesHash::CopyFrom(const XnActualPropertiesHash& other)
 	Clear();
 	strncpy(m_strName, other.m_strName, XN_DEVICE_MAX_STRING_LENGTH);
 
-	for (ConstIterator it = other.Begin(); it != other.End(); ++it)
+	for (ConstIterator it = other.begin(); it != other.end(); ++it)
 	{
-		switch (it->Value()->GetType())
+		switch (it.Value()->GetType())
 		{
 		case XN_PROPERTY_TYPE_INTEGER:
 			{
-				XnActualIntProperty* pProp = (XnActualIntProperty*)it->Value();
+				XnActualIntProperty* pProp = (XnActualIntProperty*)it.Value();
 				nRetVal = Add(pProp->GetName(), pProp->GetValue());
 				XN_IS_STATUS_OK(nRetVal);
 				break;
 			}
 		case XN_PROPERTY_TYPE_REAL:
 			{
-				XnActualRealProperty* pProp = (XnActualRealProperty*)it->Value();
+				XnActualRealProperty* pProp = (XnActualRealProperty*)it.Value();
 				nRetVal = Add(pProp->GetName(), pProp->GetValue());
 				XN_IS_STATUS_OK(nRetVal);
 				break;
 			}
 		case XN_PROPERTY_TYPE_STRING:
 			{
-				XnActualStringProperty* pProp = (XnActualStringProperty*)it->Value();
+				XnActualStringProperty* pProp = (XnActualStringProperty*)it.Value();
 				nRetVal = Add(pProp->GetName(), pProp->GetValue());
 				XN_IS_STATUS_OK(nRetVal);
 				break;
 			}
 		case XN_PROPERTY_TYPE_GENERAL:
 			{
-				XnActualGeneralProperty* pProp = (XnActualGeneralProperty*)it->Value();
+				XnActualGeneralProperty* pProp = (XnActualGeneralProperty*)it.Value();
 				nRetVal = Add(pProp->GetName(), pProp->GetValue());
 				XN_IS_STATUS_OK(nRetVal);
 				break;
 			}
 		default:
-			XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_DDK, "Unknown property type: %d\n", it->Value()->GetType());
+			XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_DDK, "Unknown property type: %d\n", it.Value()->GetType());
 		}
 	}
 
diff --git a/Source/XnDDK/XnActualPropertiesHash.h b/Source/XnDDK/XnActualPropertiesHash.h
index 1539228..0061dac 100644
--- a/Source/XnDDK/XnActualPropertiesHash.h
+++ b/Source/XnDDK/XnActualPropertiesHash.h
@@ -55,10 +55,10 @@ public:
 	inline XnStatus Find(const XnChar* strName, ConstIterator& iter) const { return m_Hash.Find(strName, iter); }
 	inline XnStatus Get(const XnChar* strName, XnProperty*& pProp) const { return m_Hash.Get(strName, pProp); }
 
-	inline Iterator Begin() { return m_Hash.Begin(); }
-	inline ConstIterator Begin() const { return m_Hash.Begin(); }
-	inline Iterator End() { return m_Hash.End(); }
-	inline ConstIterator End() const { return m_Hash.End(); }
+	inline Iterator begin() { return m_Hash.begin(); }
+	inline ConstIterator begin() const { return m_Hash.begin(); }
+	inline Iterator end() { return m_Hash.end(); }
+	inline ConstIterator end() const { return m_Hash.end(); }
 
 	XnStatus CopyFrom(const XnActualPropertiesHash& other);
 
diff --git a/Source/XnDDK/XnBufferPool.cpp b/Source/XnDDK/XnBufferPool.cpp
index c150d87..d626cf6 100644
--- a/Source/XnDDK/XnBufferPool.cpp
+++ b/Source/XnDDK/XnBufferPool.cpp
@@ -28,9 +28,9 @@
 // Code
 //---------------------------------------------------------------------------
 
-XnBufferPool::XnBufferPool() :
+XnBufferPool::XnBufferPool(XnUInt32 nBufferCount) :
+	m_nBufferCount(nBufferCount),
 	m_nBufferSize(0),
-	m_nNextBufferID(0),
 	m_hLock(NULL),
 	m_dump(NULL)
 {}
@@ -50,7 +50,6 @@ XnStatus XnBufferPool::Init(XnUInt32 nBufferSize)
 	XN_IS_STATUS_OK(nRetVal);
 
 	// allocate buffers
-	xnDumpFileWriteString(m_dump, "Initializing with size %u\n", nBufferSize);
 	nRetVal = ChangeBufferSize(nBufferSize);
 	XN_IS_STATUS_OK(nRetVal);
 
@@ -70,24 +69,19 @@ XnStatus XnBufferPool::ChangeBufferSize(XnUInt32 nBufferSize)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 
-	xnDumpFileWriteString(m_dump, "Changing buffer size to %d\n", nBufferSize);
+	xnDumpFileWriteString(m_dump, "changing buffer size to %d\n", nBufferSize);
 
 	xnOSEnterCriticalSection(&m_hLock);
 
 	m_nBufferSize = nBufferSize;
 
-	// first free old ones
-	FreeAll(FALSE);
-
-	nRetVal = AllocateBuffers(nBufferSize);
+	nRetVal = AllocateBuffers();
 	if (nRetVal != XN_STATUS_OK)
 	{
 		xnOSLeaveCriticalSection(&m_hLock);
 		return (nRetVal);
 	}
 
-	xnDumpFileWriteString(m_dump, "Buffers were allocated\n");
-
 	xnOSLeaveCriticalSection(&m_hLock);
 	
 	return (XN_STATUS_OK);
@@ -96,10 +90,8 @@ XnStatus XnBufferPool::ChangeBufferSize(XnUInt32 nBufferSize)
 void XnBufferPool::FreeAll(XnBool bForceDestroyOfLockedBuffers)
 {
 	// free existing buffers
-	xnDumpFileWriteString(m_dump, "freeing existing buffers...\n");
-
-	XnBuffersList::Iterator it = m_AllBuffers.Begin();
-	while (it != m_AllBuffers.End())
+	XnBuffersList::Iterator it = m_AllBuffers.begin();
+	while (it != m_AllBuffers.end())
 	{
 		XnBuffersList::Iterator currIt = it;
 
@@ -112,43 +104,17 @@ void XnBufferPool::FreeAll(XnBool bForceDestroyOfLockedBuffers)
 		// check if item is in free list (or we're forcing deletion)
 		if (bForceDestroyOfLockedBuffers || pBuffer->m_nRefCount == 0)
 		{
-			xnDumpFileWriteString(m_dump, "\tdestroying buffer %u\n", pBuffer->m_nID);
-			DestroyBuffer((void*)pBuffer->GetData());
-			XN_DELETE(pBuffer);
+			DestroyBuffer(pBuffer);
 			m_AllBuffers.Remove(currIt);
 		}
 		else
 		{
 			// we can't free it, cause it's still locked. instead, mark it for deletion
-			xnDumpFileWriteString(m_dump, "\tBuffer %u can't be destroyed right now (locked). Just mark it for destruction.\n", pBuffer->m_nID);
 			pBuffer->m_bDestroy = TRUE;
 		}
 	}
 
 	m_FreeBuffers.Clear();
-
-	xnDumpFileWriteString(m_dump, "Buffers were freed\n");
-}
-
-XnStatus XnBufferPool::AddNewBuffer(void* pBuffer, XnUInt32 nSize)
-{
-	XnBufferInPool* pBufferInPool;
-	XN_VALIDATE_NEW(pBufferInPool, XnBufferInPool);
-
-	xnOSEnterCriticalSection(&m_hLock);
-
-	pBufferInPool->m_nID = m_nNextBufferID++;
-	pBufferInPool->SetExternalBuffer((XnUChar*)pBuffer, nSize);
-
-	xnDumpFileWriteString(Dump(), "\tAdd new buffer %u with size %u at 0x%p\n", pBufferInPool->m_nID, nSize, pBuffer);
-
-	// add it to free list
-	m_AllBuffers.AddLast(pBufferInPool);
-	m_FreeBuffers.AddLast(pBufferInPool);
-
-	xnOSLeaveCriticalSection(&m_hLock);
-
-	return XN_STATUS_OK;
 }
 
 XnStatus XnBufferPool::GetBuffer(XnBuffer** ppBuffer)
@@ -157,8 +123,8 @@ XnStatus XnBufferPool::GetBuffer(XnBuffer** ppBuffer)
 	
 	xnOSEnterCriticalSection(&m_hLock);
 
-	XnBuffersList::Iterator it = m_FreeBuffers.Begin();
-	if (it == m_FreeBuffers.End())
+	XnBuffersList::Iterator it = m_FreeBuffers.begin();
+	if (it == m_FreeBuffers.end())
 	{
 		xnOSLeaveCriticalSection(&m_hLock);
 		return XN_STATUS_ALLOC_FAILED;
@@ -188,7 +154,6 @@ void XnBufferPool::AddRef(XnBuffer* pBuffer)
 {
 	if (pBuffer == NULL)
 	{
-		XN_ASSERT(FALSE);
 		return;
 	}
 
@@ -205,7 +170,6 @@ void XnBufferPool::DecRef(XnBuffer* pBuffer)
 {
 	if (pBuffer == NULL)
 	{
-		XN_ASSERT(FALSE);
 		return;
 	}
 
@@ -221,10 +185,10 @@ void XnBufferPool::DecRef(XnBuffer* pBuffer)
 		{
 			// remove it from all buffers pool
 			XnBuffersList::ConstIterator it = m_AllBuffers.Find(pBufInPool);
-			XN_ASSERT(it != m_AllBuffers.End());
+			XN_ASSERT(it != m_AllBuffers.end());
 			m_AllBuffers.Remove(it);
 			// and free it
-			DestroyBuffer((void*)pBufInPool->GetData());
+			DestroyBuffer(pBufInPool);
 			xnDumpFileWriteString(m_dump, "destroy!\n");
 		}
 		else
diff --git a/Source/XnDDK/XnBufferPool.h b/Source/XnDDK/XnBufferPool.h
index a591763..cfcc2f8 100644
--- a/Source/XnDDK/XnBufferPool.h
+++ b/Source/XnDDK/XnBufferPool.h
@@ -26,7 +26,7 @@
 // Includes
 //---------------------------------------------------------------------------
 #include <XnCore/XnBuffer.h>
-#include <XnListT.h>
+#include <XnList.h>
 #include <XnLog.h>
 #include <XnDDK.h>
 
@@ -50,7 +50,7 @@ private:
 class XN_DDK_CPP_API XnBufferPool
 {
 public:
-	XnBufferPool();
+	XnBufferPool(XnUInt32 nBufferCount);
 	virtual ~XnBufferPool();
 
 	XnStatus Init(XnUInt32 nBufferSize);
@@ -61,24 +61,25 @@ public:
 	XnStatus GetBuffer(XnBuffer** ppBuffer);
 
 	void AddRef(XnBuffer* pBuffer);
+
 	void DecRef(XnBuffer* pBuffer);
 
 	inline void Lock() { xnOSEnterCriticalSection(&m_hLock); }
 	inline void Unlock() { xnOSLeaveCriticalSection(&m_hLock); }
 
-protected:
 	inline XnDumpFile* Dump() { return m_dump; }
-	XnStatus AddNewBuffer(void* pBuffer, XnUInt32 nSize);
-	void FreeAll(XnBool bForceDestroyOfLockedBuffers);
 
-	virtual XnStatus AllocateBuffers(XnUInt32 nSize) = 0;
-	virtual void DestroyBuffer(void* pBuffer) = 0;
+protected:
+	XN_DECLARE_LIST(XnBufferInPool*, XnBuffersList);
+
+	void FreeAll(XnBool bForceDestroyOfLockedBuffers);
 
-private:
-	typedef XnListT<XnBufferInPool*> XnBuffersList;
+	virtual XnStatus AllocateBuffers() = 0;
+	virtual void DestroyBuffer(XnBufferInPool* pBuffer) = 0;
 
+protected:
 	XnUInt32 m_nBufferSize;
-	XnUInt32 m_nNextBufferID;
+	XnUInt32 m_nBufferCount;
 	XnBuffersList m_AllBuffers;
 	XnBuffersList m_FreeBuffers; // a list of available buffers
 	XN_CRITICAL_SECTION_HANDLE m_hLock;
diff --git a/Source/XnDDK/XnDataPacker.cpp b/Source/XnDDK/XnDataPacker.cpp
index dee6ea6..2eb97f8 100644
--- a/Source/XnDDK/XnDataPacker.cpp
+++ b/Source/XnDDK/XnDataPacker.cpp
@@ -165,43 +165,43 @@ XnStatus XnDataPacker::WritePropertySetProperties(const XnPropertySet* pSet)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 
-	for (XnPropertySetData::Iterator it = pSet->pData->Begin(); it != pSet->pData->End(); ++it)
+	for (XnPropertySetData::Iterator it = pSet->pData->begin(); it != pSet->pData->end(); ++it)
 	{
-		XnActualPropertiesHash* pModule = it->Value();
-		for (XnActualPropertiesHash::ConstIterator itProp = pModule->Begin(); itProp != pModule->End(); ++itProp)
+		XnActualPropertiesHash* pModule = it.Value();
+		for (XnActualPropertiesHash::ConstIterator itProp = pModule->begin(); itProp != pModule->end(); ++itProp)
 		{
-			switch (itProp->Value()->GetType())
+			switch (itProp.Value()->GetType())
 			{
 			case XN_PROPERTY_TYPE_INTEGER:
 				{
-					XnActualIntProperty* pProp = (XnActualIntProperty*)itProp->Value();
+					XnActualIntProperty* pProp = (XnActualIntProperty*)itProp.Value();
 					nRetVal = WritePropertyImpl(pProp->GetModule(), pProp->GetName(), pProp->GetValue());
 					XN_IS_STATUS_OK(nRetVal);
 					break;
 				}
 			case XN_PROPERTY_TYPE_REAL:
 				{
-					XnActualRealProperty* pProp = (XnActualRealProperty*)itProp->Value();
+					XnActualRealProperty* pProp = (XnActualRealProperty*)itProp.Value();
 					nRetVal = WritePropertyImpl(pProp->GetModule(), pProp->GetName(), pProp->GetValue());
 					XN_IS_STATUS_OK(nRetVal);
 					break;
 				}
 			case XN_PROPERTY_TYPE_STRING:
 				{
-					XnActualStringProperty* pProp = (XnActualStringProperty*)itProp->Value();
+					XnActualStringProperty* pProp = (XnActualStringProperty*)itProp.Value();
 					nRetVal = WritePropertyImpl(pProp->GetModule(), pProp->GetName(), pProp->GetValue());
 					XN_IS_STATUS_OK(nRetVal);
 					break;
 				}
 			case XN_PROPERTY_TYPE_GENERAL:
 				{
-					XnActualGeneralProperty* pProp = (XnActualGeneralProperty*)itProp->Value();
+					XnActualGeneralProperty* pProp = (XnActualGeneralProperty*)itProp.Value();
 					nRetVal = WritePropertyImpl(pProp->GetModule(), pProp->GetName(), pProp->GetValue());
 					XN_IS_STATUS_OK(nRetVal);
 					break;
 				}
 			default:
-				XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_DDK, "Unknown property type: %d", itProp->Value()->GetType());
+				XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_DDK, "Unknown property type: %d", itProp.Value()->GetType());
 			}
 		}
 	}
@@ -219,9 +219,9 @@ XnStatus XnDataPacker::WritePropertySetImpl(const XnPropertySet* pPropertySet)
 	StartWritingIntenalObject(XN_PACKED_PROPERTY_SET);
 
 	// Write module names
-	for (XnPropertySetData::Iterator it = pPropertySet->pData->Begin(); it != pPropertySet->pData->End(); ++it)
+	for (XnPropertySetData::Iterator it = pPropertySet->pData->begin(); it != pPropertySet->pData->end(); ++it)
 	{
-		nRetVal = WriteString(it->Key());
+		nRetVal = WriteString(it.Key());
 		XN_IS_STATUS_OK(nRetVal);
 	}
 
diff --git a/Source/XnDDK/XnDeviceBase.cpp b/Source/XnDDK/XnDeviceBase.cpp
index 6007ea3..fc375ba 100644
--- a/Source/XnDDK/XnDeviceBase.cpp
+++ b/Source/XnDDK/XnDeviceBase.cpp
@@ -52,6 +52,26 @@ typedef struct XnWaitForStreamData
 	XnDeviceStream* pStream;
 } XnWaitForStreamData;
 
+typedef struct XnPropertyCallback
+{
+	XnPropertyCallback(XnDeviceHandle DeviceHandle, const XnChar* strModule, const XnChar* strProp, XnDeviceOnPropertyChangedEventHandler pHandler, void* pCookie) :
+		DeviceHandle(DeviceHandle),
+		pHandler(pHandler),
+		pCookie(pCookie)
+	{
+		strcpy(this->strModule, strModule);
+		strcpy(this->strProp, strProp);
+	}
+
+	XnDeviceHandle DeviceHandle;
+	XnChar strModule[XN_DEVICE_MAX_STRING_LENGTH];
+	XnChar strProp[XN_DEVICE_MAX_STRING_LENGTH];
+	XnDeviceOnPropertyChangedEventHandler pHandler;
+	void* pCookie;
+	XnCallbackHandle hCallback;
+
+} XnPropertyCallback;
+
 //---------------------------------------------------------------------------
 // Public Methods
 //---------------------------------------------------------------------------
@@ -154,7 +174,7 @@ XnStatus XnDeviceBase::Destroy()
 	// free all modules
 	while (m_Modules.Size() != 0)
 	{
-		XnDeviceModuleHolder* pModuleHolder = m_Modules.Begin()->Value();
+		XnDeviceModuleHolder* pModuleHolder = (XnDeviceModuleHolder*)m_Modules.begin().Value();
 		if (IsStream(pModuleHolder->GetModule()))
 		{
 			XnChar strName[XN_DEVICE_MAX_STRING_LENGTH];
@@ -165,11 +185,11 @@ XnStatus XnDeviceBase::Destroy()
 		else
 		{
 			// free memory of registered properties to this module
-			FreeModuleRegisteredProperties(m_Modules.Begin()->Key());
+			FreeModuleRegisteredProperties(m_Modules.begin().Key());
 
 			pModuleHolder->GetModule()->Free();
 			DestroyModule(pModuleHolder);
-			m_Modules.Remove(m_Modules.Begin());
+			m_Modules.Remove(m_Modules.begin());
 		}
 	}
 
@@ -266,9 +286,9 @@ XnStatus XnDeviceBase::SetMirror(XnBool bMirror)
 	XnStatus nRetVal = XN_STATUS_OK;
 	
 	// change all streams
-	for (ModuleHoldersHash::Iterator it = m_Modules.Begin(); it != m_Modules.End(); ++it)
+	for (XnStringsHash::Iterator it = m_Modules.begin(); it != m_Modules.end(); ++it)
 	{
-		XnDeviceModuleHolder* pModuleHolder = it->Value();
+		XnDeviceModuleHolder* pModuleHolder = (XnDeviceModuleHolder*)it.Value();
 		if (IsStream(pModuleHolder->GetModule()))
 		{
 			XnDeviceStream* pStream = (XnDeviceStream*)pModuleHolder->GetModule();
@@ -311,9 +331,9 @@ XnStatus XnDeviceBase::GetSupportedStreams(const XnChar** aStreamNames, XnUInt32
 
 	// now copy values
 	nStreamsCount = 0;
-	for (XnStringsSet::Iterator it = m_SupportedStreams.Begin(); it != m_SupportedStreams.End(); ++it)
+	for (XnStringsHash::Iterator it = m_SupportedStreams.begin(); it != m_SupportedStreams.end(); ++it)
 	{
-		aStreamNames[nStreamsCount] = it->Key();
+		aStreamNames[nStreamsCount] = it.Key();
 		nStreamsCount++;
 	}
 
@@ -372,9 +392,9 @@ XnStatus XnDeviceBase::OpenAllStreams()
 	xnLogVerbose(XN_MASK_DDK, "Opening all streams...");
 
 	// go over modules list, and look for closed streams
-	for (ModuleHoldersHash::Iterator it = m_Modules.Begin(); it != m_Modules.End(); ++it)
+	for (XnStringsHash::Iterator it = m_Modules.begin(); it != m_Modules.end(); ++it)
 	{
-		XnDeviceModuleHolder* pModuleHolder = it->Value();
+		XnDeviceModuleHolder* pModuleHolder = (XnDeviceModuleHolder*)it.Value();
 		if (IsStream(pModuleHolder->GetModule()))
 		{
 			XnDeviceStream* pStream = (XnDeviceStream*)pModuleHolder->GetModule();
@@ -398,9 +418,9 @@ XnStatus XnDeviceBase::CloseAllStreams()
 	xnLogVerbose(XN_MASK_DDK, "Closing all streams...");
 
 	// go over modules list, and look for closed streams
-	for (ModuleHoldersHash::Iterator it = m_Modules.Begin(); it != m_Modules.End(); ++it)
+	for (XnStringsHash::Iterator it = m_Modules.begin(); it != m_Modules.end(); ++it)
 	{
-		XnDeviceModuleHolder* pModuleHolder = it->Value();
+		XnDeviceModuleHolder* pModuleHolder = (XnDeviceModuleHolder*)it.Value();
 		if (IsStream(pModuleHolder->GetModule()))
 		{
 			XnDeviceStream* pStream = (XnDeviceStream*)pModuleHolder->GetModule();
@@ -422,9 +442,9 @@ XnStatus XnDeviceBase::GetStreamNames(const XnChar** pstrNames, XnUInt32* pnName
 	// first we need to count them
 	XnUInt32 nCount = 0;
 
-	for (ModuleHoldersHash::Iterator it = m_Modules.Begin(); it != m_Modules.End(); ++it)
+	for (XnStringsHash::Iterator it = m_Modules.begin(); it != m_Modules.end(); ++it)
 	{
-		XnDeviceModuleHolder* pModuleHolder = it->Value();
+		XnDeviceModuleHolder* pModuleHolder = (XnDeviceModuleHolder*)it.Value();
 		if (IsStream(pModuleHolder->GetModule()))
 		{
 			nCount++;
@@ -439,12 +459,12 @@ XnStatus XnDeviceBase::GetStreamNames(const XnChar** pstrNames, XnUInt32* pnName
 
 	// OK. we have enough space. Copy into it
 	nCount = 0;
-	for (ModuleHoldersHash::Iterator it = m_Modules.Begin(); it != m_Modules.End(); ++it)
+	for (XnStringsHash::Iterator it = m_Modules.begin(); it != m_Modules.end(); ++it)
 	{
-		XnDeviceModuleHolder* pModuleHolder = it->Value();
+		XnDeviceModuleHolder* pModuleHolder = (XnDeviceModuleHolder*)it.Value();
 		if (IsStream(pModuleHolder->GetModule()))
 		{
-			pstrNames[nCount] = it->Key();
+			pstrNames[nCount] = it.Key();
 			nCount++;
 		}
 	}
@@ -477,11 +497,11 @@ XnStatus XnDeviceBase::DoesModuleExist(const XnChar* ModuleName, XnBool* pbDoesE
 	return XN_STATUS_OK;
 }
 
-XnStatus XnDeviceBase::RegisterToStreamsChange(XnDeviceOnStreamsChangedEventHandler Handler, void* pCookie, XnCallbackHandle& hCallback)
+XnStatus XnDeviceBase::RegisterToStreamsChange(XnDeviceOnStreamsChangedEventHandler Handler, void* pCookie, XnCallbackHandle* phCallback)
 {
 	XN_VALIDATE_INPUT_PTR(Handler);
 
-	return m_OnStreamsChangeEvent.Register((StreamCollectionChangedEvent::HandlerPtr)Handler, pCookie, hCallback);
+	return m_OnStreamsChangeEvent.Register((StreamCollectionChangedEvent::HandlerPtr)Handler, pCookie, phCallback);
 }
 
 XnStatus XnDeviceBase::UnregisterFromStreamsChange(XnCallbackHandle hCallback)
@@ -517,11 +537,11 @@ XnStatus XnDeviceBase::DestroyStreamData(XnStreamData** ppStreamData)
 	return XnStreamDataDestroy(ppStreamData);
 }
 
-XnStatus XnDeviceBase::RegisterToNewStreamData(XnDeviceOnNewStreamDataEventHandler Handler, void* pCookie, XnCallbackHandle& hCallback)
+XnStatus XnDeviceBase::RegisterToNewStreamData(XnDeviceOnNewStreamDataEventHandler Handler, void* pCookie, XnCallbackHandle* phCallback)
 {
 	XN_VALIDATE_INPUT_PTR(Handler);
 
-	return m_OnNewStreamDataEvent.Register(Handler, pCookie, hCallback);
+	return m_OnNewStreamDataEvent.Register(Handler, pCookie, phCallback);
 }
 
 XnStatus XnDeviceBase::UnregisterFromNewStreamData(XnCallbackHandle hCallback)
@@ -1007,14 +1027,14 @@ XnStatus XnDeviceBase::BatchConfig(const XnPropertySet* pChangeSet)
 	nRetVal = StartTransaction();
 	XN_IS_STATUS_OK(nRetVal);
 
-	for (XnPropertySetData::ConstIterator itModule = pChangeSet->pData->Begin(); itModule != pChangeSet->pData->End(); ++itModule)
+	for (XnPropertySetData::ConstIterator itModule = pChangeSet->pData->begin(); itModule != pChangeSet->pData->end(); ++itModule)
 	{
 		// find this module
 		XnDeviceModule* pModule = NULL;
-		nRetVal = FindModule(itModule->Key(), &pModule);
+		nRetVal = FindModule(itModule.Key(), &pModule);
 		XN_CHECK_RC_ROLLBACK(nRetVal);
 
-		nRetVal = pModule->BatchConfig(*itModule->Value());
+		nRetVal = pModule->BatchConfig(*itModule.Value());
 		XN_CHECK_RC_ROLLBACK(nRetVal);
 	}
 
@@ -1046,9 +1066,9 @@ XnStatus XnDeviceBase::GetAllProperties(XnPropertySet* pSet, XnBool bNoStreams /
 	else
 	{
 		// enumerate over modules
-		for (ModuleHoldersHash::Iterator it = m_Modules.Begin(); it != m_Modules.End(); ++it)
+		for (XnStringsHash::Iterator it = m_Modules.begin(); it != m_Modules.end(); ++it)
 		{
-			XnDeviceModuleHolder* pModuleHolder = it->Value();
+			XnDeviceModuleHolder* pModuleHolder = (XnDeviceModuleHolder*)it.Value();
 
 			if (bNoStreams && IsStream(pModuleHolder->GetModule()))
 				continue;
@@ -1061,7 +1081,7 @@ XnStatus XnDeviceBase::GetAllProperties(XnPropertySet* pSet, XnBool bNoStreams /
 	return XN_STATUS_OK;
 }
 
-XnStatus XnDeviceBase::RegisterToPropertyChange(const XnChar* Module, const XnChar* PropertyName, XnDeviceOnPropertyChangedEventHandler Handler, void* pCookie, XnCallbackHandle& hCallback)
+XnStatus XnDeviceBase::RegisterToPropertyChange(const XnChar* Module, const XnChar* PropertyName, XnDeviceOnPropertyChangedEventHandler Handler, void* pCookie, XnCallbackHandle* phCallback)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 	
@@ -1069,11 +1089,11 @@ XnStatus XnDeviceBase::RegisterToPropertyChange(const XnChar* Module, const XnCh
 	nRetVal = FindModule(Module, &pModule);
 	XN_IS_STATUS_OK(nRetVal);
 
-	XnPropertyCallback* pRealCookie = NULL;
+	XnPropertyCallback* pRealCookie;
 	XN_VALIDATE_NEW(pRealCookie, XnPropertyCallback, GetDeviceHandle(), Module, PropertyName, Handler, pCookie);
 
 	// register
-	nRetVal = pModule->RegisterForOnPropertyValueChanged(PropertyName, PropertyValueChangedCallback, pRealCookie, pRealCookie->hCallback);
+	nRetVal = pModule->RegisterForOnPropertyValueChanged(PropertyName, PropertyValueChangedCallback, pRealCookie, &pRealCookie->hCallback);
 	if (nRetVal != XN_STATUS_OK)
 	{
 		XN_DELETE(pRealCookie);
@@ -1082,7 +1102,7 @@ XnStatus XnDeviceBase::RegisterToPropertyChange(const XnChar* Module, const XnCh
 
 	m_PropertyCallbacks.AddLast(pRealCookie);
 
-	hCallback = pRealCookie;
+	*phCallback = pRealCookie;
 	
 	return (XN_STATUS_OK);
 }
@@ -1105,8 +1125,9 @@ XnStatus XnDeviceBase::UnregisterFromPropertyChange(const XnChar* Module, const
 	nRetVal = pModule->UnregisterFromOnPropertyValueChanged(PropertyName, pRealCookie->hCallback);
 	XN_IS_STATUS_OK(nRetVal);
 
-	PropertiesCallbacks::Iterator it = m_PropertyCallbacks.Find(pRealCookie);
-	if (it != m_PropertyCallbacks.End())
+	XnValue val = pRealCookie;
+	XnList::Iterator it = m_PropertyCallbacks.Find(val);
+	if (it != m_PropertyCallbacks.end())
 	{
 		m_PropertyCallbacks.Remove(it);
 	}
@@ -1126,7 +1147,8 @@ XnStatus XnDeviceBase::AddModule(XnDeviceModuleHolder* pModuleHolder)
 	XnDeviceModule* pModule = pModuleHolder->GetModule();
 
 	// make sure module doesn't exist yet
-	if (m_Modules.Find(pModule->GetName()) != m_Modules.End())
+	XnStringsHash::Iterator it = m_Modules.end();
+	if (XN_STATUS_OK == m_Modules.Find(pModule->GetName(), it))
 	{
 		xnLogError(XN_MASK_DEVICE, "A module with the name %s already exists!", pModule->GetName());
 		return XN_STATUS_ERROR;
@@ -1142,7 +1164,8 @@ XnStatus XnDeviceBase::AddModule(XnDeviceModuleHolder* pModuleHolder)
 XnStatus XnDeviceBase::RemoveModule(const XnChar* ModuleName)
 {
 	// remove it
-	XnStatus nRetVal = m_Modules.Remove(ModuleName);
+	XnValue props;
+	XnStatus nRetVal = m_Modules.Remove(ModuleName, props);
 	XN_IS_STATUS_OK(nRetVal);
 
 	return XN_STATUS_OK;
@@ -1163,15 +1186,15 @@ XnStatus XnDeviceBase::FindModule(const XnChar* ModuleName, XnDeviceModule** ppM
 
 XnStatus XnDeviceBase::FindModule(const XnChar* ModuleName, XnDeviceModuleHolder** ppModuleHolder)
 {
-	XnStatus nRetVal = XN_STATUS_OK;
-	ModuleHoldersHash::Iterator it = m_Modules.Find(ModuleName);
-	if (it == m_Modules.End())
+	XnStringsHash::Iterator it = m_Modules.end();
+	XnStatus nRetVal = m_Modules.Find(ModuleName, it);
+	if (nRetVal == XN_STATUS_NO_MATCH)
 	{
 		return (XN_STATUS_DEVICE_MODULE_NOT_FOUND);
 	}
 	XN_IS_STATUS_OK(nRetVal);
 
-	*ppModuleHolder = it->Value();
+	*ppModuleHolder = (XnDeviceModuleHolder*)it.Value();
 
 	return XN_STATUS_OK;
 }
@@ -1230,7 +1253,7 @@ XnStatus XnDeviceBase::FindStream(const XnChar* StreamName, XnDeviceModuleHolder
 XnStatus XnDeviceBase::AddSupportedStream(const XnChar* StreamType)
 {
 	// make sure stream doesn't exist yet
-	XnStringsSet::Iterator it = m_SupportedStreams.End();
+	XnStringsHash::Iterator it = m_SupportedStreams.end();
 	if (XN_STATUS_OK == m_SupportedStreams.Find(StreamType, it))
 	{
 		xnLogError(XN_MASK_DEVICE, "A stream with the name %s already exists!", StreamType);
@@ -1238,7 +1261,7 @@ XnStatus XnDeviceBase::AddSupportedStream(const XnChar* StreamType)
 	}
 
 	// add it to the list
-	XnStatus nRetVal = m_SupportedStreams.Set(StreamType);
+	XnStatus nRetVal = m_SupportedStreams.Set(StreamType, NULL);
 	XN_IS_STATUS_OK(nRetVal);
 
 	return XN_STATUS_OK;
@@ -1262,16 +1285,16 @@ XnStatus XnDeviceBase::CreateStreams(const XnPropertySet* pSet)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 	
-	for (XnPropertySetData::ConstIterator it = pSet->pData->Begin(); it != pSet->pData->End(); ++it)
+	for (XnPropertySetData::ConstIterator it = pSet->pData->begin(); it != pSet->pData->end(); ++it)
 	{
 		// check if this module is a stream
-		XnActualPropertiesHash* pModule = it->Value();
+		XnActualPropertiesHash* pModule = it.Value();
 
-		XnActualPropertiesHash::ConstIterator itProp = pModule->End();
+		XnActualPropertiesHash::ConstIterator itProp = pModule->end();
 		if (XN_STATUS_OK == pModule->Find(XN_STREAM_PROPERTY_TYPE, itProp))
 		{
 			// create a copy of the properties
-			XnActualPropertiesHash streamProps(it->Key());
+			XnActualPropertiesHash streamProps(it.Key());
 			nRetVal = streamProps.CopyFrom(*pModule);
 			XN_IS_STATUS_OK(nRetVal);
 
@@ -1280,8 +1303,8 @@ XnStatus XnDeviceBase::CreateStreams(const XnPropertySet* pSet)
 			XN_IS_STATUS_OK(nRetVal);
 
 			// and create the stream
-			XnActualStringProperty* pActualProp = (XnActualStringProperty*)itProp->Value();
-			nRetVal = CreateStreamImpl(pActualProp->GetValue(), it->Key(), &streamProps);
+			XnActualStringProperty* pActualProp = (XnActualStringProperty*)itProp.Value();
+			nRetVal = CreateStreamImpl(pActualProp->GetValue(), it.Key(), &streamProps);
 			XN_IS_STATUS_OK(nRetVal);
 		}
 	}
@@ -1291,18 +1314,18 @@ XnStatus XnDeviceBase::CreateStreams(const XnPropertySet* pSet)
 
 XnStatus XnDeviceBase::ValidateOnlyModule(const XnPropertySet* pSet, const XnChar* StreamName)
 {
-	XnPropertySetData::ConstIterator it = pSet->pData->Begin();
-	if (it == pSet->pData->End())
+	XnPropertySetData::ConstIterator it = pSet->pData->begin();
+	if (it == pSet->pData->end())
 	{
 		XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DDK, "Property set did not contain any stream!");
 	}
 
-	if (strcmp(it->Key(), StreamName) != 0)
+	if (strcmp(it.Key(), StreamName) != 0)
 	{
 		XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DDK, "Property set module name does not match stream name!");
 	}
 
-	if (++it != pSet->pData->End())
+	if (++it != pSet->pData->end())
 	{
 		XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DDK, "Property set contains more than one module!");
 	}
@@ -1326,7 +1349,7 @@ XnStatus XnDeviceBase::CreateStream(const XnChar* StreamType, const XnChar* Stre
 		nRetVal = ValidateOnlyModule(pInitialValues, StreamName);
 		XN_IS_STATUS_OK(nRetVal);
 
-		pInitialValuesHash = pInitialValues->pData->Begin()->Value();
+		pInitialValuesHash = pInitialValues->pData->begin().Value();
 	}
 
 	nRetVal = CreateStreamImpl(StreamType, StreamName, pInitialValuesHash);
@@ -1389,7 +1412,7 @@ XnStatus XnDeviceBase::CreateStreamImpl(const XnChar* strType, const XnChar* str
 
 		if (pInitialSet != NULL)
 		{
-			XnActualPropertiesHash::ConstIterator it = pInitialSet->End();
+			XnActualPropertiesHash::ConstIterator it = pInitialSet->end();
 			if (XN_STATUS_OK == pInitialSet->Find(XN_MODULE_PROPERTY_MIRROR, it))
 			{
 				bSetMirror = FALSE;
@@ -1434,11 +1457,7 @@ XnStatus XnDeviceBase::StreamAdded(XnDeviceStream* pStream)
 	}
 
 	// raise the change event
-	XnStreamCollectionChangedEventArgs eventArgs;
-	eventArgs.deviceHandle = GetDeviceHandle();
-	eventArgs.strStreamName = pStream->GetName();
-	eventArgs.eventType = XN_DEVICE_STREAM_ADDED;
-	m_OnStreamsChangeEvent.Raise(eventArgs);
+	m_OnStreamsChangeEvent.Raise(GetDeviceHandle(), pStream->GetName(), XN_DEVICE_STREAM_ADDED);
 	
 	return (XN_STATUS_OK);
 }
@@ -1446,13 +1465,13 @@ XnStatus XnDeviceBase::StreamAdded(XnDeviceStream* pStream)
 void XnDeviceBase::FreeModuleRegisteredProperties(const XnChar* strModule)
 {
 	// free memory of registered properties to this stream
-	PropertiesCallbacks::Iterator it = m_PropertyCallbacks.Begin();
-	while (it != m_PropertyCallbacks.End())
+	XnList::Iterator it = m_PropertyCallbacks.begin();
+	while (it != m_PropertyCallbacks.end())
 	{
-		PropertiesCallbacks::Iterator cur = it;
+		XnList::Iterator cur = it;
 		it++;
 
-		XnPropertyCallback* pRealCallback = *cur;
+		XnPropertyCallback* pRealCallback = (XnPropertyCallback*)*cur;
 		if (strcmp(pRealCallback->strModule, strModule) == 0)
 		{
 			m_PropertyCallbacks.Remove(cur);
@@ -1487,12 +1506,7 @@ XnStatus XnDeviceBase::DestroyStream(const XnChar* StreamName)
 	FreeModuleRegisteredProperties(StreamName);
 
 	// raise event
-	// raise the change event
-	XnStreamCollectionChangedEventArgs eventArgs;
-	eventArgs.deviceHandle = GetDeviceHandle();
-	eventArgs.strStreamName = strStreamName;
-	eventArgs.eventType = XN_DEVICE_STREAM_DELETED;
-	m_OnStreamsChangeEvent.Raise(eventArgs);
+	m_OnStreamsChangeEvent.Raise(GetDeviceHandle(), strStreamName, XN_DEVICE_STREAM_DELETED);
 
 	xnLogVerbose(XN_MASK_DDK, "'%s' stream destroyed.", strStreamName);
 
@@ -1503,9 +1517,9 @@ XnStatus XnDeviceBase::GetModulesList(XnDeviceModuleHolder** apModules, XnUInt32
 {
 	XnUInt32 nCount = 0;
 
-	for (ModuleHoldersHash::Iterator it = m_Modules.Begin(); it != m_Modules.End(); ++it)
+	for (XnStringsHash::Iterator it = m_Modules.begin(); it != m_Modules.end(); ++it)
 	{
-		apModules[nCount] = it->Value();
+		apModules[nCount] = (XnDeviceModuleHolder*)it.Value();
 		nCount++;
 	}
 
@@ -1518,9 +1532,9 @@ XnStatus XnDeviceBase::GetModulesList(XnDeviceModuleHolderList& list)
 {
 	list.Clear();
 
-	for (ModuleHoldersHash::Iterator it = m_Modules.Begin(); it != m_Modules.End(); ++it)
+	for (XnStringsHash::Iterator it = m_Modules.begin(); it != m_Modules.end(); ++it)
 	{
-		list.AddLast(it->Value());
+		list.AddLast((XnDeviceModuleHolder*)it.Value());
 	}
 
 	return (XN_STATUS_OK);
@@ -1530,9 +1544,9 @@ XnStatus XnDeviceBase::GetStreamsList(XnDeviceModuleHolderList& list)
 {
 	list.Clear();
 
-	for (ModuleHoldersHash::Iterator it = m_Modules.Begin(); it != m_Modules.End(); ++it)
+	for (XnStringsHash::Iterator it = m_Modules.begin(); it != m_Modules.end(); ++it)
 	{
-		XnDeviceModuleHolder* pModuleHolder = it->Value();
+		XnDeviceModuleHolder* pModuleHolder = (XnDeviceModuleHolder*)it.Value();
 		if (IsStream(pModuleHolder->GetModule()))
 		{
 			list.AddLast(pModuleHolder);
@@ -1544,10 +1558,7 @@ XnStatus XnDeviceBase::GetStreamsList(XnDeviceModuleHolderList& list)
 
 XnStatus XnDeviceBase::RaiseNewStreamDataEvent(const XnChar* StreamName)
 {
-	XnNewStreamDataEventArgs eventArgs;
-	eventArgs.deviceHandle = GetDeviceHandle();
-	eventArgs.strStreamName = StreamName;
-	m_OnNewStreamDataEvent.Raise(eventArgs);
+	m_OnNewStreamDataEvent.Raise(GetDeviceHandle(), StreamName);
 
 	return XN_STATUS_OK;
 }
@@ -1728,11 +1739,3 @@ XnStatus XN_CALLBACK_TYPE XnDeviceBase::SetHighresTimestampsCallback(XnActualInt
 	return pThis->SetHighresTimestamps((XnBool)nValue);
 }
 
-XnDeviceBase::XnPropertyCallback::XnPropertyCallback(XnDeviceHandle DeviceHandle, const XnChar* strModule, const XnChar* strProp, XnDeviceOnPropertyChangedEventHandler pHandler, void* pCookie) :
-	DeviceHandle(DeviceHandle),
-	pHandler(pHandler),
-	pCookie(pCookie)
-{
-	strcpy(this->strModule, strModule);
-	strcpy(this->strProp, strProp);
-}
diff --git a/Source/XnDDK/XnDeviceBase.h b/Source/XnDDK/XnDeviceBase.h
index 8023bb9..67019c8 100644
--- a/Source/XnDDK/XnDeviceBase.h
+++ b/Source/XnDDK/XnDeviceBase.h
@@ -26,11 +26,11 @@
 // Includes
 //---------------------------------------------------------------------------
 #include <XnDDK/IXnDevice.h>
-#include <XnStringsHashT.h>
+#include <XnStringsHash.h>
 #include <XnDevice.h>
 #include <XnDDK/XnDeviceModule.h>
 #include "XnDeviceModuleHolder.h"
-#include <XnEventT.h>
+#include <XnEvent.h>
 #include <XnDDK/XnDeviceStream.h>
 #include <XnDDK/XnActualStringProperty.h>
 #include <XnDDK/XnActualIntProperty.h>
@@ -96,11 +96,11 @@ public:
 	virtual XnStatus DoesModuleExist(const XnChar* ModuleName, XnBool* pbDoesExist);
 	virtual XnStatus OpenAllStreams();
 	virtual XnStatus CloseAllStreams();
-	virtual XnStatus RegisterToStreamsChange(XnDeviceOnStreamsChangedEventHandler Handler, void* pCookie, XnCallbackHandle& hCallback);
+	virtual XnStatus RegisterToStreamsChange(XnDeviceOnStreamsChangedEventHandler Handler, void* pCookie, XnCallbackHandle* phCallback);
 	virtual XnStatus UnregisterFromStreamsChange(XnCallbackHandle hCallback);
 	virtual XnStatus CreateStreamData(const XnChar* StreamName, XnStreamData** ppStreamData);
 	static XnStatus DestroyStreamData(XnStreamData** ppStreamData);
-	virtual XnStatus RegisterToNewStreamData(XnDeviceOnNewStreamDataEventHandler Handler, void* pCookie, XnCallbackHandle& hCallback);
+	virtual XnStatus RegisterToNewStreamData(XnDeviceOnNewStreamDataEventHandler Handler, void* pCookie, XnCallbackHandle* phCallback);
 	virtual XnStatus UnregisterFromNewStreamData(XnCallbackHandle hCallback);
 	virtual XnStatus IsNewDataAvailable(const XnChar* StreamName, XnBool* pbNewDataAvailable, XnUInt64* pnTimestamp);
 	virtual XnStatus ReadStream(XnStreamData* pStreamOutput);
@@ -122,14 +122,14 @@ public:
 	virtual XnStatus LoadConfigFromFile(const XnChar* csINIFilePath, const XnChar* csSectionName);
 	virtual XnStatus BatchConfig(const XnPropertySet* pChangeSet);
 	virtual XnStatus GetAllProperties(XnPropertySet* pSet, XnBool bNoStreams = FALSE, const XnChar* strModule = NULL);
-	virtual XnStatus RegisterToPropertyChange(const XnChar* Module, const XnChar* PropertyName, XnDeviceOnPropertyChangedEventHandler Handler, void* pCookie, XnCallbackHandle& hCallback);
+	virtual XnStatus RegisterToPropertyChange(const XnChar* Module, const XnChar* PropertyName, XnDeviceOnPropertyChangedEventHandler Handler, void* pCookie, XnCallbackHandle* phCallback);
 	virtual XnStatus UnregisterFromPropertyChange(const XnChar* Module, const XnChar* PropertyName, XnCallbackHandle hCallback);
 
-	typedef XnEventT<XnStreamCollectionChangedEventArgs> StreamCollectionChangedEvent;
-	StreamCollectionChangedEvent::TInterface& OnStreamCollectionChangedEvent() { return m_OnStreamsChangeEvent; }
+	XN_DECLARE_EVENT_3ARG(StreamCollectionChangedEvent, StreamCollectionChangedEventInterface, XnDeviceHandle, DeviceHandle, const XnChar*, StreamName, XnStreamsChangeEventType, EventType);
+	StreamCollectionChangedEventInterface& OnStreamCollectionChangedEvent() { return m_OnStreamsChangeEvent; }
 
-	typedef XnEventT<XnNewStreamDataEventArgs> NewStreamDataEvent;
-	NewStreamDataEvent::TInterface& OnNewStreamDataEvent() { return m_OnNewStreamDataEvent; }
+	XN_DECLARE_EVENT_2ARG(NewStreamDataEvent, NewStreamDataEventInterface, XnDeviceHandle, DeviceHandle, const XnChar*, StreamName);
+	NewStreamDataEventInterface& OnNewStreamDataEvent() { return m_OnNewStreamDataEvent; }
 
 protected:
 	virtual XnStatus InitImpl(const XnDeviceConfig* pDeviceConfig);
@@ -293,24 +293,10 @@ private:
 
 	static XnStatus XN_CALLBACK_TYPE StreamNewDataCallback(XnDeviceStream* pStream, void* pCookie);
 
-	typedef XnStringsHashT<XnDeviceModuleHolder*> ModuleHoldersHash;
-	ModuleHoldersHash m_Modules;
+	XnStringsHash m_Modules;
+	XnStringsHash m_SupportedStreams;
 
-	XnStringsSet m_SupportedStreams;
-
-	struct XnPropertyCallback
-	{
-		XnPropertyCallback(XnDeviceHandle DeviceHandle, const XnChar* strModule, const XnChar* strProp, XnDeviceOnPropertyChangedEventHandler pHandler, void* pCookie);
-
-		XnDeviceHandle DeviceHandle;
-		XnChar strModule[XN_DEVICE_MAX_STRING_LENGTH];
-		XnChar strProp[XN_DEVICE_MAX_STRING_LENGTH];
-		XnDeviceOnPropertyChangedEventHandler pHandler;
-		void* pCookie;
-		XnCallbackHandle hCallback;
-	};
-	typedef XnListT<XnPropertyCallback*> PropertiesCallbacks;
-	PropertiesCallbacks m_PropertyCallbacks;
+	XnList m_PropertyCallbacks;
 
 	StreamCollectionChangedEvent m_OnStreamsChangeEvent;
 	NewStreamDataEvent m_OnNewStreamDataEvent;
diff --git a/Source/XnDDK/XnDeviceBaseProxy.h b/Source/XnDDK/XnDeviceBaseProxy.h
index 0136dda..eb1bdb0 100644
--- a/Source/XnDDK/XnDeviceBaseProxy.h
+++ b/Source/XnDDK/XnDeviceBaseProxy.h
@@ -110,10 +110,10 @@ public:
 		return m_pActual->CloseAllStreams();
 	}
 
-	virtual XnStatus RegisterToStreamsChange(XnDeviceOnStreamsChangedEventHandler Handler, void* pCookie, XnCallbackHandle& hCallback)
+	virtual XnStatus RegisterToStreamsChange(XnDeviceOnStreamsChangedEventHandler Handler, void* pCookie, XnCallbackHandle* phCallback)
 	{
 		XN_VALIDATE_ACTUAL_DEVICE;
-		return m_pActual->RegisterToStreamsChange(Handler, pCookie, hCallback);
+		return m_pActual->RegisterToStreamsChange(Handler, pCookie, phCallback);
 	}
 
 	virtual XnStatus UnregisterFromStreamsChange(XnCallbackHandle hCallback)
@@ -128,10 +128,10 @@ public:
 		return m_pActual->CreateStreamData(StreamName, ppStreamData);
 	}
 
-	virtual XnStatus RegisterToNewStreamData(XnDeviceOnNewStreamDataEventHandler Handler, void* pCookie, XnCallbackHandle& hCallback)
+	virtual XnStatus RegisterToNewStreamData(XnDeviceOnNewStreamDataEventHandler Handler, void* pCookie, XnCallbackHandle* phCallback)
 	{
 		XN_VALIDATE_ACTUAL_DEVICE;
-		return m_pActual->RegisterToNewStreamData(Handler, pCookie, hCallback);
+		return m_pActual->RegisterToNewStreamData(Handler, pCookie, phCallback);
 	}
 
 	virtual XnStatus UnregisterFromNewStreamData(XnCallbackHandle hCallback)
@@ -272,10 +272,10 @@ public:
 		return m_pActual->GetAllProperties(pSet, bNoStreams, strModule);
 	}
 
-	virtual XnStatus RegisterToPropertyChange(const XnChar* Module, const XnChar* PropertyName, XnDeviceOnPropertyChangedEventHandler Handler, void* pCookie, XnCallbackHandle& hCallback)
+	virtual XnStatus RegisterToPropertyChange(const XnChar* Module, const XnChar* PropertyName, XnDeviceOnPropertyChangedEventHandler Handler, void* pCookie, XnCallbackHandle* phCallback)
 	{
 		XN_VALIDATE_ACTUAL_DEVICE;
-		return m_pActual->RegisterToPropertyChange(Module, PropertyName, Handler, pCookie, hCallback);
+		return m_pActual->RegisterToPropertyChange(Module, PropertyName, Handler, pCookie, phCallback);
 	}
 
 	virtual XnStatus UnregisterFromPropertyChange(const XnChar* Module, const XnChar* PropertyName, XnCallbackHandle hCallback)
diff --git a/Source/XnDDK/XnDeviceInterfaceAdapter.h b/Source/XnDDK/XnDeviceInterfaceAdapter.h
index 30bf25f..5459764 100644
--- a/Source/XnDDK/XnDeviceInterfaceAdapter.h
+++ b/Source/XnDDK/XnDeviceInterfaceAdapter.h
@@ -93,9 +93,9 @@ public:
 		return m_pFuncs->CloseAllStreams(m_Handle);
 	}
 
-	virtual XnStatus RegisterToStreamsChange(XnDeviceOnStreamsChangedEventHandler Handler, void* pCookie, XnCallbackHandle& hCallback)
+	virtual XnStatus RegisterToStreamsChange(XnDeviceOnStreamsChangedEventHandler Handler, void* pCookie, XnCallbackHandle* phCallback)
 	{
-		return m_pFuncs->RegisterToStreamsChange(m_Handle, Handler, pCookie, hCallback);
+		return m_pFuncs->RegisterToStreamsChange(m_Handle, Handler, pCookie, phCallback);
 	}
 
 	virtual XnStatus UnregisterFromStreamsChange(XnCallbackHandle hCallback)
@@ -108,9 +108,9 @@ public:
 		return m_pFuncs->CreateStreamData(m_Handle, StreamName, ppStreamData);
 	}
 
-	virtual XnStatus RegisterToNewStreamData(XnDeviceOnNewStreamDataEventHandler Handler, void* pCookie, XnCallbackHandle& hCallback)
+	virtual XnStatus RegisterToNewStreamData(XnDeviceOnNewStreamDataEventHandler Handler, void* pCookie, XnCallbackHandle* phCallback)
 	{
-		return m_pFuncs->RegisterToNewStreamData(m_Handle, Handler, pCookie, hCallback);
+		return m_pFuncs->RegisterToNewStreamData(m_Handle, Handler, pCookie, phCallback);
 	}
 
 	virtual XnStatus UnregisterFromNewStreamData(XnCallbackHandle hCallback)
@@ -213,9 +213,9 @@ public:
 		return m_pFuncs->GetAllProperties(m_Handle, pSet, bNoStreams, strModule);
 	}
 
-	virtual XnStatus RegisterToPropertyChange(const XnChar* Module, const XnChar* PropertyName, XnDeviceOnPropertyChangedEventHandler Handler, void* pCookie, XnCallbackHandle& hCallback)
+	virtual XnStatus RegisterToPropertyChange(const XnChar* Module, const XnChar* PropertyName, XnDeviceOnPropertyChangedEventHandler Handler, void* pCookie, XnCallbackHandle* phCallback)
 	{
-		return m_pFuncs->RegisterToPropertyChange(m_Handle, Module, PropertyName, Handler, pCookie, hCallback);
+		return m_pFuncs->RegisterToPropertyChange(m_Handle, Module, PropertyName, Handler, pCookie, phCallback);
 	}
 
 	virtual XnStatus UnRegisterFromPropertyChange(const XnChar* Module, const XnChar* PropertyName, XnCallbackHandle hCallback)
diff --git a/Source/XnDDK/XnDeviceInterfaceImpl.h b/Source/XnDDK/XnDeviceInterfaceImpl.h
index 7362ba6..1aa3124 100644
--- a/Source/XnDDK/XnDeviceInterfaceImpl.h
+++ b/Source/XnDDK/XnDeviceInterfaceImpl.h
@@ -53,11 +53,7 @@ XN_DEVICE_API XnStatus XN_DEVICE_PROTO_NAME(Create)(XnDeviceHandle* pDeviceHandl
 {
 	IXnDevice* pDevice = XN_NEW(XN_DEVICE_BASE_DERIVATIVE);
 	XnStatus nRetVal = pDevice->Init(pDeviceConfig);
-	if (nRetVal != XN_STATUS_OK)
-	{
-		XN_DELETE(pDevice);
-		return (nRetVal);
-	}
+	XN_IS_STATUS_OK(nRetVal);
 
 	*pDeviceHandle = pDevice->GetDeviceHandle();
 
@@ -130,10 +126,10 @@ XN_DEVICE_API XnStatus XN_DEVICE_PROTO_NAME(DoesModuleExist)(const XnDeviceHandl
 	return pDevice->DoesModuleExist(ModuleName, pbDoesExist);
 }
 
-XN_DEVICE_API XnStatus XN_DEVICE_PROTO_NAME(RegisterToStreamsChange)(const XnDeviceHandle DeviceHandle, XnDeviceOnStreamsChangedEventHandler Handler, void* pCookie, XnCallbackHandle& hCallback)
+XN_DEVICE_API XnStatus XN_DEVICE_PROTO_NAME(RegisterToStreamsChange)(const XnDeviceHandle DeviceHandle, XnDeviceOnStreamsChangedEventHandler Handler, void* pCookie, XnCallbackHandle* phCallback)
 {
 	IXnDevice* pDevice = IXnDevice::GetFromDeviceHandle(DeviceHandle);
-	return pDevice->RegisterToStreamsChange(Handler, pCookie, hCallback);
+	return pDevice->RegisterToStreamsChange(Handler, pCookie, phCallback);
 }
 
 XN_DEVICE_API XnStatus XN_DEVICE_PROTO_NAME(UnregisterFromStreamsChange)(const XnDeviceHandle DeviceHandle, XnCallbackHandle hCallback)
@@ -153,10 +149,10 @@ XN_DEVICE_API XnStatus XN_DEVICE_PROTO_NAME(DestroyStreamData)(XnStreamData** pp
 	return XN_DEVICE_BASE_DERIVATIVE::DestroyStreamData(ppStreamData);
 }
 
-XN_DEVICE_API XnStatus XN_DEVICE_PROTO_NAME(RegisterToNewStreamData)(const XnDeviceHandle DeviceHandle, XnDeviceOnNewStreamDataEventHandler Handler, void* pCookie, XnCallbackHandle& hCallback)
+XN_DEVICE_API XnStatus XN_DEVICE_PROTO_NAME(RegisterToNewStreamData)(const XnDeviceHandle DeviceHandle, XnDeviceOnNewStreamDataEventHandler Handler, void* pCookie, XnCallbackHandle* phCallback)
 {
 	IXnDevice* pDevice = IXnDevice::GetFromDeviceHandle(DeviceHandle);
-	return pDevice->RegisterToNewStreamData(Handler, pCookie, hCallback);
+	return pDevice->RegisterToNewStreamData(Handler, pCookie, phCallback);
 }
 
 XN_DEVICE_API XnStatus XN_DEVICE_PROTO_NAME(UnregisterFromNewStreamData)(const XnDeviceHandle DeviceHandle, XnCallbackHandle hCallback)
@@ -297,10 +293,10 @@ XN_DEVICE_API XnStatus XN_DEVICE_PROTO_NAME(GetAllProperties)(const XnDeviceHand
 	return pDevice->GetAllProperties(pPropertySet, bNoStreams, strModule);
 }
 
-XN_DEVICE_API XnStatus XN_DEVICE_PROTO_NAME(RegisterToPropertyChange)(const XnDeviceHandle DeviceHandle, const XnChar* Module, const XnChar* PropertyName, XnDeviceOnPropertyChangedEventHandler Handler, void* pCookie, XnCallbackHandle& hCallback)
+XN_DEVICE_API XnStatus XN_DEVICE_PROTO_NAME(RegisterToPropertyChange)(const XnDeviceHandle DeviceHandle, const XnChar* Module, const XnChar* PropertyName, XnDeviceOnPropertyChangedEventHandler Handler, void* pCookie, XnCallbackHandle* phCallback)
 {
 	IXnDevice* pDevice = IXnDevice::GetFromDeviceHandle(DeviceHandle);
-	return pDevice->RegisterToPropertyChange(Module, PropertyName, Handler, pCookie, hCallback);
+	return pDevice->RegisterToPropertyChange(Module, PropertyName, Handler, pCookie, phCallback);
 }
 
 XN_DEVICE_API XnStatus XN_DEVICE_PROTO_NAME(UnregisterFromPropertyChange)(const XnDeviceHandle DeviceHandle, const XnChar* Module, const XnChar* PropertyName, XnCallbackHandle hCallback)
diff --git a/Source/XnDDK/XnDeviceModule.cpp b/Source/XnDDK/XnDeviceModule.cpp
index fd27013..60bf261 100644
--- a/Source/XnDDK/XnDeviceModule.cpp
+++ b/Source/XnDDK/XnDeviceModule.cpp
@@ -71,7 +71,7 @@ XnStatus XnDeviceModule::AddProperty(XnProperty* pProperty)
 	XnStatus nRetVal = XN_STATUS_OK;
 	
 	// make sure another property with this name doesn't exist
-	XnPropertiesHash::Iterator it = m_Properties.End();
+	XnPropertiesHash::Iterator it = m_Properties.end();
 	if (XN_STATUS_NO_MATCH != m_Properties.Find(pProperty->GetName(), it))
 		return XN_STATUS_DEVICE_PROPERTY_ALREADY_EXISTS;
 
@@ -102,7 +102,7 @@ XnStatus XnDeviceModule::DoesPropertyExist(const XnChar* strName, XnBool* pbDoes
 
 	*pbDoesExist = FALSE;
 
-	XnPropertiesHash::ConstIterator it = m_Properties.End();
+	XnPropertiesHash::ConstIterator it = m_Properties.end();
 	nRetVal = m_Properties.Find(strName, it);
 	if (nRetVal != XN_STATUS_NO_MATCH && nRetVal != XN_STATUS_OK)
 	{
@@ -328,7 +328,7 @@ XnStatus XnDeviceModule::UnsafeUpdateProperty(const XnChar* strName, const XnGen
 	return (XN_STATUS_OK);
 }
 
-XnStatus XnDeviceModule::RegisterForOnPropertyValueChanged(const XnChar* strName, XnProperty::OnValueChangedHandler pFunc, void* pCookie, XnCallbackHandle& hCallback)
+XnStatus XnDeviceModule::RegisterForOnPropertyValueChanged(const XnChar* strName, XnProperty::OnValueChangedHandler pFunc, void* pCookie, XnCallbackHandle* pHandle)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 	
@@ -336,7 +336,7 @@ XnStatus XnDeviceModule::RegisterForOnPropertyValueChanged(const XnChar* strName
 	nRetVal = GetProperty(strName, &pProp);
 	XN_IS_STATUS_OK(nRetVal);
 
-	nRetVal = pProp->OnChangeEvent().Register(pFunc, pCookie, hCallback);
+	nRetVal = pProp->OnChangeEvent().Register(pFunc, pCookie, pHandle);
 	XN_IS_STATUS_OK(nRetVal);
 	
 	return (XN_STATUS_OK);
@@ -385,9 +385,9 @@ XnStatus XnDeviceModule::GetAllProperties(XnPropertySet* pSet) const
 	XN_IS_STATUS_OK(nRetVal);
 
 	// now add all properties
-	for (XnPropertiesHash::ConstIterator it = m_Properties.Begin(); it != m_Properties.End(); ++it)
+	for (XnPropertiesHash::ConstIterator it = m_Properties.begin(); it != m_Properties.end(); ++it)
 	{
-		XnProperty* pProperty = it->Value();
+		XnProperty* pProperty = it.Value();
 
 		if (pProperty->IsActual())
 		{
@@ -410,9 +410,9 @@ XnStatus XnDeviceModule::LoadConfigFromFile(const XnChar* csINIFilePath, const X
 
 	xnLogVerbose(XN_MASK_DDK, "Configuring module '%s' from section '%s' in file '%s'...", GetName(), strSectionName, csINIFilePath);
 
-	for (XnPropertiesHash::Iterator it = m_Properties.Begin(); it != m_Properties.End(); ++it)
+	for (XnPropertiesHash::Iterator it = m_Properties.begin(); it != m_Properties.end(); ++it)
 	{
-		XnProperty* pProp = it->Value();
+		XnProperty* pProp = it.Value();
 
 		// only read writable properties
 		if (!pProp->IsReadOnly())
@@ -431,9 +431,9 @@ XnStatus XnDeviceModule::BatchConfig(const XnActualPropertiesHash& props)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 	
-	for (XnActualPropertiesHash::ConstIterator it = props.Begin(); it != props.End(); ++it)
+	for (XnActualPropertiesHash::ConstIterator it = props.begin(); it != props.end(); ++it)
 	{
-		XnProperty* pRequestProp = it->Value();
+		XnProperty* pRequestProp = it.Value();
 		switch (pRequestProp->GetType())
 		{
 		case XN_PROPERTY_TYPE_INTEGER:
@@ -476,9 +476,9 @@ XnStatus XnDeviceModule::UnsafeBatchConfig(const XnActualPropertiesHash& props)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 
-	for (XnActualPropertiesHash::ConstIterator it = props.Begin(); it != props.End(); ++it)
+	for (XnActualPropertiesHash::ConstIterator it = props.begin(); it != props.end(); ++it)
 	{
-		XnProperty* pRequestProp = it->Value();
+		XnProperty* pRequestProp = it.Value();
 		switch (pRequestProp->GetType())
 		{
 		case XN_PROPERTY_TYPE_INTEGER:
diff --git a/Source/XnDDK/XnDeviceModule.h b/Source/XnDDK/XnDeviceModule.h
index edf7396..b94bafd 100644
--- a/Source/XnDDK/XnDeviceModule.h
+++ b/Source/XnDDK/XnDeviceModule.h
@@ -26,6 +26,7 @@
 // Includes
 //---------------------------------------------------------------------------
 #include <XnPlatform.h>
+#include <XnStringsHash.h>
 #include <XnDDK/XnPropertySetInternal.h>
 #include <XnDDK/XnIntProperty.h>
 #include <XnDDK/XnRealProperty.h>
@@ -75,7 +76,7 @@ public:
 
 	XnStatus GetAllProperties(XnPropertySet* pSet) const;
 
-	XnStatus RegisterForOnPropertyValueChanged(const XnChar* strName, XnProperty::OnValueChangedHandler pFunc, void* pCookie, XnCallbackHandle& hCallback);
+	XnStatus RegisterForOnPropertyValueChanged(const XnChar* strName, XnProperty::OnValueChangedHandler pFunc, void* pCookie, XnCallbackHandle* pHandle);
 	XnStatus UnregisterFromOnPropertyValueChanged(const XnChar* strName, XnCallbackHandle hCallback);
 
 	/**
diff --git a/Source/XnDDK/XnDeviceModuleHolder.cpp b/Source/XnDDK/XnDeviceModuleHolder.cpp
index 43c785d..3616979 100644
--- a/Source/XnDDK/XnDeviceModuleHolder.cpp
+++ b/Source/XnDDK/XnDeviceModuleHolder.cpp
@@ -66,8 +66,8 @@ XnStatus XnDeviceModuleHolder::Free()
 	// them from Module).
 	while (!m_Allocated.IsEmpty())
 	{
-		XnProperty* pProp = *(m_Allocated.Begin());
-		m_Allocated.Remove(m_Allocated.Begin());
+		XnProperty* pProp = *(m_Allocated.begin());
+		m_Allocated.Remove(m_Allocated.begin());
 		XN_DELETE(pProp);
 	}
 
@@ -78,9 +78,9 @@ XnStatus XnDeviceModuleHolder::UnsafeSetProperties(const XnActualPropertiesHash&
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 	
-	for (XnActualPropertiesHash::ConstIterator it = props.Begin(); it != props.End(); ++it)
+	for (XnActualPropertiesHash::ConstIterator it = props.begin(); it != props.end(); ++it)
 	{
-		XnProperty* pRequestProp = it->Value();
+		XnProperty* pRequestProp = it.Value();
 		XnProperty* pProp = NULL;
 
 		// check if property already exist
diff --git a/Source/XnDDK/XnDeviceModuleHolder.h b/Source/XnDDK/XnDeviceModuleHolder.h
index 5ebfaf3..4659370 100644
--- a/Source/XnDDK/XnDeviceModuleHolder.h
+++ b/Source/XnDDK/XnDeviceModuleHolder.h
@@ -24,7 +24,6 @@
 
 #include "XnActualPropertiesHash.h"
 #include "XnDeviceModule.h"
-#include <XnListT.h>
 
 class XN_DDK_CPP_API XnDeviceModuleHolder
 {
@@ -55,7 +54,7 @@ private:
 	XnBool m_bAllowNewProps;
 };
 
-typedef XnListT<XnDeviceModuleHolder*> XnDeviceModuleHolderList;
+XN_DECLARE_LIST_DECL(XN_DDK_CPP_API, XnDeviceModuleHolder*, XnDeviceModuleHolderList)
 
 
 #endif //__XN_DEVICE_MODULE_HOLDER_H__
diff --git a/Source/XnDDK/XnDeviceProxy.cpp b/Source/XnDDK/XnDeviceProxy.cpp
index 4fda33f..eba9645 100644
--- a/Source/XnDDK/XnDeviceProxy.cpp
+++ b/Source/XnDDK/XnDeviceProxy.cpp
@@ -26,7 +26,7 @@
 #include <XnDeviceProxy.h>
 #include "XnDeviceManager.h"
 #include <XnOS.h>
-#include <XnHashT.h>
+#include <XnHash.h>
 #include "XnDeviceInterfaceAdapter.h"
 #include <XnPsVersion.h>
 
@@ -46,13 +46,11 @@ typedef struct XnDeviceProxyDeviceHandle
 	XnDeviceHandle ActualDevice;
 } XnDeviceProxyDeviceHandle;
 
-typedef XnHashT<XnStreamData*, XnDeviceDescriptor*> XnStreamOutputHash;
-
 //---------------------------------------------------------------------------
 // Global Variables
 //---------------------------------------------------------------------------
 /** Stores a hash of streamoutput objects to their creating device name. */
-XnStreamOutputHash g_StreamOutputHash;
+XnHash g_StreamOutputHash;
 
 //---------------------------------------------------------------------------
 // XnDeviceProxy functions
@@ -382,11 +380,11 @@ XN_DDK_API XnStatus XN_DEVICE_PROXY_PROTO(DoesModuleExist)(const XnDeviceHandle
 	return pHandle->pDesc->Interface.DoesModuleExist(pHandle->ActualDevice, ModuleName, pbDoesExist);
 }
 
-XN_DDK_API XnStatus XN_DEVICE_PROXY_PROTO(RegisterToStreamsChange)(const XnDeviceHandle DeviceHandle, XnDeviceOnStreamsChangedEventHandler Handler, void* pCookie, XnCallbackHandle& hCallback)
+XN_DDK_API XnStatus XN_DEVICE_PROXY_PROTO(RegisterToStreamsChange)(const XnDeviceHandle DeviceHandle, XnDeviceOnStreamsChangedEventHandler Handler, void* pCookie, XnCallbackHandle* phCallback)
 {
 	XN_VALIDATE_INPUT_PTR(DeviceHandle);
 	XnDeviceProxyDeviceHandle* pHandle = (XnDeviceProxyDeviceHandle*)DeviceHandle;
-	return pHandle->pDesc->Interface.RegisterToStreamsChange(pHandle->ActualDevice, Handler, pCookie, hCallback);
+	return pHandle->pDesc->Interface.RegisterToStreamsChange(pHandle->ActualDevice, Handler, pCookie, phCallback);
 }
 
 XN_DDK_API XnStatus XN_DEVICE_PROXY_PROTO(UnregisterFromStreamsChange)(const XnDeviceHandle DeviceHandle, XnCallbackHandle hCallback)
@@ -428,7 +426,7 @@ XN_DDK_API XnStatus XN_DEVICE_PROXY_PROTO(DestroyStreamData)(XnStreamData** ppSt
 
 	// find descriptor of the device that created this object
 	XnDeviceDescriptor* pDesc = NULL;
-	nRetVal = g_StreamOutputHash.Get(*ppStreamData, pDesc);
+	nRetVal = g_StreamOutputHash.Get(*ppStreamData, (XnValue&)pDesc);
 	XN_IS_STATUS_OK(nRetVal);
 
 	// destroy the object
@@ -436,16 +434,16 @@ XN_DDK_API XnStatus XN_DEVICE_PROXY_PROTO(DestroyStreamData)(XnStreamData** ppSt
 	XN_IS_STATUS_OK(nRetVal);
 
 	// and remove it from map
-	g_StreamOutputHash.Remove(pObject);
+	g_StreamOutputHash.Remove(pObject, (XnValue&)pDesc);
 
 	return (XN_STATUS_OK);
 }
 
-XN_DDK_API XnStatus XN_DEVICE_PROXY_PROTO(RegisterToNewStreamData)(const XnDeviceHandle DeviceHandle, XnDeviceOnNewStreamDataEventHandler Handler, void* pCookie, XnCallbackHandle& hCallback)
+XN_DDK_API XnStatus XN_DEVICE_PROXY_PROTO(RegisterToNewStreamData)(const XnDeviceHandle DeviceHandle, XnDeviceOnNewStreamDataEventHandler Handler, void* pCookie, XnCallbackHandle* phCallback)
 {
 	XN_VALIDATE_INPUT_PTR(DeviceHandle);
 	XnDeviceProxyDeviceHandle* pHandle = (XnDeviceProxyDeviceHandle*)DeviceHandle;
-	return pHandle->pDesc->Interface.RegisterToNewStreamData(pHandle->ActualDevice, Handler, pCookie, hCallback);
+	return pHandle->pDesc->Interface.RegisterToNewStreamData(pHandle->ActualDevice, Handler, pCookie, phCallback);
 }
 
 XN_DDK_API XnStatus XN_DEVICE_PROXY_PROTO(UnregisterFromNewStreamData)(const XnDeviceHandle DeviceHandle, XnCallbackHandle hCallback)
@@ -609,11 +607,11 @@ XN_DDK_API XnStatus XN_DEVICE_PROXY_PROTO(GetAllProperties)(const XnDeviceHandle
 	return pHandle->pDesc->Interface.GetAllProperties(pHandle->ActualDevice, pPropertySet, bNoStreams, strModule);
 }
 
-XN_DDK_API XnStatus XN_DEVICE_PROXY_PROTO(RegisterToPropertyChange)(const XnDeviceHandle DeviceHandle, const XnChar* Module, const XnChar* PropertyName, XnDeviceOnPropertyChangedEventHandler Handler, void* pCookie, XnCallbackHandle& hCallback)
+XN_DDK_API XnStatus XN_DEVICE_PROXY_PROTO(RegisterToPropertyChange)(const XnDeviceHandle DeviceHandle, const XnChar* Module, const XnChar* PropertyName, XnDeviceOnPropertyChangedEventHandler Handler, void* pCookie, XnCallbackHandle* phCallback)
 {
 	XN_VALIDATE_INPUT_PTR(DeviceHandle);
 	XnDeviceProxyDeviceHandle* pHandle = (XnDeviceProxyDeviceHandle*)DeviceHandle;
-	return pHandle->pDesc->Interface.RegisterToPropertyChange(pHandle->ActualDevice, Module, PropertyName, Handler, pCookie, hCallback);
+	return pHandle->pDesc->Interface.RegisterToPropertyChange(pHandle->ActualDevice, Module, PropertyName, Handler, pCookie, phCallback);
 }
 
 XN_DDK_API XnStatus XN_DEVICE_PROXY_PROTO(UnregisterFromPropertyChange)(const XnDeviceHandle DeviceHandle, const XnChar* Module, const XnChar* PropertyName, XnCallbackHandle hCallback)
diff --git a/Source/XnDDK/XnDeviceStream.cpp b/Source/XnDDK/XnDeviceStream.cpp
index 5182f5e..543265c 100644
--- a/Source/XnDDK/XnDeviceStream.cpp
+++ b/Source/XnDDK/XnDeviceStream.cpp
@@ -204,7 +204,7 @@ XnStatus XnDeviceStream::RegisterRequiredSizeProperty(XnProperty* pProperty)
 	XN_ASSERT(strcmp(pProperty->GetModule(), GetName()) == 0);
 
 	XnCallbackHandle hCallbackDummy;
-	nRetVal = pProperty->OnChangeEvent().Register(UpdateRequiredSizeCallback, this, hCallbackDummy);
+	nRetVal = pProperty->OnChangeEvent().Register(UpdateRequiredSizeCallback, this, &hCallbackDummy);
 	XN_IS_STATUS_OK(nRetVal);
 
 	// recalculate it
diff --git a/Source/XnDDK/XnDeviceStream.h b/Source/XnDDK/XnDeviceStream.h
index 098163f..f3c5629 100644
--- a/Source/XnDDK/XnDeviceStream.h
+++ b/Source/XnDDK/XnDeviceStream.h
@@ -28,6 +28,7 @@
 #include <XnDDK/XnDeviceModule.h>
 #include <XnDDK/XnActualIntProperty.h>
 #include <XnDDK/XnActualStringProperty.h>
+#include <XnEvent.h>
 #include <XnOS.h>
 
 //---------------------------------------------------------------------------
@@ -95,8 +96,6 @@ protected:
 
 	inline XN_CRITICAL_SECTION_HANDLE* GetLock() { return &m_hCriticalSection; }
 
-	inline void ResetNewDataAvailableFlag() { m_bNewDataAvailable = FALSE; }
-
 protected:
 	//---------------------------------------------------------------------------
 	// Virtual Functions
diff --git a/Source/XnDDK/XnExternalBufferPool.cpp b/Source/XnDDK/XnExternalBufferPool.cpp
deleted file mode 100644
index 8f6d156..0000000
--- a/Source/XnDDK/XnExternalBufferPool.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-*                                                                           *
-*  PrimeSense Sensor 5.x Alpha                                              *
-*  Copyright (C) 2011 PrimeSense Ltd.                                       *
-*                                                                           *
-*  This file is part of PrimeSense Sensor.                                  *
-*                                                                           *
-*  PrimeSense Sensor is free software: you can redistribute it and/or modify*
-*  it under the terms of the GNU Lesser General Public License as published *
-*  by the Free Software Foundation, either version 3 of the License, or     *
-*  (at your option) any later version.                                      *
-*                                                                           *
-*  PrimeSense Sensor is distributed in the hope that it will be useful,     *
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the             *
-*  GNU Lesser General Public License for more details.                      *
-*                                                                           *
-*  You should have received a copy of the GNU Lesser General Public License *
-*  along with PrimeSense Sensor. If not, see <http://www.gnu.org/licenses/>.*
-*                                                                           *
-****************************************************************************/
-//---------------------------------------------------------------------------
-// Includes
-//---------------------------------------------------------------------------
-#include "XnExternalBufferPool.h"
-
-//---------------------------------------------------------------------------
-// Code
-//---------------------------------------------------------------------------
-XnExternalBufferPool::XnExternalBufferPool()
-{
-}
-
-XnExternalBufferPool::~XnExternalBufferPool()
-{
-	FreeAll(TRUE);
-}
-
-XnStatus XnExternalBufferPool::SetBuffers(XnUInt32 nCount, const XnGeneralBuffer* aBuffers)
-{
-	XnStatus nRetVal = XN_STATUS_OK;
-	
-	XN_VALIDATE_INPUT_PTR(aBuffers);
-
-	// make sure we have at least 3 buffers (user, stable and working)
-	if (nCount < 3)
-	{
-		XN_LOG_WARNING_RETURN(XN_STATUS_BAD_PARAM, XN_MASK_DDK, "ExternalBufferPool: at least 3 buffers are required!");
-	}
-
-	m_buffers.Clear();
-
-	// add buffers to the list
-	for (XnUInt32 i = 0; i < nCount; ++i)
-	{
-		nRetVal = m_buffers.AddLast(aBuffers[i]);
-		XN_IS_STATUS_OK(nRetVal);
-	}
-
-	return (XN_STATUS_OK);
-}
-
-XnStatus XnExternalBufferPool::AllocateBuffers(XnUInt32 nSize)
-{
-	XnStatus nRetVal = XN_STATUS_OK;
-
-	// make sure all buffers are in the correct size
-	for (XnUInt32 i = 0; i < m_buffers.GetSize(); ++i)
-	{
-		if (m_buffers[i].nDataSize < nSize)
-		{
-			return XN_STATUS_ALLOC_FAILED;
-		}
-	}
-
-	// now "allocate" them
-	for (XnUInt32 i = 0; i < m_buffers.GetSize(); ++i)
-	{
-		nRetVal = AddNewBuffer(m_buffers[i].pData, m_buffers[i].nDataSize);
-		XN_IS_STATUS_OK(nRetVal);
-	}
-
-	return (XN_STATUS_OK);
-}
-
-void XnExternalBufferPool::DestroyBuffer(void* /*pBuffer*/)
-{
-}
diff --git a/Source/XnDDK/XnFrameBufferManager.cpp b/Source/XnDDK/XnFrameBufferManager.cpp
index 87edbe0..c92e462 100644
--- a/Source/XnDDK/XnFrameBufferManager.cpp
+++ b/Source/XnDDK/XnFrameBufferManager.cpp
@@ -51,6 +51,9 @@ XnStatus XnFrameBufferManager::Init(XnUInt32 nBufferSize)
 	nRetVal = xnOSCreateCriticalSection(&m_hLock);
 	XN_IS_STATUS_OK(nRetVal);
 
+	nRetVal = m_pBufferPool->Init(nBufferSize);
+	XN_IS_STATUS_OK(nRetVal);
+
 	nRetVal = Reallocate(nBufferSize);
 	XN_IS_STATUS_OK(nRetVal);
 
@@ -83,13 +86,11 @@ XnStatus XnFrameBufferManager::Reallocate(XnUInt32 nBufferSize)
 	if (m_pWorkingBuffer != NULL)
 	{
 		m_pBufferPool->DecRef(m_pWorkingBuffer);
-		m_pWorkingBuffer = NULL;
 	}
 
 	if (m_pStableBuffer != NULL)
 	{
 		m_pBufferPool->DecRef(m_pStableBuffer);
-		m_pStableBuffer = NULL;
 	}
 
 	// and take one
@@ -143,8 +144,6 @@ void XnFrameBufferManager::MarkWriteBufferAsStable(XnUInt64 nTimestamp, XnUInt32
 		m_pStableBuffer = pPrevStable;
 		m_pBufferPool->AddRef(m_pStableBuffer);
 		m_pBufferPool->Unlock();
-
-		XN_ASSERT(FALSE);
 		return;
 	}
 
@@ -155,10 +154,7 @@ void XnFrameBufferManager::MarkWriteBufferAsStable(XnUInt64 nTimestamp, XnUInt32
 	m_pWorkingBuffer->Reset();
 
 	// notify stream that new data is available
-	NewFrameEventArgs args;
-	args.pTripleBuffer = this;
-	args.nTimestamp = m_nStableTimestamp;
-	m_NewFrameEvent.Raise(args);
+	m_NewFrameEvent.Raise(this, m_nStableTimestamp);
 }
 
 void XnFrameBufferManager::ReadLastStableBuffer(XnBuffer** ppBuffer, XnUInt64* pnTimestamp, XnUInt32* pnFrameID)
diff --git a/Source/XnDDK/XnFrameBufferManager.h b/Source/XnDDK/XnFrameBufferManager.h
index 3496512..8f88ab5 100644
--- a/Source/XnDDK/XnFrameBufferManager.h
+++ b/Source/XnDDK/XnFrameBufferManager.h
@@ -27,7 +27,7 @@
 //---------------------------------------------------------------------------
 #include <XnPlatform.h>
 #include <XnCore/XnBuffer.h>
-#include <XnEventT.h>
+#include <XnEvent.h>
 #include "XnBufferPool.h"
 
 //---------------------------------------------------------------------------
@@ -59,14 +59,8 @@ public:
 
 	inline XnUInt32 GetLastFrameID() const { return m_nStableFrameID; }
 
-	typedef struct NewFrameEventArgs
-	{
-		XnFrameBufferManager* pTripleBuffer;
-		XnUInt64 nTimestamp;
-	} NewFrameEventArgs;
-
-	typedef XnEventT<NewFrameEventArgs> NewFrameEvent;
-	NewFrameEvent::TInterface& OnNewFrameEvent() { return m_NewFrameEvent; }
+	XN_DECLARE_EVENT_2ARG(NewFrameEvent, NewFrameEventInterface, XnFrameBufferManager*, pTripleBuffer, XnUInt64, nTimestamp);
+	NewFrameEventInterface& OnNewFrameEvent() { return m_NewFrameEvent; }
 
 private:
 	XnBufferPool* m_pBufferPool;
diff --git a/Source/XnDDK/XnFrameStream.cpp b/Source/XnDDK/XnFrameStream.cpp
index 61969aa..bd3fc2d 100644
--- a/Source/XnDDK/XnFrameStream.cpp
+++ b/Source/XnDDK/XnFrameStream.cpp
@@ -25,7 +25,6 @@
 #include "XnFrameStream.h"
 #include "XnStreamDataInternal.h"
 #include "XnSimpleBufferPool.h"
-#include "XnExternalBufferPool.h"
 
 //---------------------------------------------------------------------------
 // Code
@@ -35,7 +34,6 @@ XnFrameStream::XnFrameStream(const XnChar* csType, const XnChar* csName) :
 	m_IsFrameStream(XN_STREAM_PROPERTY_IS_FRAME_BASED, TRUE),
 	m_FPS(XN_STREAM_PROPERTY_FPS, 0),
 	m_LastRawFrame(XN_STREAM_PROPERTY_LAST_RAW_FRAME),
-	m_externalBufferPool(XN_STREAM_PROPERTY_EXTERNAL_BUFFER_POOL),
 	m_nLastReadFrame(0),
 	m_bTripleBufferReallocated(FALSE),
 	m_pBufferManager(NULL),
@@ -44,7 +42,18 @@ XnFrameStream::XnFrameStream(const XnChar* csType, const XnChar* csName) :
 {
 	m_FPS.UpdateSetCallback(SetFPSCallback, this);
 	m_LastRawFrame.UpdateGetCallback(GetLastRawFrameCallback, this);
-	m_externalBufferPool.UpdateSetCallback(SetExternalBufferPoolCallback, this);
+}
+
+XnStatus XnFrameStream::SetBufferPool(XnBufferPool* pBufferPool)
+{
+	// we only allow this if no buffer pool exists
+	if (m_pBufferPool != NULL)
+	{
+		return XN_STATUS_ERROR;
+	}
+
+	m_pBufferPool = pBufferPool;
+	return (XN_STATUS_OK);
 }
 
 XnStatus XnFrameStream::Init()
@@ -55,47 +64,29 @@ XnStatus XnFrameStream::Init()
 	nRetVal = XnDeviceStream::Init();
 	XN_IS_STATUS_OK(nRetVal);
 
-	XN_VALIDATE_ADD_PROPERTIES(this, &m_IsFrameStream, &m_FPS, &m_LastRawFrame, &m_externalBufferPool );
+	XN_VALIDATE_ADD_PROPERTIES(this, &m_IsFrameStream, &m_FPS, &m_LastRawFrame);
 
 	XnCallbackHandle hDummy;
 
 	// be notified when required size changes
-	nRetVal = RequiredSizeProperty().OnChangeEvent().Register(RequiredSizeChangedCallback, this, hDummy);
+	nRetVal = RequiredSizeProperty().OnChangeEvent().Register(RequiredSizeChangedCallback, this, &hDummy);
 	XN_IS_STATUS_OK(nRetVal);
 
-	return (XN_STATUS_OK);
-}
-
-XnStatus XnFrameStream::GetTripleBuffer(XnFrameBufferManager** pBufferManager)
-{
-	XnStatus nRetVal = XN_STATUS_OK;
-	
-	// lazy initialization (this allows us to set buffer pool after initialization of the stream
-	// and before data actually arrives (or stream data is allocated)
-	if (m_pBufferManager == NULL)
+	if (m_pBufferPool == NULL)
 	{
-		if (m_pBufferPool == NULL)
-		{
-			XN_VALIDATE_NEW(m_pBufferPool, XnSimpleBufferPool, 3);
-			m_bPoolAllocated = TRUE;
-
-			nRetVal = m_pBufferPool->Init(GetRequiredDataSize());
-			XN_IS_STATUS_OK(nRetVal);
-		}
-
-		// allocate buffer manager
-		XN_VALIDATE_NEW(m_pBufferManager, XnFrameBufferManager, m_pBufferPool);
+		XN_VALIDATE_NEW(m_pBufferPool, XnSimpleBufferPool, 3);
+		m_bPoolAllocated = TRUE;
+	}
 
-		nRetVal = m_pBufferManager->Init(GetRequiredDataSize());
-		XN_IS_STATUS_OK(nRetVal);
+	// allocate buffer manager
+	XN_VALIDATE_NEW(m_pBufferManager, XnFrameBufferManager, m_pBufferPool);
 
-		// register for new data events
-		XnCallbackHandle hDummy;
-		nRetVal = m_pBufferManager->OnNewFrameEvent().Register(OnTripleBufferNewData, this, hDummy);
-		XN_IS_STATUS_OK(nRetVal);
-	}
+	nRetVal = m_pBufferManager->Init(GetRequiredDataSize());
+	XN_IS_STATUS_OK(nRetVal);
 
-	*pBufferManager = m_pBufferManager;
+	// register for new data events
+	nRetVal = m_pBufferManager->OnNewFrameEvent().Register(OnTripleBufferNewData, this, &hDummy);
+	XN_IS_STATUS_OK(nRetVal);
 
 	return (XN_STATUS_OK);
 }
@@ -125,35 +116,22 @@ XnStatus XnFrameStream::CreateStreamData(XnStreamData** ppStreamData)
 	
 	XnStreamData* pStreamData;
 
-	// NOTE: in any case, we must make sure data is not null, because some old applications
-	// counts on it (they might read the data before the first frame).
+	// we create a StreamData object with no buffer allocated. The buffer will just be 
+	// a pointer to the triple buffer
+	nRetVal = XnStreamDataCreateNoBuffer(&pStreamData, GetName());
+	XN_IS_STATUS_OK(nRetVal);
 
-	// check if the buffer pool has been set yet
-	if (m_pBufferPool == NULL)
-	{
-		// Create it with a buffer. This buffer will be later on freed when buffers from 
-		// the buffer pool will be used.
-		nRetVal = XnStreamDataCreate(&pStreamData, GetName(), GetRequiredDataSize());
-		XN_IS_STATUS_OK(nRetVal);
-	}
-	else
+	// However, we don't want the user to get a null pointer, even if no new frame yet,
+	// so we'll initialize the data with one of the buffers
+	nRetVal = m_pBufferPool->GetBuffer(&pStreamData->pInternal->pLockedBuffer);
+	if (nRetVal != XN_STATUS_OK)
 	{
-		// we create a StreamData object with no buffer allocated. The buffer will just be 
-		// a pointer from the buffer pool
-		nRetVal = XnStreamDataCreateNoBuffer(&pStreamData, GetName());
-		XN_IS_STATUS_OK(nRetVal);
-
-		// take a buffer from the pool
-		nRetVal = m_pBufferPool->GetBuffer(&pStreamData->pInternal->pLockedBuffer);
-		if (nRetVal != XN_STATUS_OK)
-		{
-			XnStreamDataDestroy(&pStreamData);
-			return (nRetVal);
-		}
-
-		pStreamData->pData = (void*)pStreamData->pInternal->pLockedBuffer->GetData();
+		XnStreamDataDestroy(&pStreamData);
+		return (nRetVal);
 	}
 
+	pStreamData->pData = (void*)pStreamData->pInternal->pLockedBuffer->GetData();
+
 	*ppStreamData = pStreamData;
 	
 	return (XN_STATUS_OK);
@@ -173,10 +151,6 @@ XnStatus XnFrameStream::OnRequiredSizeChanging()
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 
-	// if the stream already notified it has new data, this must be undone, as we don't want
-	// the application getting frames of unexpected size
-	ResetNewDataAvailableFlag();
-
 	nRetVal = ReallocTripleFrameBuffer();
 	XN_IS_STATUS_OK(nRetVal);
 
@@ -187,13 +161,10 @@ XnStatus XnFrameStream::ReallocTripleFrameBuffer()
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 
-	if (m_pBufferManager != NULL)
-	{
-		nRetVal = m_pBufferManager->Reallocate(GetRequiredDataSize());
-		XN_IS_STATUS_OK(nRetVal);
+	nRetVal = m_pBufferManager->Reallocate(GetRequiredDataSize());
+	XN_IS_STATUS_OK(nRetVal);
 
-		m_bTripleBufferReallocated = TRUE;
-	}
+	m_bTripleBufferReallocated = TRUE;
 
 	return (XN_STATUS_OK);
 }
@@ -215,17 +186,7 @@ XnStatus XnFrameStream::ReadImpl(XnStreamData* pStreamOutput)
 	XnStatus nRetVal = XN_STATUS_OK;
 
 	// release previous buffer
-	if (pStreamOutput->pInternal->pLockedBuffer != NULL)
-	{
-		m_pBufferPool->DecRef(pStreamOutput->pInternal->pLockedBuffer);
-	}
-	else if (pStreamOutput->pInternal->nAllocSize > 0)
-	{
-		// no need for this buffer, we're replacing it with a pointer to the 
-		// buffer pool
-		nRetVal = XnStreamDataUpdateSize(pStreamOutput, 0);
-		XN_IS_STATUS_OK(nRetVal);
-	}
+	m_pBufferPool->DecRef(pStreamOutput->pInternal->pLockedBuffer);
 
 	m_pBufferManager->ReadLastStableBuffer(
 		&pStreamOutput->pInternal->pLockedBuffer, 
@@ -252,38 +213,6 @@ XnStatus XnFrameStream::GetLastRawFrame(XnDynamicSizeBuffer* pBuffer)
 	return (XN_STATUS_OK);
 }
 
-XnStatus XnFrameStream::SetExternalBufferPool(XnUInt32 nCount, XnGeneralBuffer* aBuffers)
-{
-	XnStatus nRetVal = XN_STATUS_OK;
-	
-	if (m_pBufferPool != NULL)
-	{
-		xnLogError(XN_MASK_DDK, "Cannot change buffer pool.");
-		return XN_STATUS_DEVICE_PROPERTY_READ_ONLY;
-	}
-
-	XnExternalBufferPool* pExternalBufferPool;
-	XN_VALIDATE_NEW(pExternalBufferPool, XnExternalBufferPool);
-
-	nRetVal = pExternalBufferPool->SetBuffers(nCount, aBuffers);
-	if (nRetVal != XN_STATUS_OK)
-	{
-		XN_DELETE(pExternalBufferPool);
-		return (nRetVal);
-	}
-
-	nRetVal = pExternalBufferPool->Init(GetRequiredDataSize());
-	if (nRetVal != XN_STATUS_OK)
-	{
-		XN_DELETE(pExternalBufferPool);
-		return (nRetVal);
-	}
-
-	m_pBufferPool = pExternalBufferPool;
-
-	return (XN_STATUS_OK);
-}
-
 XnStatus XN_CALLBACK_TYPE XnFrameStream::SetFPSCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
 {
 	XnFrameStream* pThis = (XnFrameStream*)pCookie;
@@ -296,10 +225,10 @@ XnStatus XN_CALLBACK_TYPE XnFrameStream::RequiredSizeChangedCallback(const XnPro
 	return pThis->OnRequiredSizeChanging();
 }
 
-void XN_CALLBACK_TYPE XnFrameStream::OnTripleBufferNewData(const XnFrameBufferManager::NewFrameEventArgs& args, void* pCookie)
+void XN_CALLBACK_TYPE XnFrameStream::OnTripleBufferNewData(XnFrameBufferManager* /*pTripleBuffer*/, XnUInt64 nTimestamp, void* pCookie)
 {
 	XnFrameStream* pThis = (XnFrameStream*)pCookie;
-	pThis->NewDataAvailable(args.nTimestamp, pThis->m_nLastReadFrame + 1);
+	pThis->NewDataAvailable(nTimestamp, pThis->m_nLastReadFrame + 1);
 }
 
 XnStatus XN_CALLBACK_TYPE XnFrameStream::GetLastRawFrameCallback(const XnGeneralProperty* /*pSender*/, const XnGeneralBuffer& gbValue, void* pCookie)
@@ -309,9 +238,3 @@ XnStatus XN_CALLBACK_TYPE XnFrameStream::GetLastRawFrameCallback(const XnGeneral
 	XnDynamicSizeBuffer* pBuffer = (XnDynamicSizeBuffer*)gbValue.pData;
 	return pThis->GetLastRawFrame(pBuffer);
 }
-
-XnStatus XN_CALLBACK_TYPE XnFrameStream::SetExternalBufferPoolCallback(XnGeneralProperty* /*pSender*/, const XnGeneralBuffer& gbValue, void* pCookie)
-{
-	XnFrameStream* pThis = (XnFrameStream*)pCookie;
-	return pThis->SetExternalBufferPool(gbValue.nDataSize / sizeof(XnGeneralBuffer), (XnGeneralBuffer*)gbValue.pData);
-}
\ No newline at end of file
diff --git a/Source/XnDDK/XnFrameStream.h b/Source/XnDDK/XnFrameStream.h
index bc88407..9cded71 100644
--- a/Source/XnDDK/XnFrameStream.h
+++ b/Source/XnDDK/XnFrameStream.h
@@ -39,11 +39,12 @@ public:
 	XnFrameStream(const XnChar* csType, const XnChar* csName);
 	~XnFrameStream() { Free(); }
 
+	XnStatus SetBufferPool(XnBufferPool* pBufferPool);
+
 	//---------------------------------------------------------------------------
 	// Getters
 	//---------------------------------------------------------------------------
 	inline XnUInt32 GetFPS() const { return (XnUInt32)m_FPS.GetValue(); }
-	inline XnBufferPool* GetBufferPool() { return m_pBufferPool; }
 
 	//---------------------------------------------------------------------------
 	// Overridden Methods
@@ -53,16 +54,16 @@ public:
 	XnStatus CreateStreamData(XnStreamData** ppStreamData);
 	XnStatus Read(XnStreamData* pStreamOutput);
 
-protected:
 	//---------------------------------------------------------------------------
-	// Properties Getters
+	// Getters
 	//---------------------------------------------------------------------------
-	inline XnActualIntProperty& FPSProperty() { return m_FPS; }
+	inline XnFrameBufferManager* GetTripleBuffer() { return m_pBufferManager; }
 
+protected:
 	//---------------------------------------------------------------------------
-	// Getters
+	// Properties Getters
 	//---------------------------------------------------------------------------
-	XnStatus GetTripleBuffer(XnFrameBufferManager** pBufferManager);
+	inline XnActualIntProperty& FPSProperty() { return m_FPS; }
 
 	//---------------------------------------------------------------------------
 	// Setters
@@ -83,13 +84,11 @@ protected:
 private:
 	XnStatus OnRequiredSizeChanging();
 	XnStatus GetLastRawFrame(XnDynamicSizeBuffer* gbValue);
-	XnStatus SetExternalBufferPool(XnUInt32 nCount, XnGeneralBuffer* aBuffers);
 
 	static XnStatus XN_CALLBACK_TYPE SetFPSCallback(XnActualIntProperty* pSenser, XnUInt64 nValue, void* pCookie);
 	static XnStatus XN_CALLBACK_TYPE RequiredSizeChangedCallback(const XnProperty* pSenser, void* pCookie);
-	static void XN_CALLBACK_TYPE OnTripleBufferNewData(const XnFrameBufferManager::NewFrameEventArgs& args, void* pCookie);
+	static void XN_CALLBACK_TYPE OnTripleBufferNewData(XnFrameBufferManager* pTripleBuffer, XnUInt64 nTimestamp, void* pCookie);
 	static XnStatus XN_CALLBACK_TYPE GetLastRawFrameCallback(const XnGeneralProperty* pSender, const XnGeneralBuffer& gbValue, void* pCookie);
-	static XnStatus XN_CALLBACK_TYPE SetExternalBufferPoolCallback(XnGeneralProperty* pSender, const XnGeneralBuffer& gbValue, void* pCookie);
 
 	//---------------------------------------------------------------------------
 	// Members
@@ -102,7 +101,6 @@ private:
 
 	XnActualIntProperty m_IsFrameStream;
 	XnActualIntProperty m_FPS;
-	XnGeneralProperty m_externalBufferPool;
 	XnGeneralProperty m_LastRawFrame;
 	XnBool m_bTripleBufferReallocated;
 };
diff --git a/Source/XnDDK/XnIntPropertySynchronizer.cpp b/Source/XnDDK/XnIntPropertySynchronizer.cpp
index 20fbe70..d76214c 100644
--- a/Source/XnDDK/XnIntPropertySynchronizer.cpp
+++ b/Source/XnDDK/XnIntPropertySynchronizer.cpp
@@ -49,7 +49,7 @@ XnIntPropertySynchronizer::XnIntPropertySynchronizer()
 
 XnIntPropertySynchronizer::~XnIntPropertySynchronizer()
 {
-	for (CookiesList::Iterator it = m_Cookies.Begin(); it != m_Cookies.End(); ++it)
+	for (XnList::Iterator it = m_Cookies.begin(); it != m_Cookies.end(); ++it)
 	{
 		XnIntSynchronizerCookie* pSynchData = (XnIntSynchronizerCookie*)*it;
 		pSynchData->pSource->OnChangeEvent().Unregister(pSynchData->hCallback);
@@ -104,11 +104,11 @@ XnStatus XnIntPropertySynchronizer::RegisterSynchronization(XnIntProperty* pSour
 		return (nRetVal);
 	}
 
-	nRetVal = pSource->OnChangeEvent().Register(IntPropertyValueChangedCallback, pCookie, pCookie->hCallback);
+	nRetVal = pSource->OnChangeEvent().Register(IntPropertyValueChangedCallback, pCookie, &pCookie->hCallback);
 	if (nRetVal != XN_STATUS_OK)
 	{
 		XN_DELETE(pCookie);
-		m_Cookies.Remove(m_Cookies.Begin());
+		m_Cookies.Remove(m_Cookies.begin());
 		return (nRetVal);
 	}
 	
diff --git a/Source/XnDDK/XnIntPropertySynchronizer.h b/Source/XnDDK/XnIntPropertySynchronizer.h
index 8ebfda5..1627d90 100644
--- a/Source/XnDDK/XnIntPropertySynchronizer.h
+++ b/Source/XnDDK/XnIntPropertySynchronizer.h
@@ -25,7 +25,7 @@
 //---------------------------------------------------------------------------
 // Includes
 //---------------------------------------------------------------------------
-#include <XnListT.h>
+#include <XnList.h>
 #include <XnDDK/XnIntProperty.h>
 
 //---------------------------------------------------------------------------
@@ -33,8 +33,6 @@
 //---------------------------------------------------------------------------
 typedef XnStatus (XN_CALLBACK_TYPE* XnIntPropertyConvertCallback)(XnUInt64 nSourceValue, XnUInt64* pnDestValue);
 
-class XnIntSynchronizerCookie; // forward declaration
-
 class XN_DDK_CPP_API XnIntPropertySynchronizer
 {
 public:
@@ -44,8 +42,7 @@ public:
 	XnStatus RegisterSynchronization(XnIntProperty* pSource, XnIntProperty* pDestination, XnIntPropertyConvertCallback pConvertFunc = NULL);
 
 private:
-	typedef XnListT<XnIntSynchronizerCookie*> CookiesList;
-	CookiesList m_Cookies;
+	XnList m_Cookies;
 };
 
 #endif //__XN_INT_PROPERTY_SYNCHRONIZER_H__
diff --git a/Source/XnDDK/XnPixelStream.cpp b/Source/XnDDK/XnPixelStream.cpp
index 1ac5ff3..2417648 100644
--- a/Source/XnDDK/XnPixelStream.cpp
+++ b/Source/XnDDK/XnPixelStream.cpp
@@ -78,16 +78,16 @@ XnStatus XnPixelStream::Init()
 
 	// register for important properties
 	XnCallbackHandle hDummyCallback;
-	nRetVal = m_Resolution.OnChangeEvent().Register(ResolutionValueChangedCallback, this, hDummyCallback);
+	nRetVal = m_Resolution.OnChangeEvent().Register(ResolutionValueChangedCallback, this, &hDummyCallback);
 	XN_IS_STATUS_OK(nRetVal);
 
-	nRetVal = OutputFormatProperty().OnChangeEvent().Register(OutputFormatValueChangedCallback, this, hDummyCallback);
+	nRetVal = OutputFormatProperty().OnChangeEvent().Register(OutputFormatValueChangedCallback, this, &hDummyCallback);
 	XN_IS_STATUS_OK(nRetVal);
 
-	nRetVal = m_XRes.OnChangeEvent().Register(FixCroppingCallback, this, hDummyCallback);
+	nRetVal = m_XRes.OnChangeEvent().Register(FixCroppingCallback, this, &hDummyCallback);
 	XN_IS_STATUS_OK(nRetVal);
 
-	nRetVal = m_YRes.OnChangeEvent().Register(FixCroppingCallback, this, hDummyCallback);
+	nRetVal = m_YRes.OnChangeEvent().Register(FixCroppingCallback, this, &hDummyCallback);
 	XN_IS_STATUS_OK(nRetVal);
 
 	return (XN_STATUS_OK);
diff --git a/Source/XnDDK/XnPixelStream.h b/Source/XnDDK/XnPixelStream.h
index 56ba822..7c72dae 100644
--- a/Source/XnDDK/XnPixelStream.h
+++ b/Source/XnDDK/XnPixelStream.h
@@ -53,7 +53,6 @@ public:
 	inline XnUInt32 GetYRes() const { return (XnUInt32)m_YRes.GetValue(); }
 	inline XnUInt32 GetBytesPerPixel() const { return (XnUInt32)m_BytesPerPixel.GetValue(); }
 	inline const XnCropping* GetCropping() const { return (XnCropping*)m_Cropping.GetValue().pData; }
-	inline const XnArray<XnCmosPreset>& GetSupportedModes() const { return m_supportedModesData; }
 
 protected:
 	XnStatus AddSupportedModes(XnCmosPreset* aPresets, XnUInt32 nCount);
diff --git a/Source/XnDDK/XnProperty.cpp b/Source/XnDDK/XnProperty.cpp
index 6e6579f..42c548f 100644
--- a/Source/XnDDK/XnProperty.cpp
+++ b/Source/XnDDK/XnProperty.cpp
@@ -34,12 +34,9 @@
 XnProperty::XnProperty(XnPropertyType Type, void* pValueHolder, const XnChar* strName, const XnChar* strModule) :
 	m_Type(Type),
 	m_pSetCallback(NULL),
-	m_pSetCallbackCookie(NULL),
 	m_pGetCallback(NULL),
-	m_pGetCallbackCookie(NULL),
 	m_pValueHolder(pValueHolder),
-	m_LogSeverity(XN_LOG_INFO),
-	m_bAlwaysSet(FALSE)
+	m_LogSeverity(XN_LOG_INFO)
 {
 	UpdateName(strModule, strName);
 }
@@ -169,23 +166,3 @@ XnBool XnProperty::ConvertValueToString(XnChar* /*csValue*/, const void* /*pValu
 {
 	return FALSE;
 }
-
-XnStatus XnProperty::ChangeEvent::Raise(const XnProperty* pSender)
-{
-	XnStatus nRetVal = XN_STATUS_OK;
-	XnAutoCSLocker locker(m_hLock);
-	ApplyListChanges();
-
-	for (CallbackPtrList::ConstIterator it = m_callbacks.Begin(); it != m_callbacks.End(); ++it)
-	{
-		TCallback* pCallback = *it;
-		nRetVal = pCallback->pFunc(pSender, pCallback->pCookie);
-		if (nRetVal != XN_STATUS_OK)
-		{
-			break;
-		}
-	}
-
-	ApplyListChanges();
-	return (nRetVal);
-}
diff --git a/Source/XnDDK/XnProperty.h b/Source/XnDDK/XnProperty.h
index c6a3d28..0edb96a 100644
--- a/Source/XnDDK/XnProperty.h
+++ b/Source/XnDDK/XnProperty.h
@@ -26,10 +26,10 @@
 // Includes
 //---------------------------------------------------------------------------
 #include <XnDevice.h>
-#include <XnListT.h>
-#include <XnStringsHashT.h>
+#include <XnList.h>
+#include <XnStringsHash.h>
 #include <XnLog.h>
-#include <XnEventT.h>
+#include <XnEvent.h>
 
 //---------------------------------------------------------------------------
 // Types
@@ -42,9 +42,6 @@
 class XN_DDK_CPP_API XnProperty
 {
 public:
-	typedef XnStatus (XN_CALLBACK_TYPE* OnValueChangedHandler)(const XnProperty* pSender, void* pCookie);
-	typedef XnEventInterfaceT<OnValueChangedHandler> ChangeEventInterface;
-
 	/**
 	* Creates a new property. 
 	*
@@ -62,6 +59,8 @@ public:
 	inline XnBool IsReadOnly() const { return (m_pGetCallback == NULL); }
 	inline XnPropertyType GetType() const { return m_Type; }
 
+	XN_DECLARE_EVENT_1ARG_RETVAL(ChangeEvent, ChangeEventInterface, const XnProperty*, pSender);
+
 	inline ChangeEventInterface& OnChangeEvent() { return m_OnChangeEvent; }
 
 	/** Updates property name. */
@@ -70,6 +69,8 @@ public:
 	/** Updates the value of the property according to an INI file. */
 	virtual XnStatus ReadValueFromFile(const XnChar* csINIFile, const XnChar* csSection) = 0;
 
+	typedef XnStatus (XN_CALLBACK_TYPE* OnValueChangedHandler)(const XnProperty* pSender, void* pCookie);
+
 	/** Adds this property to the property set. */
 	virtual XnStatus AddToPropertySet(XnPropertySet* pSet) = 0;
 
@@ -108,12 +109,6 @@ protected:
 	inline void* Value() const { return m_pValueHolder; }
 
 private:
-	class ChangeEvent : public XnEventInterfaceT<OnValueChangedHandler>
-	{
-	public:
-		XnStatus Raise(const XnProperty* pSender);
-	};
-
 	XnChar m_strModule[XN_DEVICE_MAX_STRING_LENGTH]; // module name
 	XnChar m_strName[XN_DEVICE_MAX_STRING_LENGTH]; // property name
 	XnPropertyType m_Type; // property type
@@ -135,9 +130,9 @@ private:
 };
 
 /** A property list */
-typedef XnListT<XnProperty*> XnPropertiesList;
+XN_DECLARE_LIST_DECL(XN_DDK_CPP_API, XnProperty*, XnPropertiesList)
 
 /** A hash table, mapping property name to the property */
-typedef XnStringsHashT<XnProperty*> XnPropertiesHash;
+XN_DECLARE_STRINGS_HASH_DECL(XN_DDK_CPP_API, XnProperty*, XnPropertiesHash)
 
 #endif //__XN_PROPERTY_H__
diff --git a/Source/XnDDK/XnPropertySet.cpp b/Source/XnDDK/XnPropertySet.cpp
index 1f906a5..c79a51e 100644
--- a/Source/XnDDK/XnPropertySet.cpp
+++ b/Source/XnDDK/XnPropertySet.cpp
@@ -23,6 +23,8 @@
 // Includes
 //---------------------------------------------------------------------------
 #include "XnPropertySetInternal.h"
+#include <XnList.h>
+#include <XnStringsHash.h>
 #include "XnActualIntProperty.h"
 #include "XnActualRealProperty.h"
 #include "XnActualStringProperty.h"
@@ -31,8 +33,13 @@
 //---------------------------------------------------------------------------
 // Types
 //---------------------------------------------------------------------------
+
 struct XnPropertySetModuleEnumerator
 {
+	XnPropertySetModuleEnumerator(XnPropertySetData* pModules) : 
+		bFirst(TRUE), pModules(pModules), it(pModules->end()) 
+	{}
+
 	XnBool bFirst;
 	XnPropertySetData* pModules;
 	XnPropertySetData::ConstIterator it;
@@ -40,11 +47,17 @@ struct XnPropertySetModuleEnumerator
 
 struct XnPropertySetEnumerator
 {
+	XnPropertySetEnumerator(XnPropertySetData* pModules, const XnChar* strModule) :
+		bFirst(TRUE), pModules(pModules), itModule(pModules->end()), pItProp(NULL)
+	{
+		strncpy(this->strModule, strModule, XN_DEVICE_MAX_STRING_LENGTH);
+	}
+
 	XnBool bFirst;
 	XnPropertySetData* pModules;
 	XnPropertySetData::ConstIterator itModule;
 	XnChar strModule[XN_DEVICE_MAX_STRING_LENGTH];
-	XnActualPropertiesHash::ConstIterator itProp;
+	XnActualPropertiesHash::ConstIterator* pItProp;
 };
 
 //---------------------------------------------------------------------------
@@ -66,7 +79,7 @@ XN_DDK_API XnStatus XnPropertySetCreate(XnPropertySet** ppSet)
 	}
 
 	*ppSet = pSet;
-
+	
 	return (XN_STATUS_OK);
 }
 
@@ -86,19 +99,19 @@ XN_DDK_API XnStatus XnPropertySetDestroy(XnPropertySet** ppSet)
 	xnOSFree(pSet);
 
 	*ppSet = NULL;
-
+	
 	return (XN_STATUS_OK);
 }
 
 XN_DDK_API XnStatus XnPropertySetClear(XnPropertySet* pSet)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
-
+	
 	XN_VALIDATE_INPUT_PTR(pSet);
 
 	while (!pSet->pData->IsEmpty())
 	{
-		nRetVal = XnPropertySetRemoveModule(pSet, pSet->pData->Begin()->Key());
+		nRetVal = XnPropertySetRemoveModule(pSet, pSet->pData->begin().Key());
 		XN_IS_STATUS_OK(nRetVal);
 	}
 
@@ -108,7 +121,7 @@ XN_DDK_API XnStatus XnPropertySetClear(XnPropertySet* pSet)
 XN_DDK_API XnStatus XnPropertySetAddModule(XnPropertySet* pSet, const XnChar* strModuleName)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
-
+	
 	XN_VALIDATE_INPUT_PTR(pSet);
 	XN_VALIDATE_INPUT_PTR(strModuleName);
 
@@ -154,13 +167,13 @@ XN_DDK_API XnStatus XnPropertySetRemoveModule(XnPropertySet* pSet, const XnChar*
 XN_DDK_API XnStatus XnPropertySetAddIntProperty(XnPropertySet* pSet, const XnChar* strModuleName, const XnChar* strProperty, XnUInt64 nValue)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
-
+	
 	XN_VALIDATE_INPUT_PTR(pSet);
 	XN_VALIDATE_INPUT_PTR(strModuleName);
 	XN_VALIDATE_INPUT_PTR(strProperty);
 
 	// get module
-	XnActualPropertiesHash* pModule = NULL;
+	XnActualPropertiesHash* pModule;
 	nRetVal = pSet->pData->Get(strModuleName, pModule);
 	XN_IS_STATUS_OK(nRetVal);
 
@@ -180,7 +193,7 @@ XN_DDK_API XnStatus XnPropertySetAddRealProperty(XnPropertySet* pSet, const XnCh
 	XN_VALIDATE_INPUT_PTR(strProperty);
 
 	// get module
-	XnActualPropertiesHash* pModule = NULL;
+	XnActualPropertiesHash* pModule;
 	nRetVal = pSet->pData->Get(strModuleName, pModule);
 	XN_IS_STATUS_OK(nRetVal);
 
@@ -201,7 +214,7 @@ XN_DDK_API XnStatus XnPropertySetAddStringProperty(XnPropertySet* pSet, const Xn
 	XN_VALIDATE_INPUT_PTR(strValue);
 
 	// get module
-	XnActualPropertiesHash* pModule = NULL;
+	XnActualPropertiesHash* pModule;
 	nRetVal = pSet->pData->Get(strModuleName, pModule);
 	XN_IS_STATUS_OK(nRetVal);
 
@@ -222,7 +235,7 @@ XN_DDK_API XnStatus XnPropertySetAddGeneralProperty(XnPropertySet* pSet, const X
 	XN_VALIDATE_INPUT_PTR(pgbValue);
 
 	// get module
-	XnActualPropertiesHash* pModule = NULL;
+	XnActualPropertiesHash* pModule;
 	nRetVal = pSet->pData->Get(strModuleName, pModule);
 	XN_IS_STATUS_OK(nRetVal);
 
@@ -236,13 +249,13 @@ XN_DDK_API XnStatus XnPropertySetAddGeneralProperty(XnPropertySet* pSet, const X
 XN_DDK_API XnStatus XnPropertySetRemoveProperty(XnPropertySet* pSet, const XnChar* strModuleName, const XnChar* strProperty)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
-
+	
 	XN_VALIDATE_INPUT_PTR(pSet);
 	XN_VALIDATE_INPUT_PTR(strModuleName);
 	XN_VALIDATE_INPUT_PTR(strProperty);
 
 	// get module
-	XnActualPropertiesHash* pModule = NULL;
+	XnActualPropertiesHash* pModule;
 	nRetVal = pSet->pData->Get(strModuleName, pModule);
 	XN_IS_STATUS_OK(nRetVal);
 
@@ -259,11 +272,7 @@ XN_DDK_API XnStatus XnPropertySetGetModuleEnumerator(const XnPropertySet* pSet,
 	XN_VALIDATE_OUTPUT_PTR(ppEnumerator);
 
 	XnPropertySetModuleEnumerator* pEnumer;
-	XN_VALIDATE_NEW(pEnumer, XnPropertySetModuleEnumerator);
-
-	pEnumer->bFirst = TRUE;
-	pEnumer->it = pSet->pData->End();
-	pEnumer->pModules = pSet->pData;
+	XN_VALIDATE_NEW(pEnumer, XnPropertySetModuleEnumerator, pSet->pData);
 
 	*ppEnumerator = pEnumer;
 
@@ -274,7 +283,7 @@ XN_DDK_API XnStatus XnPropertySetModuleEnumeratorFree(XnPropertySetModuleEnumera
 {
 	XN_VALIDATE_INPUT_PTR(ppEnumer);
 	XN_VALIDATE_INPUT_PTR(*ppEnumer);
-
+	
 	XN_DELETE(*ppEnumer);
 	*ppEnumer = NULL;
 
@@ -288,10 +297,10 @@ XN_DDK_API XnStatus XnPropertySetModuleEnumeratorMoveNext(XnPropertySetModuleEnu
 
 	if (pEnumerator->bFirst)
 	{
-		pEnumerator->it = pEnumerator->pModules->Begin();
+		pEnumerator->it = pEnumerator->pModules->begin();
 		pEnumerator->bFirst = FALSE;
 	}
-	else if (pEnumerator->it == pEnumerator->pModules->End())
+	else if (pEnumerator->it == pEnumerator->pModules->end())
 	{
 		return XN_STATUS_ILLEGAL_POSITION;
 	}
@@ -300,8 +309,8 @@ XN_DDK_API XnStatus XnPropertySetModuleEnumeratorMoveNext(XnPropertySetModuleEnu
 		pEnumerator->it++;
 	}
 
-	*pbEnd = (pEnumerator->it == pEnumerator->pModules->End());
-
+	*pbEnd = (pEnumerator->it == pEnumerator->pModules->end());
+	
 	return (XN_STATUS_OK);
 }
 
@@ -309,13 +318,13 @@ XN_DDK_API XnStatus XnPropertySetModuleEnumeratorGetCurrent(const XnPropertySetM
 {
 	XN_VALIDATE_INPUT_PTR(pEnumer);
 	XN_VALIDATE_OUTPUT_PTR(pstrModuleName);
-
-	if (pEnumer->it == pEnumer->pModules->End())
+	
+	if (pEnumer->it == pEnumer->pModules->end())
 	{
 		return XN_STATUS_ILLEGAL_POSITION;
 	}
 
-	*pstrModuleName = pEnumer->it->Key();
+	*pstrModuleName = pEnumer->it.Key();
 
 	return (XN_STATUS_OK);
 }
@@ -323,31 +332,20 @@ XN_DDK_API XnStatus XnPropertySetModuleEnumeratorGetCurrent(const XnPropertySetM
 XN_DDK_API XnStatus XnPropertySetGetEnumerator(const XnPropertySet* pSet, XnPropertySetEnumerator** ppEnumerator, const XnChar* strModule /* = NULL */)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
-
+	
 	XN_VALIDATE_INPUT_PTR(pSet);
 	XN_VALIDATE_OUTPUT_PTR(ppEnumerator);
 
 	if (strModule != NULL)
 	{
 		// make sure module exists
-		XnPropertySetData::ConstIterator it = pSet->pData->End();
+		XnPropertySetData::ConstIterator it = pSet->pData->end();
 		nRetVal = pSet->pData->Find(strModule, it);
 		XN_IS_STATUS_OK(nRetVal);
 	}
 
 	XnPropertySetEnumerator* pEnumer;
-	XN_VALIDATE_NEW(pEnumer, XnPropertySetEnumerator)
-
-		pEnumer->bFirst = TRUE;
-	pEnumer->pModules = pSet->pData;
-	if (strModule != NULL)
-	{
-		strncpy(pEnumer->strModule, strModule, XN_DEVICE_MAX_STRING_LENGTH);
-	}
-	else
-	{
-		pEnumer->strModule[0] = '\0';
-	}
+	XN_VALIDATE_NEW(pEnumer, XnPropertySetEnumerator, pSet->pData, strModule == NULL ? "" : strModule);
 
 	*ppEnumerator = pEnumer;
 
@@ -364,25 +362,23 @@ XN_DDK_API XnStatus XnPropertySetFindProperty(const XnPropertySet* pSet, const X
 	XN_VALIDATE_OUTPUT_PTR(ppEnumerator);
 
 	// find module
-	XnPropertySetData::Iterator itModule = pSet->pData->End();
+	XnPropertySetData::Iterator itModule = pSet->pData->end();
 	nRetVal = pSet->pData->Find(strModule, itModule);
 	XN_IS_STATUS_OK(nRetVal);
 
-	XnActualPropertiesHash* pModule = itModule->Value();
+	XnActualPropertiesHash* pModule = itModule.Value();
 
 	// find property
-	XnActualPropertiesHash::Iterator itProp = pModule->End();
+	XnActualPropertiesHash::Iterator itProp = pModule->end();
 	nRetVal = pModule->Find(strProp, itProp);
 	XN_IS_STATUS_OK(nRetVal);
 
 	// create enumerator
 	XnPropertySetEnumerator* pEnumer;
-	XN_VALIDATE_NEW(pEnumer, XnPropertySetEnumerator);
+	XN_VALIDATE_NEW(pEnumer, XnPropertySetEnumerator, pSet->pData, "");
 
 	pEnumer->itModule = itModule;
-	pEnumer->itProp = itProp;
-	pEnumer->pModules = pSet->pData;
-	pEnumer->strModule[0] = '\0';
+	XN_VALIDATE_NEW(pEnumer->pItProp, XnActualPropertiesHash::ConstIterator, itProp);
 	pEnumer->bFirst = FALSE;
 
 	*ppEnumerator = pEnumer;
@@ -395,16 +391,17 @@ XN_DDK_API XnStatus XnPropertySetEnumeratorFree(XnPropertySetEnumerator** ppEnum
 	XN_VALIDATE_INPUT_PTR(ppEnumerator);
 	XN_VALIDATE_INPUT_PTR(*ppEnumerator);
 
+	XN_DELETE((*ppEnumerator)->pItProp);
 	XN_DELETE(*ppEnumerator);
 	*ppEnumerator = NULL;
-
+	
 	return (XN_STATUS_OK);
 }
 
 XN_DDK_API XnStatus XnPropertySetEnumeratorMoveNext(XnPropertySetEnumerator* pEnumerator, XnBool* pbEnd)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
-
+	
 	XN_VALIDATE_INPUT_PTR(pEnumerator);
 	XN_VALIDATE_OUTPUT_PTR(pbEnd);
 
@@ -420,23 +417,23 @@ XN_DDK_API XnStatus XnPropertySetEnumeratorMoveNext(XnPropertySetEnumerator* pEn
 			nRetVal = pEnumerator->pModules->Find(pEnumerator->strModule, pEnumerator->itModule);
 			if (nRetVal == XN_STATUS_NO_MATCH)
 			{
-				pEnumerator->itModule = pEnumerator->pModules->End();
+				pEnumerator->itModule = pEnumerator->pModules->end();
 			}
 			XN_IS_STATUS_OK(nRetVal);
 
-			pEnumerator->itProp = pEnumerator->itModule->Value()->Begin();
+			XN_VALIDATE_NEW(pEnumerator->pItProp, XnActualPropertiesHash::ConstIterator, pEnumerator->itModule.Value()->begin());
 		}
-		else if (pEnumerator->itProp == pEnumerator->itModule->Value()->End())
+		else if (*pEnumerator->pItProp == pEnumerator->itModule.Value()->end())
 		{
 			return XN_STATUS_ILLEGAL_POSITION;
 		}
 		else
 		{
 			// advance prop iterator
-			++pEnumerator->itProp;
+			++(*pEnumerator->pItProp);
 		}
 
-		*pbEnd = (pEnumerator->itProp == pEnumerator->itModule->Value()->End());
+		*pbEnd = (*pEnumerator->pItProp == pEnumerator->itModule.Value()->end());
 	}
 	else // all modules
 	{
@@ -445,16 +442,16 @@ XN_DDK_API XnStatus XnPropertySetEnumeratorMoveNext(XnPropertySetEnumerator* pEn
 			pEnumerator->bFirst = FALSE;
 
 			// search for the first modules that has properties
-			pEnumerator->itModule = pEnumerator->pModules->Begin();
-			while (pEnumerator->itModule != pEnumerator->pModules->End() && pEnumerator->itModule->Value()->IsEmpty())
+			pEnumerator->itModule = pEnumerator->pModules->begin();
+			while (pEnumerator->itModule != pEnumerator->pModules->end() && pEnumerator->itModule.Value()->IsEmpty())
 			{
 				pEnumerator->itModule++;
 			}
 
 			// if we found one, take it's first property
-			if (pEnumerator->itModule != pEnumerator->pModules->End())
+			if (pEnumerator->itModule != pEnumerator->pModules->end())
 			{
-				pEnumerator->itProp = pEnumerator->itModule->Value()->Begin();
+				XN_VALIDATE_NEW(pEnumerator->pItProp, XnActualPropertiesHash::ConstIterator, pEnumerator->itModule.Value()->begin());
 				*pbEnd = FALSE;
 			}
 			else
@@ -462,29 +459,32 @@ XN_DDK_API XnStatus XnPropertySetEnumeratorMoveNext(XnPropertySetEnumerator* pEn
 				*pbEnd = TRUE;
 			}
 		}
-		else if (pEnumerator->itModule == pEnumerator->pModules->End())
+		else if (*pEnumerator->pItProp == pEnumerator->pModules->end())
 		{
 			return XN_STATUS_ILLEGAL_POSITION;
 		}
 		else
 		{
 			// move to next one
-			++pEnumerator->itProp;
+			++(*pEnumerator->pItProp);
 
 			// check if we reached end of module
-			if (pEnumerator->itProp == pEnumerator->itModule->Value()->End())
+			if (*pEnumerator->pItProp == pEnumerator->itModule.Value()->end())
 			{
+				XN_DELETE(pEnumerator->pItProp);
+				pEnumerator->pItProp = NULL;
+
 				// move to next module with properties
 				do
 				{
 					pEnumerator->itModule++;
 				}
-				while (pEnumerator->itModule != pEnumerator->pModules->End() && pEnumerator->itModule->Value()->IsEmpty());
+				while (pEnumerator->itModule != pEnumerator->pModules->end() && pEnumerator->itModule.Value()->IsEmpty());
 
 				// if we found one, take it's first property
-				if (pEnumerator->itModule != pEnumerator->pModules->End())
+				if (pEnumerator->itModule != pEnumerator->pModules->end())
 				{
-					pEnumerator->itProp = pEnumerator->itModule->Value()->Begin();
+					XN_VALIDATE_NEW(pEnumerator->pItProp, XnActualPropertiesHash::ConstIterator, pEnumerator->itModule.Value()->begin());
 					*pbEnd = FALSE;
 				}
 				else
@@ -508,12 +508,17 @@ XN_DDK_API XnStatus XnPropertySetEnumeratorGetCurrentPropertyInfo(const XnProper
 	XN_VALIDATE_OUTPUT_PTR(pnType);
 	XN_VALIDATE_OUTPUT_PTR(pstrModule);
 	XN_VALIDATE_OUTPUT_PTR(pstrProp);
-
-	XnProperty* pProp = pEnumerator->itProp->Value();
+	
+	if (pEnumerator->pItProp == NULL)
+	{
+		return XN_STATUS_ILLEGAL_POSITION;
+	}
+	
+	XnProperty* pProp = pEnumerator->pItProp->Value();
 	*pnType = pProp->GetType();
 	*pstrModule = pProp->GetModule();
 	*pstrProp = pProp->GetName();
-
+	
 	return (XN_STATUS_OK);
 }
 
@@ -522,7 +527,12 @@ XN_DDK_API XnStatus XnPropertySetEnumeratorGetIntValue(const XnPropertySetEnumer
 	XN_VALIDATE_INPUT_PTR(pEnumerator);
 	XN_VALIDATE_OUTPUT_PTR(pnValue);
 
-	XnProperty* pPropBase = pEnumerator->itProp->Value();
+	if (pEnumerator->pItProp == NULL)
+	{
+		return XN_STATUS_ILLEGAL_POSITION;
+	}
+
+	XnProperty* pPropBase = pEnumerator->pItProp->Value();
 	if (pPropBase->GetType() != XN_PROPERTY_TYPE_INTEGER)
 	{
 		return XN_STATUS_DEVICE_PROPERTY_BAD_TYPE;
@@ -539,7 +549,12 @@ XN_DDK_API XnStatus XnPropertySetEnumeratorGetRealValue(const XnPropertySetEnume
 	XN_VALIDATE_INPUT_PTR(pEnumerator);
 	XN_VALIDATE_OUTPUT_PTR(pdValue);
 
-	XnProperty* pPropBase = pEnumerator->itProp->Value();
+	if (pEnumerator->pItProp == NULL)
+	{
+		return XN_STATUS_ILLEGAL_POSITION;
+	}
+
+	XnProperty* pPropBase = pEnumerator->pItProp->Value();
 	if (pPropBase->GetType() != XN_PROPERTY_TYPE_REAL)
 	{
 		return XN_STATUS_DEVICE_PROPERTY_BAD_TYPE;
@@ -556,7 +571,12 @@ XN_DDK_API XnStatus XnPropertySetEnumeratorGetStringValue(const XnPropertySetEnu
 	XN_VALIDATE_INPUT_PTR(pEnumerator);
 	XN_VALIDATE_OUTPUT_PTR(pstrValue);
 
-	XnProperty* pPropBase = pEnumerator->itProp->Value();
+	if (pEnumerator->pItProp == NULL)
+	{
+		return XN_STATUS_ILLEGAL_POSITION;
+	}
+
+	XnProperty* pPropBase = pEnumerator->pItProp->Value();
 	if (pPropBase->GetType() != XN_PROPERTY_TYPE_STRING)
 	{
 		return XN_STATUS_DEVICE_PROPERTY_BAD_TYPE;
@@ -573,7 +593,12 @@ XN_DDK_API XnStatus XnPropertySetEnumeratorGetGeneralValue(const XnPropertySetEn
 	XN_VALIDATE_INPUT_PTR(pEnumerator);
 	XN_VALIDATE_OUTPUT_PTR(pgbValue);
 
-	XnProperty* pPropBase = pEnumerator->itProp->Value();
+	if (pEnumerator->pItProp == NULL)
+	{
+		return XN_STATUS_ILLEGAL_POSITION;
+	}
+
+	XnProperty* pPropBase = pEnumerator->pItProp->Value();
 	if (pPropBase->GetType() != XN_PROPERTY_TYPE_GENERAL)
 	{
 		return XN_STATUS_DEVICE_PROPERTY_BAD_TYPE;
@@ -588,35 +613,27 @@ XN_DDK_API XnStatus XnPropertySetEnumeratorGetGeneralValue(const XnPropertySetEn
 XN_DDK_API XnStatus XnPropertySetDataAttachModule(XnPropertySetData* pSetData, const XnChar* strModuleName, XnActualPropertiesHash* pModule)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
-
+	
 	XN_VALIDATE_INPUT_PTR(pSetData);
 	XN_VALIDATE_INPUT_PTR(strModuleName);
 	XN_VALIDATE_INPUT_PTR(pModule);
 
 	nRetVal = pSetData->Set(strModuleName, pModule);
 	XN_IS_STATUS_OK(nRetVal);
-
+	
 	return (XN_STATUS_OK);
 }
 
 XN_DDK_API XnStatus XnPropertySetDataDetachModule(XnPropertySetData* pSetData, const XnChar* strModuleName, XnActualPropertiesHash** ppModule)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
-
+	
 	XN_VALIDATE_INPUT_PTR(pSetData);
 	XN_VALIDATE_INPUT_PTR(strModuleName);
 	XN_VALIDATE_OUTPUT_PTR(ppModule);
-
+	
 	// remove it
-	XnPropertySetDataInternal::Iterator it = pSetData->Find(strModuleName);
-	if (it == pSetData->End())
-	{
-		return XN_STATUS_NO_MATCH;
-	}
-
-	*ppModule = it->Value();
-
-	nRetVal = pSetData->Remove(strModuleName);
+	nRetVal = pSetData->Remove(strModuleName, *ppModule);
 	XN_IS_STATUS_OK(nRetVal);
 
 	return (XN_STATUS_OK);
@@ -625,17 +642,17 @@ XN_DDK_API XnStatus XnPropertySetDataDetachModule(XnPropertySetData* pSetData, c
 XN_DDK_API XnStatus XnPropertySetCloneModule(const XnPropertySet* pSource, XnPropertySet* pDest, const XnChar* strModule, const XnChar* strNewName)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
-
-	XnActualPropertiesHash* pModuleProps = NULL;
+	
+	XnActualPropertiesHash* pModuleProps;
 	nRetVal = pSource->pData->Get(strModule, pModuleProps);
 	XN_IS_STATUS_OK(nRetVal);
 
 	nRetVal = XnPropertySetAddModule(pDest, strNewName);
 	XN_IS_STATUS_OK(nRetVal);
 
-	for (XnActualPropertiesHash::ConstIterator it = pModuleProps->Begin(); it != pModuleProps->End(); ++it)
+	for (XnActualPropertiesHash::ConstIterator it = pModuleProps->begin(); it != pModuleProps->end(); ++it)
 	{
-		XnProperty* pProp = it->Value();
+		XnProperty* pProp = it.Value();
 		switch (pProp->GetType())
 		{
 		case XN_PROPERTY_TYPE_INTEGER:
@@ -670,6 +687,6 @@ XN_DDK_API XnStatus XnPropertySetCloneModule(const XnPropertySet* pSource, XnPro
 			XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_DDK, "Unknown property type: %d", pProp->GetType());
 		}
 	}
-
+	
 	return (XN_STATUS_OK);
 }
diff --git a/Source/XnDDK/XnPropertySetInternal.h b/Source/XnDDK/XnPropertySetInternal.h
index 4e080e7..f17932d 100644
--- a/Source/XnDDK/XnPropertySetInternal.h
+++ b/Source/XnDDK/XnPropertySetInternal.h
@@ -25,7 +25,7 @@
 #include <XnPropertySet.h>
 #include "XnActualPropertiesHash.h"
 
-typedef XnStringsHashT<XnActualPropertiesHash*> XnPropertySetDataInternal;
+XN_DECLARE_STRINGS_HASH_DECL(XN_DDK_CPP_API, XnActualPropertiesHash*, XnPropertySetDataInternal)
 
 class XnPropertySetData;
 
diff --git a/Source/XnDDK/XnShiftToDepthStreamHelper.cpp b/Source/XnDDK/XnShiftToDepthStreamHelper.cpp
index e318e36..50da849 100644
--- a/Source/XnDDK/XnShiftToDepthStreamHelper.cpp
+++ b/Source/XnDDK/XnShiftToDepthStreamHelper.cpp
@@ -95,15 +95,13 @@ XnStatus XnShiftToDepthStreamHelper::InitShiftToDepth()
 
 	XnUInt32 nPropCount = sizeof(propNames) / sizeof(const XnChar*);
 
-	XnCallbackHandle hDummy;
-
 	XnProperty* pProperty = NULL;
 	for (XnUInt32 i = 0; i < nPropCount; ++i)
 	{
 		nRetVal = m_pModule->GetProperty(propNames[i], &pProperty);
 		XN_IS_STATUS_OK(nRetVal);
 
-		nRetVal = pProperty->OnChangeEvent().Register(ShiftToDepthPropertyValueChangedCallback, this, hDummy);
+		nRetVal = pProperty->OnChangeEvent().Register(ShiftToDepthPropertyValueChangedCallback, this);
 		XN_IS_STATUS_OK(nRetVal);
 	}
 
@@ -111,13 +109,13 @@ XnStatus XnShiftToDepthStreamHelper::InitShiftToDepth()
 	nRetVal = m_pModule->GetProperty(XN_STREAM_PROPERTY_MAX_SHIFT, &pProperty);
 	XN_IS_STATUS_OK(nRetVal);
 
-	nRetVal = pProperty->OnChangeEvent().Register(DeviceS2DTablesSizeChangedCallback, this, hDummy);
+	nRetVal = pProperty->OnChangeEvent().Register(DeviceS2DTablesSizeChangedCallback, this);
 	XN_IS_STATUS_OK(nRetVal);
 
 	nRetVal = m_pModule->GetProperty(XN_STREAM_PROPERTY_DEVICE_MAX_DEPTH, &pProperty);
 	XN_IS_STATUS_OK(nRetVal);
 
-	nRetVal = pProperty->OnChangeEvent().Register(DeviceS2DTablesSizeChangedCallback, this, hDummy);
+	nRetVal = pProperty->OnChangeEvent().Register(DeviceS2DTablesSizeChangedCallback, this);
 	XN_IS_STATUS_OK(nRetVal);
 
 	// now init the tables
diff --git a/Source/XnDDK/XnSimpleBufferPool.cpp b/Source/XnDDK/XnSimpleBufferPool.cpp
index 6968619..c73bd5c 100644
--- a/Source/XnDDK/XnSimpleBufferPool.cpp
+++ b/Source/XnDDK/XnSimpleBufferPool.cpp
@@ -27,8 +27,7 @@
 //---------------------------------------------------------------------------
 // Code
 //---------------------------------------------------------------------------
-XnSimpleBufferPool::XnSimpleBufferPool(XnUInt32 nBufferCount) : 
-	m_nBufferCount(nBufferCount)
+XnSimpleBufferPool::XnSimpleBufferPool(XnUInt32 nBufferCount) : XnBufferPool(nBufferCount)
 {}
 
 XnSimpleBufferPool::~XnSimpleBufferPool()
@@ -36,24 +35,33 @@ XnSimpleBufferPool::~XnSimpleBufferPool()
 	FreeAll(TRUE);
 }
 
-XnStatus XnSimpleBufferPool::AllocateBuffers(XnUInt32 nSize)
+XnStatus XnSimpleBufferPool::AllocateBuffers()
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 	
+	// first free old ones
+	FreeAll(FALSE);
+
 	// now allocate new
 	for (XnUInt32 i = 0; i < m_nBufferCount; ++i)
 	{
-		void* pBuffer;
-		XN_VALIDATE_ALIGNED_CALLOC(pBuffer, XnUChar, nSize, XN_DEFAULT_MEM_ALIGN);
-		nRetVal = AddNewBuffer(pBuffer, nSize);
+		XnBufferInPool* pBufferInPool;
+		XN_VALIDATE_NEW(pBufferInPool, XnBufferInPool);
+		nRetVal = pBufferInPool->Allocate(m_nBufferSize);
 		XN_IS_STATUS_OK(nRetVal);
+		pBufferInPool->m_nID = i;
+
+		// add it to all list
+		m_AllBuffers.AddLast(pBufferInPool);
+		// and to free list
+		m_FreeBuffers.AddLast(pBufferInPool);
 	}
 	
 	return (XN_STATUS_OK);
 }
 
-void XnSimpleBufferPool::DestroyBuffer(void* pBuffer)
+void XnSimpleBufferPool::DestroyBuffer(XnBufferInPool* pBuffer)
 {
-	xnOSFreeAligned(pBuffer);
+	XN_DELETE(pBuffer);
 }
 
diff --git a/Source/XnDDK/XnSimpleBufferPool.h b/Source/XnDDK/XnSimpleBufferPool.h
index 5232c37..b30e14d 100644
--- a/Source/XnDDK/XnSimpleBufferPool.h
+++ b/Source/XnDDK/XnSimpleBufferPool.h
@@ -26,6 +26,7 @@
 // Includes
 //---------------------------------------------------------------------------
 #include "XnBufferPool.h"
+#include <XnList.h>
 
 //---------------------------------------------------------------------------
 // Types
@@ -37,11 +38,8 @@ public:
 	~XnSimpleBufferPool();
 
 protected:
-	virtual XnStatus AllocateBuffers(XnUInt32 nSize);
-	virtual void DestroyBuffer(void* pBuffer);
-
-private:
-	XnUInt32 m_nBufferCount;
+	virtual XnStatus AllocateBuffers();
+	virtual void DestroyBuffer(XnBufferInPool* pBuffer);
 };
 
 #endif // __XN_SIMPLE_BUFFER_POOL_H__
\ No newline at end of file
diff --git a/Source/XnDDK/XnStreamData.cpp b/Source/XnDDK/XnStreamData.cpp
index ceb6d41..2abfee7 100644
--- a/Source/XnDDK/XnStreamData.cpp
+++ b/Source/XnDDK/XnStreamData.cpp
@@ -83,30 +83,23 @@ XN_DDK_API XnStatus XnStreamDataUpdateSize(XnStreamData* pStreamOutput, XnUInt32
 	XN_VALIDATE_INPUT_PTR(pStreamOutput);
 
 	// allocate new memory
-	void* pNew = NULL;
-	
-	if (nAllocSize > 0)
-	{
-		pNew = xnOSMallocAligned(nAllocSize, XN_DEFAULT_MEM_ALIGN);
-		if (pNew == NULL)
-			return (XN_STATUS_ALLOC_FAILED);
+	void* pNew = xnOSMallocAligned(nAllocSize, XN_DEFAULT_MEM_ALIGN);
+	if (pNew == NULL)
+		return (XN_STATUS_ALLOC_FAILED);
 
-		// zero it
-		xnOSMemSet(pNew, 0, nAllocSize);
-	}
+	// zero it
+	xnOSMemSet(pNew, 0, nAllocSize);
 
 	// free the buffer if it is allocated
-	if (pStreamOutput->pData != NULL)
-	{
-		XN_ALIGNED_FREE_AND_NULL(pStreamOutput->pData);
-	}
+	XN_ALIGNED_FREE_AND_NULL(pStreamOutput->pData);
 
 	// and now set new buffer
 	pStreamOutput->pData = pNew;
 
 	// and size
 	pStreamOutput->pInternal->nAllocSize = nAllocSize;
-	pStreamOutput->pInternal->bAllocated = (nAllocSize > 0);
+
+	pStreamOutput->pInternal->bAllocated = TRUE;
 
 	return XN_STATUS_OK;
 }
diff --git a/Source/XnDDK/XnStreamDataSet.cpp b/Source/XnDDK/XnStreamDataSet.cpp
index 13ce053..acd6960 100644
--- a/Source/XnDDK/XnStreamDataSet.cpp
+++ b/Source/XnDDK/XnStreamDataSet.cpp
@@ -56,9 +56,9 @@ XN_DDK_API XnStatus XnStreamDataSetDestroy(XnStreamDataSet** ppStreamOutputSet)
 	XnStreamDataSet* pSet = (*ppStreamOutputSet);
 	if (pSet != NULL)
 	{
-		for (XnStreamDataHash::Iterator it = pSet->pHash->Begin(); it != pSet->pHash->End(); ++it)
+		for (XnStreamDataHash::Iterator it = pSet->pHash->begin(); it != pSet->pHash->end(); ++it)
 		{
-			XnStreamData* pStreamData = it->Value();
+			XnStreamData* pStreamData = it.Value();
 			XnStreamDataDestroy(&pStreamData);
 		}
 
@@ -78,7 +78,7 @@ XN_DDK_API XnStatus XnStreamDataSetAdd(XnStreamDataSet* pStreamOutputSet, XnStre
 	XN_VALIDATE_INPUT_PTR(pStreamOutput);
 
 	// make sure another object of this stream is not already in set
-	XnStreamDataHash::Iterator it = pStreamOutputSet->pHash->End();
+	XnStreamDataHash::Iterator it = pStreamOutputSet->pHash->end();
 	if (XN_STATUS_NO_MATCH != pStreamOutputSet->pHash->Find(pStreamOutput->StreamName, it))
 		return XN_STATUS_STREAM_OUTPUT_SET_ALREADY_IN_SET;
 
@@ -90,9 +90,9 @@ XN_DDK_API XnStatus XnStreamDataSetRemove(XnStreamDataSet* pStreamOutputSet, XnS
 	XN_VALIDATE_INPUT_PTR(pStreamOutputSet);
 	XN_VALIDATE_INPUT_PTR(pStreamOutput);
 
-	for (XnStreamDataHash::Iterator it = pStreamOutputSet->pHash->Begin(); it != pStreamOutputSet->pHash->End(); ++it)
+	for (XnStreamDataHash::Iterator it = pStreamOutputSet->pHash->begin(); it != pStreamOutputSet->pHash->end(); ++it)
 	{
-		if (pStreamOutput == it->Value())
+		if (pStreamOutput == it.Value())
 		{
 			pStreamOutputSet->pHash->Remove(it);
 			break;
@@ -145,9 +145,9 @@ XN_DDK_API XnStatus XnStreamDataSetCopyToArray(const XnStreamDataSet* pStreamOut
 
 	// now copy
 	XnUInt32 nIndex = 0;
-	for (XnStreamDataHash::Iterator it = pStreamOutputSet->pHash->Begin(); it != pStreamOutputSet->pHash->End(); ++it)
+	for (XnStreamDataHash::Iterator it = pStreamOutputSet->pHash->begin(); it != pStreamOutputSet->pHash->end(); ++it)
 	{
-		apStreamOutputs[nIndex] = it->Value();
+		apStreamOutputs[nIndex] = it.Value();
 		nIndex++;
 	}
 
diff --git a/Source/XnDDK/XnStreamDataSetInternal.h b/Source/XnDDK/XnStreamDataSetInternal.h
index 60a8025..ce22673 100644
--- a/Source/XnDDK/XnStreamDataSetInternal.h
+++ b/Source/XnDDK/XnStreamDataSetInternal.h
@@ -23,12 +23,12 @@
 #define __XN_STREAM_DATA_SET_INTERNAL_H__
 
 #include "XnStreamDataSet.h"
-#include <XnStringsHashT.h>
+#include <XnStringsHash.h>
 
 //---------------------------------------------------------------------------
 // Types
 //---------------------------------------------------------------------------
-typedef XnStringsHashT<XnStreamData*> XnStreamDataHash;
+XN_DECLARE_STRINGS_HASH(XnStreamData*, XnStreamDataHash)
 
 struct XnStreamDataSet
 {
diff --git a/Source/XnDDK/XnStreamDevice.h b/Source/XnDDK/XnStreamDevice.h
index 2dbb9a7..7680da4 100644
--- a/Source/XnDDK/XnStreamDevice.h
+++ b/Source/XnDDK/XnStreamDevice.h
@@ -57,8 +57,6 @@ protected:
 	virtual void DestroyIOStreamImpl(XnIOStream* pStream) = 0;
 
 private:
-	XN_DISABLE_COPY_AND_ASSIGN(XnStreamDevice);
-
 	XnIOStream* m_pIOStream;
 	XnDataPacker* m_pDataPacker;
 	XnUInt32 m_nInternalBufferSize;
diff --git a/Source/XnDDK/XnStreamDeviceStreamHolder.cpp b/Source/XnDDK/XnStreamDeviceStreamHolder.cpp
index 4cdd76d..5e070a5 100644
--- a/Source/XnDDK/XnStreamDeviceStreamHolder.cpp
+++ b/Source/XnDDK/XnStreamDeviceStreamHolder.cpp
@@ -56,8 +56,7 @@ XnStatus XnStreamDeviceStreamHolder::Init(const XnActualPropertiesHash* pProps)
 	nRetVal = m_CodecProperties.Set(&m_Compression, &m_Compression);
 	XN_IS_STATUS_OK(nRetVal);
 
-	XnCallbackHandle hDummy;
-	nRetVal = m_Compression.OnChangeEvent().Register(CodecPropertyChangedCallback, this, hDummy);
+	nRetVal = m_Compression.OnChangeEvent().Register(CodecPropertyChangedCallback, this, NULL);
 	XN_IS_STATUS_OK(nRetVal);
 
 	nRetVal = ChooseCodec();
@@ -192,33 +191,24 @@ XnStatus XnStreamDeviceStreamHolder::ChooseCodec()
 	}
 
 	// register to new props
-	for (XnPropertiesList::Iterator it = CodecProps.Begin(); it != CodecProps.End(); ++it)
+	for (XnPropertiesList::Iterator it = CodecProps.begin(); it != CodecProps.end(); ++it)
 	{
 		XnProperty* pProp = *it;
 
-		XnPropertiesHash::Iterator hashIt = m_CodecProperties.End();
+		XnPropertiesHash::Iterator hashIt = m_CodecProperties.end();
 		nRetVal = m_CodecProperties.Find(pProp, hashIt);
 		if (nRetVal == XN_STATUS_NO_MATCH)
 		{
 			XnCallbackHandle hCallbackDummy;
-			nRetVal = pProp->OnChangeEvent().Register(CodecPropertyChangedCallback, this, hCallbackDummy);
-			if (nRetVal != XN_STATUS_OK)
-			{
-				XN_DELETE(pCodec);
-				return (nRetVal);
-			}
+			nRetVal = pProp->OnChangeEvent().Register(CodecPropertyChangedCallback, this, &hCallbackDummy);
+			XN_IS_STATUS_OK(nRetVal);
 
 			nRetVal = m_CodecProperties.Set(pProp, NULL);
-			if (nRetVal != XN_STATUS_OK)
-			{
-				XN_DELETE(pCodec);
-				return (nRetVal);
-			}
+			XN_IS_STATUS_OK(nRetVal);
 		}
-		else if (nRetVal != XN_STATUS_OK)
+		else
 		{
-			XN_DELETE(pCodec);
-			return (nRetVal);
+			XN_IS_STATUS_OK(nRetVal);
 		}
 	}
 
diff --git a/Source/XnDDK/XnStreamDeviceStreamHolder.h b/Source/XnDDK/XnStreamDeviceStreamHolder.h
index 2e8bd4f..56e6ada 100644
--- a/Source/XnDDK/XnStreamDeviceStreamHolder.h
+++ b/Source/XnDDK/XnStreamDeviceStreamHolder.h
@@ -27,7 +27,7 @@
 //---------------------------------------------------------------------------
 #include "XnDeviceModuleHolder.h"
 #include "XnDeviceStream.h"
-#include <XnHashT.h>
+#include <XnHash.h>
 #include <XnFormats/XnCodec.h>
 
 //---------------------------------------------------------------------------
@@ -58,7 +58,7 @@ private:
 	XnActualIntProperty m_Compression;
 	XnCodec* m_pCodec;
 
-	typedef XnHashT<XnProperty*, XnValue> XnPropertiesHash;
+	XN_DECLARE_DEFAULT_HASH(XnProperty*, XnValue, XnPropertiesHash)
 	XnPropertiesHash m_CodecProperties;
 };
 
diff --git a/Source/XnDDK/XnStreamReaderDevice.cpp b/Source/XnDDK/XnStreamReaderDevice.cpp
index 12ab221..cc5e37b 100644
--- a/Source/XnDDK/XnStreamReaderDevice.cpp
+++ b/Source/XnDDK/XnStreamReaderDevice.cpp
@@ -119,31 +119,31 @@ XnStatus XnStreamReaderDevice::SetInitialState(const XnDeviceConfig* pDeviceConf
 
 	// now create the rest of the modules and streams (DEVICE was already created)
 	XnPropertySetData* pPropSetData = pSet->pData;
-	for (XnPropertySetData::ConstIterator it = pPropSetData->Begin(); it != pPropSetData->End(); ++it)
+	for (XnPropertySetData::ConstIterator it = pPropSetData->begin(); it != pPropSetData->end(); ++it)
 	{
 		// ignore module DEVICE
-		if (strcmp(XN_MODULE_NAME_DEVICE, it->Key()) == 0)
+		if (strcmp(XN_MODULE_NAME_DEVICE, it.Key()) == 0)
 		{
 			continue;
 		}
 
 		// check if this is a stream
-		XnActualPropertiesHash::ConstIterator itProp = it->Value()->End();
-		if (XN_STATUS_OK == it->Value()->Find(XN_STREAM_PROPERTY_TYPE, itProp))
+		XnActualPropertiesHash::ConstIterator itProp = it.Value()->end();
+		if (XN_STATUS_OK == it.Value()->Find(XN_STREAM_PROPERTY_TYPE, itProp))
 		{
-			XnActualStringProperty* pTypeProp = (XnActualStringProperty*)itProp->Value();
-			nRetVal = HandleNewStream(pTypeProp->GetValue(), it->Key(), it->Value());
+			XnActualStringProperty* pTypeProp = (XnActualStringProperty*)itProp.Value();
+			nRetVal = HandleNewStream(pTypeProp->GetValue(), it.Key(), it.Value());
 			XN_IS_STATUS_OK(nRetVal);
 		}
 		else
 		{
 			// this is module. create it
 			XnDeviceModuleHolder* pHolder = NULL;
-			nRetVal = CreateModule(it->Key(), &pHolder);
+			nRetVal = CreateModule(it.Key(), &pHolder);
 			XN_IS_STATUS_OK(nRetVal);
 
 			// set its props
-			nRetVal = pHolder->Init(it->Value());
+			nRetVal = pHolder->Init(it.Value());
 			if (nRetVal != XN_STATUS_OK)
 			{
 				DestroyModule(pHolder);
@@ -274,7 +274,7 @@ XnStatus XnStreamReaderDevice::ReadNewStream()
 	if (nRetVal == XN_STATUS_OK)
 	{
 		// create it
-		nRetVal = HandleNewStream(strType, strName, pPropertySet->pData->Begin()->Value());
+		nRetVal = HandleNewStream(strType, strName, pPropertySet->pData->begin().Value());
 	}
 
 	XnPropertySetDestroy(&pPropertySet);
diff --git a/Source/XnDDK/XnStreamReaderStream.cpp b/Source/XnDDK/XnStreamReaderStream.cpp
index f29f6d1..60297a9 100644
--- a/Source/XnDDK/XnStreamReaderStream.cpp
+++ b/Source/XnDDK/XnStreamReaderStream.cpp
@@ -47,8 +47,7 @@ XnStatus XnStreamReaderStream::Init()
 	XN_IS_STATUS_OK(nRetVal);
 
 	// register for size change (so we can realloc stream data)
-	XnCallbackHandle hCallback;
-	nRetVal = RequiredSizeProperty().OnChangeEvent().Register(RequiredSizeChangedCallback, this, hCallback);
+	nRetVal = RequiredSizeProperty().OnChangeEvent().Register(RequiredSizeChangedCallback, this);
 	XN_IS_STATUS_OK(nRetVal);
 
 	// and create stream data
diff --git a/Source/XnDeviceFile/XnDeviceFileReader.cpp b/Source/XnDeviceFile/XnDeviceFileReader.cpp
index f399100..7139912 100644
--- a/Source/XnDeviceFile/XnDeviceFileReader.cpp
+++ b/Source/XnDeviceFile/XnDeviceFileReader.cpp
@@ -38,7 +38,7 @@ typedef struct XnLastStreamData
 	XnUInt64 nTimestamp;
 } XnLastStreamData;
 
-typedef XnStringsHashT<XnLastStreamData> XnLastStreamDataHash;
+XN_DECLARE_STRINGS_HASH(XnLastStreamData, XnLastStreamDataHash);
 
 //---------------------------------------------------------------------------
 // Code
@@ -71,8 +71,7 @@ XnStatus XnDeviceFileReader::InitImpl(const XnDeviceConfig* pDeviceConfig)
 	XN_IS_STATUS_OK(nRetVal);
 
 	// register to events
-	XnCallbackHandle hDummy = NULL;
-	nRetVal = OnStreamCollectionChangedEvent().Register(StreamCollectionChangedCallback, this, hDummy);
+	nRetVal = OnStreamCollectionChangedEvent().Register(StreamCollectionChangedCallback, this);
 	XN_IS_STATUS_OK(nRetVal);
 
 	// TODO: remove this
@@ -219,11 +218,11 @@ XnStatus XnDeviceFileReader::ReadInitialState(XnPropertySet *pSet)
 				nRetVal = GetDataPacker()->ReadProperty(strModule, strProp, &nValue);
 				XN_IS_STATUS_OK(nRetVal);
 
-				XnActualPropertiesHash* pModule = NULL;
+				XnActualPropertiesHash* pModule;
 				nRetVal = pSet->pData->Get(strModule, pModule);
 				XN_IS_STATUS_OK(nRetVal);
 
-				XnProperty* pProp = NULL;
+				XnProperty* pProp;
 				nRetVal = pModule->Get(strProp, pProp);
 				XN_IS_STATUS_OK(nRetVal);
 
@@ -314,8 +313,8 @@ XnStatus XnDeviceFileReader::HandleStreamRemoved(const XnChar* strName)
 	
 	// check for specific case: all streams are removed and then end-of-file is reached.
 	// in this case, we don't really want to destroy streams, just wrap around.
-	XnStringsSet StreamsToRemove;
-	nRetVal = StreamsToRemove.Set(strName);
+	XnStringsHash StreamsToRemove;
+	nRetVal = StreamsToRemove.Set(strName, NULL);
 	XN_IS_STATUS_OK(nRetVal);
 
 	XnPackedDataType nType = XN_PACKED_STREAM_REMOVED;
@@ -335,7 +334,7 @@ XnStatus XnDeviceFileReader::HandleStreamRemoved(const XnChar* strName)
 			nRetVal = GetDataPacker()->ReadStreamRemoved(strTempName);
 			XN_IS_STATUS_OK(nRetVal);
 
-			nRetVal = StreamsToRemove.Set(strTempName);
+			nRetVal = StreamsToRemove.Set(strTempName, NULL);
 			XN_IS_STATUS_OK(nRetVal);
 		}
 		else
@@ -347,9 +346,9 @@ XnStatus XnDeviceFileReader::HandleStreamRemoved(const XnChar* strName)
 	if (nType != XN_PACKED_END)
 	{
 		// Not the case we were looking for. Remove those streams.
-		for (XnStringsSet::Iterator it = StreamsToRemove.Begin(); it != StreamsToRemove.End(); ++it)
+		for (XnStringsHash::Iterator it = StreamsToRemove.begin(); it != StreamsToRemove.end(); ++it)
 		{
-			nRetVal = XnStreamReaderDevice::HandleStreamRemoved(it->Key());
+			nRetVal = XnStreamReaderDevice::HandleStreamRemoved(it.Key());
 			XN_IS_STATUS_OK(nRetVal);
 		}
 	}
@@ -391,7 +390,7 @@ XnStatus XnDeviceFileReader::HandleStreamData(XnStreamData* pDataProps, XnCompre
 	nRetVal = GetIOStream()->Tell(&nPosition);
 	XN_IS_STATUS_OK(nRetVal);
 
-	XnUIntHash::Iterator it = m_PositionsToIgnore.End();
+	XnUIntHash::Iterator it = m_PositionsToIgnore.end();
 	if (XN_STATUS_OK == m_PositionsToIgnore.Find(nPosition, it))
 	{
 		// ignore this one. Just update the frame ID
@@ -434,7 +433,7 @@ XnStatus XnDeviceFileReader::Rewind()
 	nRetVal = GetStreamsList(streams);
 	XN_IS_STATUS_OK(nRetVal);
 
-	for (XnDeviceModuleHolderList::Iterator it = streams.Begin(); it != streams.End(); ++it)
+	for (XnDeviceModuleHolderList::Iterator it = streams.begin(); it != streams.end(); ++it)
 	{
 		XnDeviceModuleHolder* pHolder = *it;
 
@@ -460,10 +459,10 @@ XnStatus XnDeviceFileReader::Rewind()
 	}
 
 	// now set state.
-	for (XnPropertySetData::Iterator it = state.pData->Begin(); it != state.pData->End(); ++it)
+	for (XnPropertySetData::Iterator it = state.pData->begin(); it != state.pData->end(); ++it)
 	{
-		const XnChar* strName = it->Key();
-		XnActualPropertiesHash* pHash = it->Value();
+		const XnChar* strName = it.Key();
+		XnActualPropertiesHash* pHash = it.Value();
 
 		// fix it first
 		if (strcmp(strName, XN_MODULE_NAME_DEVICE) == 0)
@@ -740,7 +739,7 @@ XnStatus XnDeviceFileReader::SeekTo(XnUInt64 nMinTimestamp, XnUInt32 nMinFrameID
 		nRetVal = GetStreamsList(streams);
 		XN_IS_STATUS_OK(nRetVal);
 
-		for (XnDeviceModuleHolderList::Iterator it = streams.Begin(); it != streams.End(); ++it)
+		for (XnDeviceModuleHolderList::Iterator it = streams.begin(); it != streams.end(); ++it)
 		{
 			XnStreamReaderStream* pStream = (XnStreamReaderStream*)(*it)->GetModule();
 			pStream->ReMarkDataAsNew();
@@ -793,10 +792,10 @@ XnStatus XnDeviceFileReader::OnStreamCollectionChanged(const XnChar* /*StreamNam
 	return XN_STATUS_OK;
 }
 
-void XnDeviceFileReader::StreamCollectionChangedCallback(const XnStreamCollectionChangedEventArgs& args, void* pCookie)
+void XnDeviceFileReader::StreamCollectionChangedCallback(XnDeviceHandle /*DeviceHandle*/, const XnChar* StreamName, XnStreamsChangeEventType EventType, void* pCookie)
 {
 	XnDeviceFileReader* pThis = (XnDeviceFileReader*)pCookie;
-	pThis->OnStreamCollectionChanged(args.strStreamName, args.eventType);
+	pThis->OnStreamCollectionChanged(StreamName, EventType);
 }
 
 XnStatus XnDeviceFileReader::ReadNextData()
diff --git a/Source/XnDeviceFile/XnDeviceFileReader.h b/Source/XnDeviceFile/XnDeviceFileReader.h
index 82dbd2c..4163957 100644
--- a/Source/XnDeviceFile/XnDeviceFileReader.h
+++ b/Source/XnDeviceFile/XnDeviceFileReader.h
@@ -28,7 +28,7 @@
 #include "XnDeviceFile.h"
 #include <XnDDK/XnStreamReaderDevice.h>
 #include <XnIOFileStream.h>
-#include <XnHashT.h>
+#include <XnHash.h>
 
 #define XN_FILE_PROPERTY_INSTANCE_POINTER	"InstancePointer"
 
@@ -36,7 +36,7 @@
 // Types
 //---------------------------------------------------------------------------
 struct XnFileBCData;
-typedef XnHashT<XnUInt64, XnValue> XnUIntHash;
+XN_DECLARE_DEFAULT_HASH(XnUInt64, XnValue, XnUIntHash);
 
 class XnDeviceFileReader : public XnStreamReaderDevice
 {
@@ -77,7 +77,7 @@ private:
 
 	XnStatus OnStreamCollectionChanged(const XnChar* StreamName, XnStreamsChangeEventType EventType);
 
-	static void XN_CALLBACK_TYPE StreamCollectionChangedCallback(const XnStreamCollectionChangedEventArgs& args, void* pCookie);
+	static void XN_CALLBACK_TYPE StreamCollectionChangedCallback(XnDeviceHandle DeviceHandle, const XnChar* StreamName, XnStreamsChangeEventType EventType, void* pCookie);
 	static XnStatus XN_CALLBACK_TYPE GetInstanceCallback(const XnGeneralProperty* pSender, const XnGeneralBuffer& gbValue, void* pCookie);
 
 	// Some BC functions
diff --git a/Source/XnDeviceFile/XnDeviceFileReaderBC.cpp b/Source/XnDeviceFile/XnDeviceFileReaderBC.cpp
index 2837d22..9075416 100644
--- a/Source/XnDeviceFile/XnDeviceFileReaderBC.cpp
+++ b/Source/XnDeviceFile/XnDeviceFileReaderBC.cpp
@@ -932,7 +932,7 @@ XnStatus XnDeviceFileReader::BCSeekFrame(XnUInt32 nFrameID)
 		XN_IS_STATUS_OK(nRetVal);
 
 		// increment streams frame ID
-		for (XnDeviceModuleHolderList::Iterator it = streams.Begin(); it != streams.End(); ++it)
+		for (XnDeviceModuleHolderList::Iterator it = streams.begin(); it != streams.end(); ++it)
 		{
 			XnStreamReaderStream* pStream = (XnStreamReaderStream*)(*it)->GetModule();
 			pStream->NewDataAvailable(0, 0);
diff --git a/Source/XnDeviceFile/XnExportedFileDevice.cpp b/Source/XnDeviceFile/XnExportedFileDevice.cpp
index 47123e1..2ecf9e6 100644
--- a/Source/XnDeviceFile/XnExportedFileDevice.cpp
+++ b/Source/XnDeviceFile/XnExportedFileDevice.cpp
@@ -27,7 +27,7 @@
 #include "XnDeviceFileReader.h"
 #include "XnFileDevice.h"
 #include <XnOpenNI.h>
-#include <XnCommon.h>
+#include <XnCommon/XnCommon.h>
 
 //---------------------------------------------------------------------------
 // XnExportedFileDevice class
@@ -74,7 +74,6 @@ XnStatus XnExportedFileDevice::Create(xn::Context& context, const XnChar* strIns
 	nRetVal = pDevice->Init();
 	if (nRetVal != XN_STATUS_OK)
 	{
-		XN_DELETE(pDevice);
 		return (nRetVal);
 	}
 
diff --git a/Source/XnDeviceFile/XnFileDevice.cpp b/Source/XnDeviceFile/XnFileDevice.cpp
index 262548a..4957e79 100644
--- a/Source/XnDeviceFile/XnFileDevice.cpp
+++ b/Source/XnDeviceFile/XnFileDevice.cpp
@@ -45,7 +45,7 @@ typedef struct XnLastStreamData
 	XnUInt64 nTimestamp;
 } XnLastStreamData;
 
-typedef XnStringsHashT<XnLastStreamData> XnLastStreamDataHash;
+XN_DECLARE_STRINGS_HASH(XnLastStreamData, XnLastStreamDataHash);
 
 //---------------------------------------------------------------------------
 // XnFileDevice class
@@ -87,9 +87,9 @@ XnStatus XnFileDevice::Init()
 
 void XnFileDevice::Free()
 {
-	for (XnNodeInfoMap::Iterator it = m_nodeInfoMap.Begin(); it != m_nodeInfoMap.End(); ++it)
+	for (XnNodeInfoMap::Iterator it = m_nodeInfoMap.begin(); it != m_nodeInfoMap.end(); ++it)
 	{
-		XnNodeInfo& nodeInfo = it->Value();
+		XnNodeInfo& nodeInfo = it.Value();
 		XN_DELETE(nodeInfo.pXnCodec);
 		if (nodeInfo.codec.IsValid())
 		{
@@ -201,7 +201,7 @@ XnStatus XnFileDevice::SetInitialState(XnPropertySet* pSet)
 		pDeviceModule->Remove(XN_MODULE_PROPERTY_PRIMARY_STREAM);
 
 		// check for timestamps resolution
-		XnActualIntProperty* pIntProp = NULL;
+		XnActualIntProperty* pIntProp;
 		if (XN_STATUS_OK == pDeviceModule->Get(XN_MODULE_PROPERTY_HIGH_RES_TIMESTAMPS, (XnProperty*&)pIntProp))
 		{
 			m_bHighresTimestamps = (pIntProp->GetValue() == TRUE);
@@ -212,20 +212,20 @@ XnStatus XnFileDevice::SetInitialState(XnPropertySet* pSet)
 
 	// now create the rest of the modules and streams (DEVICE was already created)
 	XnPropertySetData* pPropSetData = pSet->pData;
-	for (XnPropertySetData::ConstIterator it = pPropSetData->Begin(); it != pPropSetData->End(); ++it)
+	for (XnPropertySetData::ConstIterator it = pPropSetData->begin(); it != pPropSetData->end(); ++it)
 	{
 		// ignore module DEVICE
-		if (strcmp(XN_MODULE_NAME_DEVICE, it->Key()) == 0)
+		if (strcmp(XN_MODULE_NAME_DEVICE, it.Key()) == 0)
 		{
 			continue;
 		}
 
 		// check if this is a stream
-		XnActualPropertiesHash::ConstIterator itProp = it->Value()->End();
-		if (XN_STATUS_OK == it->Value()->Find(XN_STREAM_PROPERTY_TYPE, itProp))
+		XnActualPropertiesHash::ConstIterator itProp = it.Value()->end();
+		if (XN_STATUS_OK == it.Value()->Find(XN_STREAM_PROPERTY_TYPE, itProp))
 		{
-			XnActualStringProperty* pTypeProp = (XnActualStringProperty*)itProp->Value();
-			nRetVal = HandleNewStream(pTypeProp->GetValue(), it->Key(), it->Value());
+			XnActualStringProperty* pTypeProp = (XnActualStringProperty*)itProp.Value();
+			nRetVal = HandleNewStream(pTypeProp->GetValue(), it.Key(), it.Value());
 			XN_IS_STATUS_OK(nRetVal);
 		}
 	} // modules loop
@@ -360,7 +360,7 @@ XnStatus XnFileDevice::SeekTo(XnUInt64 nMinTimestamp, const XnChar* strNodeName,
 			XnLastStreamData data;
 			if (XN_STATUS_OK != StreamsHash.Get(props.StreamName, data))
 			{
-				XnNodeInfo* pNodeInfo = NULL;
+				XnNodeInfo* pNodeInfo;
 				nRetVal = m_nodeInfoMap.Get(props.StreamName, pNodeInfo);
 				XN_IS_STATUS_OK(nRetVal);
 
@@ -430,7 +430,7 @@ XnStatus XnFileDevice::SeekTo(XnUInt64 nMinTimestamp, const XnChar* strNodeName,
 		nRetVal = GetStreamsList(streams);
 		XN_IS_STATUS_OK(nRetVal);
 
-		for (XnDeviceModuleHolderList::Iterator it = streams.Begin(); it != streams.End(); ++it)
+		for (XnDeviceModuleHolderList::Iterator it = streams.begin(); it != streams.end(); ++it)
 		{
 			XnStreamReaderStream* pStream = (XnStreamReaderStream*)(*it)->GetModule();
 			pStream->ReMarkDataAsNew();
@@ -473,7 +473,7 @@ XnStatus XnFileDevice::SeekToFrame(const XnChar* strNodeName, XnInt32 nFrameOffs
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 	
-	XnNodeInfo* pNodeInfo = NULL;
+	XnNodeInfo* pNodeInfo;
 	nRetVal = m_nodeInfoMap.Get(strNodeName, pNodeInfo);
 	XN_IS_STATUS_OK(nRetVal);
 
@@ -521,7 +521,7 @@ XnStatus XnFileDevice::TellFrame(const XnChar* strNodeName, XnUInt32 &nFrameOffs
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 	
-	XnNodeInfo* pNodeInfo = NULL;
+	XnNodeInfo* pNodeInfo;
 	nRetVal = m_nodeInfoMap.Get(strNodeName, pNodeInfo);
 	XN_IS_STATUS_OK(nRetVal);
 
@@ -552,7 +552,7 @@ XnBool XnFileDevice::IsEOF()
 
 XnStatus XnFileDevice::RegisterToEndOfFileReached(XnModuleStateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback)
 {
-	return m_eofEvent.Register(handler, pCookie, hCallback);
+	return m_eofEvent.Register(handler, pCookie, &hCallback);
 }
 
 void XnFileDevice::UnregisterFromEndOfFileReached(XnCallbackHandle hCallback)
@@ -634,7 +634,7 @@ XnStatus XnFileDevice::ReadNewStream()
 	if (nRetVal == XN_STATUS_OK)
 	{
 		// create it
-		nRetVal = HandleNewStream(strType, strName, pPropertySet->pData->Begin()->Value());
+		nRetVal = HandleNewStream(strType, strName, pPropertySet->pData->begin().Value());
 	}
 
 	XnPropertySetDestroy(&pPropertySet);
@@ -672,7 +672,7 @@ XnStatus XnFileDevice::HandleNewStream(const XnChar *strType, const XnChar *strN
 	XnStatus nRetVal = XN_STATUS_OK;
 
 	// check if we need to ignore that (stream was not removed upon Rewind).
-	XnNodeInfoMap::Iterator it = m_ignoreNewNodes.End();
+	XnNodeInfoMap::Iterator it = m_ignoreNewNodes.end();
 	if (m_ignoreNewNodes.Find(strName, it) == XN_STATUS_OK)
 	{
 		// ignore
@@ -709,9 +709,9 @@ XnStatus XnFileDevice::HandleNewStream(const XnChar *strType, const XnChar *strN
 	XN_IS_STATUS_OK(nRetVal);
 
 	// now write state
-	for (XnActualPropertiesHash::ConstIterator it = pInitialValues->Begin(); it != pInitialValues->End(); ++it)
+	for (XnActualPropertiesHash::ConstIterator it = pInitialValues->begin(); it != pInitialValues->end(); ++it)
 	{
-		XnProperty* pProp = it->Value();
+		XnProperty* pProp = it.Value();
 
 		switch (pProp->GetType())
 		{
@@ -881,8 +881,8 @@ XnStatus XnFileDevice::HandleStreamRemoved(const XnChar* strName)
 
 	// check for specific case: all streams are removed and then end-of-file is reached.
 	// in this case, we don't really want to destroy streams, just wrap around.
-	XnStringsSet StreamsToRemove;
-	nRetVal = StreamsToRemove.Set(strName);
+	XnStringsHash StreamsToRemove;
+	nRetVal = StreamsToRemove.Set(strName, NULL);
 	XN_IS_STATUS_OK(nRetVal);
 
 	XnPackedDataType nType = XN_PACKED_STREAM_REMOVED;
@@ -902,7 +902,7 @@ XnStatus XnFileDevice::HandleStreamRemoved(const XnChar* strName)
 			nRetVal = m_pDataPacker->ReadStreamRemoved(strTempName);
 			XN_IS_STATUS_OK(nRetVal);
 
-			nRetVal = StreamsToRemove.Set(strTempName);
+			nRetVal = StreamsToRemove.Set(strTempName, NULL);
 			XN_IS_STATUS_OK(nRetVal);
 		}
 		else
@@ -914,16 +914,16 @@ XnStatus XnFileDevice::HandleStreamRemoved(const XnChar* strName)
 	if (nType != XN_PACKED_END)
 	{
 		// Not the case we were looking for. Remove those streams.
-		for (XnStringsSet::Iterator it = StreamsToRemove.Begin(); it != StreamsToRemove.End(); ++it)
+		for (XnStringsHash::Iterator it = StreamsToRemove.begin(); it != StreamsToRemove.end(); ++it)
 		{
-			nRetVal = m_pNotifications->OnNodeRemoved(m_pNotificationsCookie, it->Key());
+			nRetVal = m_pNotifications->OnNodeRemoved(m_pNotificationsCookie, it.Key());
 			XN_IS_STATUS_OK(nRetVal);
 
-			XnNodeInfo* pNodeInfo = NULL;
-			m_nodeInfoMap.Get(it->Key(), pNodeInfo);
+			XnNodeInfo* pNodeInfo;
+			m_nodeInfoMap.Get(it.Key(), pNodeInfo);
 			XN_DELETE(pNodeInfo->pXnCodec);
-			m_nodeInfoMap.Remove(it->Key());
-			m_ignoreNewNodes.Remove(it->Key());
+			m_nodeInfoMap.Remove(it.Key());
+			m_ignoreNewNodes.Remove(it.Key());
 		}
 
 		m_bNodeCollectionChanged = TRUE;
@@ -1115,7 +1115,7 @@ XnStatus XnFileDevice::HandleIntProperty(const XnChar *strModule, const XnChar *
 	{
 		// only after node is ready
 		xn::DepthGenerator depth(node);
-		XnNodeInfo* pNodeInfo = NULL;
+		XnNodeInfo* pNodeInfo;
 		if (m_nodeInfoMap.Get(strModule, pNodeInfo) == XN_STATUS_OK &&
 			m_context.GetProductionNodeByName(strModule, depth) == XN_STATUS_OK)
 		{
@@ -1169,7 +1169,7 @@ XnStatus XnFileDevice::HandleRealProperty(const XnChar *strModule, const XnChar
 	nRetVal = m_pNotifications->OnNodeRealPropChanged(m_pNotificationsCookie, strModule, strName, dValue);
 	XN_IS_STATUS_OK(nRetVal);
 
-	XnNodeInfo* pNodeInfo = NULL;
+	XnNodeInfo* pNodeInfo;
 
 	if (strcmp(strName, XN_STREAM_PROPERTY_ZERO_PLANE_PIXEL_SIZE) == 0 ||
 		strcmp(strName, XN_STREAM_PROPERTY_EMITTER_DCMOS_DISTANCE) == 0)
@@ -1303,11 +1303,11 @@ XnStatus XnFileDevice::HandleStreamData(XnStreamData* pDataProps, XnCompressionF
 	nRetVal = m_pInputStream->Tell(&nPosition);
 	XN_IS_STATUS_OK(nRetVal);
 
-	XnUIntHash::Iterator it = m_PositionsToIgnore.End();
+	XnUIntHash::Iterator it = m_PositionsToIgnore.end();
 	if (XN_STATUS_OK == m_PositionsToIgnore.Find(nPosition, it))
 	{
 		// ignore this one. Just update the frame ID
-		XnNodeInfo* pNodeInfo = NULL;
+		XnNodeInfo* pNodeInfo;
 		nRetVal = m_nodeInfoMap.Get(pDataProps->StreamName, pNodeInfo);
 		XN_IS_STATUS_OK(nRetVal);
 
@@ -1449,9 +1449,9 @@ XnStatus XnFileDevice::Rewind()
 	XN_IS_STATUS_OK(nRetVal);
 
 	// first handle current streams. remove or reset them
-	for (XnNodeInfoMap::Iterator it = m_nodeInfoMap.Begin(); it != m_nodeInfoMap.End(); ++it)
+	for (XnNodeInfoMap::Iterator it = m_nodeInfoMap.begin(); it != m_nodeInfoMap.end(); ++it)
 	{
-		const XnChar* strName = it->Key();
+		const XnChar* strName = it.Key();
 
 		if (m_bNodeCollectionChanged)
 		{
@@ -1462,9 +1462,9 @@ XnStatus XnFileDevice::Rewind()
 		else
 		{
 			// just reset frame ID
-			it->Value().nCurrFrameID = 0;
+			it.Value().nCurrFrameID = 0;
 			// and mark not to recreate it
-			nRetVal = m_ignoreNewNodes.Set(strName, it->Value());
+			nRetVal = m_ignoreNewNodes.Set(strName, it.Value());
 			XN_IS_STATUS_OK(nRetVal);
 		}
 	}
diff --git a/Source/XnDeviceFile/XnFileDevice.h b/Source/XnDeviceFile/XnFileDevice.h
index 73dfbd6..55af718 100644
--- a/Source/XnDeviceFile/XnFileDevice.h
+++ b/Source/XnDeviceFile/XnFileDevice.h
@@ -28,14 +28,13 @@
 #include <XnModuleCppInterface.h>
 #include <XnDDK/XnDataPacker.h>
 #include <XnCppWrapper.h>
-#include <XnStringsHashT.h>
+#include <XnStringsHash.h>
 #include <XnFormats/XnNiCodec.h>
 #include <XnDDK/XnActualPropertiesHash.h>
 #include "XnDeviceFileReaderBC.h"
 #include "XnNiInputStream.h"
 #include "XnDeviceFile.h"
 #include <XnDDK/XnShiftToDepth.h>
-#include <XnEventT.h>
 
 //---------------------------------------------------------------------------
 // Types
@@ -122,7 +121,7 @@ private:
 		XnBool bIRisRGB;
 	} XnNodeInfo;
 
-	typedef XnStringsHashT<XnNodeInfo> XnNodeInfoMap;
+	XN_DECLARE_STRINGS_HASH(XnNodeInfo, XnNodeInfoMap);
 	XnNodeInfoMap m_nodeInfoMap;
 	XnNodeInfoMap m_ignoreNewNodes;
 
@@ -136,10 +135,11 @@ private:
 
 	XnUInt64 m_nCurrTimestamp;
 
-	typedef XnHashT<XnUInt32, XnValue> XnUIntHash;
+	XN_DECLARE_DEFAULT_HASH(XnUInt32, XnValue, XnUIntHash);
 	XnUIntHash m_PositionsToIgnore; // used for seeking
 
-	XnEventNoArgs m_eofEvent;
+	XN_DECLARE_EVENT_0ARG(XnEOFEvent, IXnEOFEvent);
+	XnEOFEvent m_eofEvent;
 	XnBool m_bEOF;
 
 	XnShiftToDepthTables m_ShiftToDepth;
diff --git a/Source/XnDeviceFile/XnFileDeviceBC.cpp b/Source/XnDeviceFile/XnFileDeviceBC.cpp
index d3fab15..2b41d29 100644
--- a/Source/XnDeviceFile/XnFileDeviceBC.cpp
+++ b/Source/XnDeviceFile/XnFileDeviceBC.cpp
@@ -417,9 +417,9 @@ XnStatus XnFileDevice::BCSeekFrame(XnUInt32 nFrameID)
 		XN_IS_STATUS_OK(nRetVal);
 
 		// increment streams frame ID
-		for (XnNodeInfoMap::Iterator it = m_nodeInfoMap.Begin(); it != m_nodeInfoMap.End(); ++it)
+		for (XnNodeInfoMap::Iterator it = m_nodeInfoMap.begin(); it != m_nodeInfoMap.end(); ++it)
 		{
-			it->Value().nCurrFrameID++;
+			it.Value().nCurrFrameID++;
 		}
 
 		// Make sure frame ids are sequential
diff --git a/Source/XnDeviceSensorV2/IXnSensorStream.h b/Source/XnDeviceSensorV2/IXnSensorStream.h
index 7aeebec..aaf28b6 100644
--- a/Source/XnDeviceSensorV2/IXnSensorStream.h
+++ b/Source/XnDeviceSensorV2/IXnSensorStream.h
@@ -27,6 +27,7 @@
 //---------------------------------------------------------------------------
 #include <XnStatus.h>
 #include <XnStreamParams.h>
+#include "XnSharedMemoryBufferPool.h"
 
 //---------------------------------------------------------------------------
 // Forward Declarations
@@ -47,6 +48,7 @@ public:
 	virtual XnStatus CloseStreamImpl() = 0;
 	virtual XnStatus CreateDataProcessor(XnDataProcessor** ppProcessor) = 0;
 	virtual XnStatus MapPropertiesToFirmware() = 0;
+	virtual XnSharedMemoryBufferPool* GetSharedMemoryBuffer() = 0;
 };
 
 #endif //__I_XN_SENSOR_STREAM_H__
diff --git a/Source/XnDeviceSensorV2/Registration.cpp b/Source/XnDeviceSensorV2/Registration.cpp
index f5ce7e9..4f85eee 100644
--- a/Source/XnDeviceSensorV2/Registration.cpp
+++ b/Source/XnDeviceSensorV2/Registration.cpp
@@ -222,6 +222,8 @@ void CreateDXDYTables (XnDouble* RegXTable, XnDouble* RegYTable,
 
 #define RGB_REG_X_RES 640
 #define RGB_REG_Y_RES 512
+#define XN_DEPTH_XRES 640
+#define XN_DEPTH_YRES 480
 #define XN_CMOS_VGAOUTPUT_XRES 1280
 #define XN_SENSOR_WIN_OFFET_X 1
 #define XN_SENSOR_WIN_OFFET_Y 1
@@ -229,9 +231,9 @@ void CreateDXDYTables (XnDouble* RegXTable, XnDouble* RegYTable,
 #define S2D_PEL_CONST 10
 #define S2D_CONST_OFFSET 0.375
 
-void XnRegistration::BuildDepthToShiftTable(XnUInt16* pDepth2Shift, XnSensorDepthStream* m_pStream)
+void BuildDepthToShiftTable(XnUInt16* pDepth2Shift, XnSensorDepthStream* m_pStream)
 {
-	XnUInt32 nXScale = XN_CMOS_VGAOUTPUT_XRES / m_pDepthStream->GetXRes();
+	XnUInt32 nXScale = XN_CMOS_VGAOUTPUT_XRES / XN_DEPTH_XRES;
 	XnInt16* pRGBRegDepthToShiftTable = (XnInt16*)pDepth2Shift; 
 	XnUInt32 nIndex = 0;
 	XnDouble dDepth = 0;
@@ -246,8 +248,10 @@ void XnRegistration::BuildDepthToShiftTable(XnUInt16* pDepth2Shift, XnSensorDept
 	m_pStream->GetProperty(XN_STREAM_PROPERTY_ZERO_PLANE_DISTANCE, &nPlaneDsr);
 	dPlaneDsr = (XnDouble)nPlaneDsr;
 
+	XnUInt64 nDCRCDist;
 	XnDouble dDCRCDist;
-	m_pStream->GetProperty(XN_STREAM_PROPERTY_DCMOS_RCMOS_DISTANCE, &dDCRCDist);
+	m_pStream->GetProperty(XN_STREAM_PROPERTY_DCMOS_RCMOS_DISTANCE, &nDCRCDist);
+	dDCRCDist = (XnDouble)nDCRCDist;
 
 	XnDouble dPelSize = 1.0 / (dPlanePixelSize * nXScale * S2D_PEL_CONST);
 	XnDouble dPelDCC = dDCRCDist * dPelSize * S2D_PEL_CONST;
@@ -271,6 +275,10 @@ XnStatus XnRegistration::BuildRegTable1080()
 	nRetVal = XnHostProtocolAlgorithmParams(m_pDevicePrivateData, XN_HOST_PROTOCOL_ALGORITHM_REGISTRATION, &RegData, sizeof(RegData), m_pDepthStream->GetResolution(), (XnUInt16)m_pDepthStream->GetFPS());
 	XN_IS_STATUS_OK(nRetVal);
 
+	xnOSMemSet(&m_padInfo, 0, sizeof(m_padInfo));
+	nRetVal = XnHostProtocolAlgorithmParams(m_pDevicePrivateData, XN_HOST_PROTOCOL_ALGORITHM_PADDING, &m_padInfo, sizeof(m_padInfo), m_pDepthStream->GetResolution(), (XnUInt16)m_pDepthStream->GetFPS());
+	XN_IS_STATUS_OK(nRetVal);
+
 	XN_VALIDATE_ALIGNED_CALLOC(m_pDepthToShiftTable, XnUInt16, m_pDepthStream->GetXRes()*m_pDepthStream->GetYRes(), XN_DEFAULT_MEM_ALIGN);
 	m_bD2SAlloc = TRUE;
 
@@ -279,8 +287,8 @@ XnStatus XnRegistration::BuildRegTable1080()
 	XnDouble* RegXTable = XN_NEW_ARR(XnDouble, RGB_REG_X_RES*RGB_REG_Y_RES);
 	XnDouble* RegYTable = XN_NEW_ARR(XnDouble, RGB_REG_X_RES*RGB_REG_Y_RES);
 
-	XnUInt16 nDepthXRes = m_pDepthStream->GetXRes();
-	XnUInt16 nDepthYRes = m_pDepthStream->GetYRes();
+	XnUInt16 nDepthXRes = XN_DEPTH_XRES;
+	XnUInt16 nDepthYRes = XN_DEPTH_YRES;
 	XnDouble* pRegXTable = (XnDouble*)RegXTable;
 	XnDouble* pRegYTable = (XnDouble*)RegYTable;
 	XnInt16* pRegTable = (XnInt16*)m_pRegistrationTable;
@@ -337,8 +345,8 @@ XnStatus XnRegistration::BuildRegTable1080()
 
 			if (nNewY > nDepthYRes-2)
 			{
-				nNewX = ((nDepthXRes*4) * RGB_REG_X_VAL_SCALE); // set illegal value on purpose
 				nNewY = nDepthYRes;
+				goto FinishLoop;
 			}
 
 			*pRegTable = (XnInt16)nNewX;
@@ -350,6 +358,10 @@ XnStatus XnRegistration::BuildRegTable1080()
 		}
 	}
 
+FinishLoop:
+	XN_DELETE_ARR(RegXTable);
+	XN_DELETE_ARR(RegYTable);
+	
 	return (XN_STATUS_OK);
 }
 
@@ -489,11 +501,14 @@ void XnRegistration::Apply1080(XnDepthPixel* pInput, XnDepthPixel* pOutput)
 	XnUInt32 nNewX = 0;
 	XnUInt32 nNewY = 0;
 	XnUInt32 nArrPos = 0;
-	XnUInt32 nDepthXRes = m_pDepthStream->GetXRes();
-	XnUInt32 nDepthYRes = m_pDepthStream->GetYRes();
+	XnUInt32 nDepthXRes = XN_DEPTH_XRES;
+	XnUInt32 nDepthYRes = XN_DEPTH_YRES;
 
 	memset(pOutput, XN_DEVICE_SENSOR_NO_DEPTH_VALUE, nDepthXRes*nDepthYRes*sizeof(XnDepthPixel));
 
+	// entire map should be shifted by X lines
+	XnUInt32 nConstOffset = nDepthXRes*m_padInfo.nStartLines;
+
 	XnBool bMirror = m_pDepthStream->IsMirrored();
 
 	for (XnUInt32 y = 0; y < nDepthYRes; ++y)
@@ -511,6 +526,7 @@ void XnRegistration::Apply1080(XnDepthPixel* pInput, XnDepthPixel* pOutput)
 				if (nNewX < nDepthXRes)
 				{
 					nArrPos = bMirror ? (nNewY+1)*nDepthXRes - nNewX : (nNewY*nDepthXRes) + nNewX;
+					nArrPos -= nConstOffset;
 					
 					nOutValue = pOutput[nArrPos];
 
diff --git a/Source/XnDeviceSensorV2/Registration.h b/Source/XnDeviceSensorV2/Registration.h
index a3ab18f..3a2f189 100644
--- a/Source/XnDeviceSensorV2/Registration.h
+++ b/Source/XnDeviceSensorV2/Registration.h
@@ -45,7 +45,6 @@ public:
 	inline XnBool IsInitialized() { return m_bInitialized; }
 
 private:
-	void BuildDepthToShiftTable(XnUInt16* pDepth2Shift, XnSensorDepthStream* m_pStream);
 	XnStatus BuildRegTable();
 	XnStatus BuildRegTable1000();
 	XnStatus BuildRegTable1080();
@@ -59,6 +58,7 @@ private:
 	XnUInt16* m_pDepthToShiftTable;
 	XnBool m_bD2SAlloc;
 	XnUInt16* m_pRegistrationTable;
+	XnRegistrationPaddingInformation m_padInfo;
 	XnDepthPixel* m_pTempBuffer;
 	XnDouble m_dShiftFactor;
 	XnBool m_b1000;
diff --git a/Source/XnDeviceSensorV2/XnAudioProcessor.cpp b/Source/XnDeviceSensorV2/XnAudioProcessor.cpp
index 90a1018..c720b25 100644
--- a/Source/XnDeviceSensorV2/XnAudioProcessor.cpp
+++ b/Source/XnDeviceSensorV2/XnAudioProcessor.cpp
@@ -28,11 +28,10 @@
 // Code
 //---------------------------------------------------------------------------
 
-XnAudioProcessor::XnAudioProcessor(XnSensorAudioStream* pStream, XnSensorStreamHelper* pHelper, XnDeviceAudioBuffer* pBuffer, XnUInt32 nInputPacketSize) :
+XnAudioProcessor::XnAudioProcessor(XnSensorAudioStream* pStream, XnSensorStreamHelper* pHelper, XnUInt32 nInputPacketSize) :
 	XnWholePacketProcessor(pHelper->GetPrivateData(), pStream->GetType(), nInputPacketSize),
 	m_pStream(pStream),
 	m_pHelper(pHelper),
-	m_pBuffer(pBuffer),
 	m_AudioInDump(NULL)
 {
 	m_AudioInDump = xnDumpFileOpen(XN_DUMP_AUDIO_IN, "AudioIn.pcm");
@@ -51,7 +50,7 @@ XnStatus XnAudioProcessor::Init()
 	nRetVal = XnWholePacketProcessor::Init();
 	XN_IS_STATUS_OK(nRetVal);
 
-	nRetVal = GetStream()->NumberOfChannelsProperty().OnChangeEvent().Register(DeleteChannelChangedCallback, this, m_hNumChannelsCallback);
+	nRetVal = GetStream()->NumberOfChannelsProperty().OnChangeEvent().Register(DeleteChannelChangedCallback, this, &m_hNumChannelsCallback);
 	XN_IS_STATUS_OK(nRetVal);
 
 	CalcDeleteChannel();
@@ -61,10 +60,10 @@ XnStatus XnAudioProcessor::Init()
 
 void XnAudioProcessor::ProcessWholePacket(const XnSensorProtocolResponseHeader* pHeader, const XnUChar* pData)
 {
-	xnOSEnterCriticalSection(&m_pBuffer->hLock);
+	xnOSEnterCriticalSection(&m_pDevicePrivateData->hAudioBufferCriticalSection);
 
 	// take write packet
-	XnUChar* pWritePacket = m_pBuffer->pAudioBuffer + (m_pBuffer->nAudioWriteIndex * m_pBuffer->nAudioPacketSize);
+	XnUChar* pWritePacket = m_pDevicePrivateData->pAudioBuffer + (m_pDevicePrivateData->nAudioWriteIndex * m_pDevicePrivateData->nAudioPacketSize);
 
 	if (m_bDeleteChannel)
 	{
@@ -88,14 +87,7 @@ void XnAudioProcessor::ProcessWholePacket(const XnSensorProtocolResponseHeader*
 	}
 
 	// mark timestamp
-	if (ShouldUseHostTimestamps())
-	{
-		m_pBuffer->pAudioPacketsTimestamps[m_pBuffer->nAudioWriteIndex] = GetHostTimestamp();
-	}
-	else
-	{
-		m_pBuffer->pAudioPacketsTimestamps[m_pBuffer->nAudioWriteIndex] = CreateTimestampFromDevice(pHeader->nTimeStamp);
-	}
+	m_pDevicePrivateData->pAudioPacketsTimestamps[m_pDevicePrivateData->nAudioWriteIndex] = GetTimeStamp(pHeader->nTimeStamp);
 
 	if (m_nLastPacketID % 10 == 0)
 	{
@@ -109,21 +101,21 @@ void XnAudioProcessor::ProcessWholePacket(const XnSensorProtocolResponseHeader*
 	}
 
 	// move write index forward
-	m_pBuffer->nAudioWriteIndex = (m_pBuffer->nAudioWriteIndex + 1) % m_pBuffer->nAudioBufferNumOfPackets;
+	m_pDevicePrivateData->nAudioWriteIndex = (m_pDevicePrivateData->nAudioWriteIndex + 1) % m_pDevicePrivateData->nAudioBufferNumOfPackets;
 
 	// if write index got to read index (end of buffer), move read index forward (and loose a packet)
-	if (m_pBuffer->nAudioWriteIndex == m_pBuffer->nAudioReadIndex)
+	if (m_pDevicePrivateData->nAudioWriteIndex == m_pDevicePrivateData->nAudioReadIndex)
 	{
-		m_pBuffer->nAudioReadIndex = (m_pBuffer->nAudioReadIndex + 1) % m_pBuffer->nAudioBufferNumOfPackets;
+		m_pDevicePrivateData->nAudioReadIndex = (m_pDevicePrivateData->nAudioReadIndex + 1) % m_pDevicePrivateData->nAudioBufferNumOfPackets;
 	}
 
-	xnOSLeaveCriticalSection(&m_pBuffer->hLock);
+	xnOSLeaveCriticalSection(&m_pDevicePrivateData->hAudioBufferCriticalSection);
 
 	xnDumpFileWriteBuffer(m_AudioInDump, pData, pHeader->nBufSize);
 
-	if (m_pBuffer->pAudioCallback != NULL)
+	if (m_pDevicePrivateData->pAudioCallback != NULL)
 	{
-		m_pBuffer->pAudioCallback(m_pBuffer->pAudioCallbackCookie);
+		m_pDevicePrivateData->pAudioCallback(m_pDevicePrivateData->pAudioCallbackCookie);
 	}
 }
 
diff --git a/Source/XnDeviceSensorV2/XnAudioProcessor.h b/Source/XnDeviceSensorV2/XnAudioProcessor.h
index da28d7c..5384fe2 100644
--- a/Source/XnDeviceSensorV2/XnAudioProcessor.h
+++ b/Source/XnDeviceSensorV2/XnAudioProcessor.h
@@ -35,7 +35,7 @@
 class XnAudioProcessor : public XnWholePacketProcessor
 {
 public:
-	XnAudioProcessor(XnSensorAudioStream* pStream, XnSensorStreamHelper* pHelper, XnDeviceAudioBuffer* pBuffer, XnUInt32 nInputPacketSize);
+	XnAudioProcessor(XnSensorAudioStream* pStream, XnSensorStreamHelper* pHelper, XnUInt32 nInputPacketSize);
 	~XnAudioProcessor();
 
 	XnStatus Init();
@@ -62,7 +62,6 @@ private:
 	XnDumpFile* m_AudioInDump;
 	XnBool m_bDeleteChannel;
 	XnSensorAudioStream* m_pStream;
-	XnDeviceAudioBuffer* m_pBuffer;
 	XnSensorStreamHelper* m_pHelper;
 
 	XnCallbackHandle m_hNumChannelsCallback;
diff --git a/Source/XnDeviceSensorV2/XnBayerImageProcessor.cpp b/Source/XnDeviceSensorV2/XnBayerImageProcessor.cpp
index 17700f9..9e78426 100644
--- a/Source/XnDeviceSensorV2/XnBayerImageProcessor.cpp
+++ b/Source/XnDeviceSensorV2/XnBayerImageProcessor.cpp
@@ -31,8 +31,8 @@
 // Code
 //---------------------------------------------------------------------------
 
-XnBayerImageProcessor::XnBayerImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper, XnFrameBufferManager* pBufferManager) :
-	XnImageProcessor(pStream, pHelper, pBufferManager)
+XnBayerImageProcessor::XnBayerImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper) :
+	XnImageProcessor(pStream, pHelper)
 {
 }
 
diff --git a/Source/XnDeviceSensorV2/XnBayerImageProcessor.h b/Source/XnDeviceSensorV2/XnBayerImageProcessor.h
index 4a327eb..0eb5cd7 100644
--- a/Source/XnDeviceSensorV2/XnBayerImageProcessor.h
+++ b/Source/XnDeviceSensorV2/XnBayerImageProcessor.h
@@ -34,7 +34,7 @@
 class XnBayerImageProcessor : public XnImageProcessor
 {
 public:
-	XnBayerImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper, XnFrameBufferManager* pBufferManager);
+	XnBayerImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper);
 	~XnBayerImageProcessor();
 
 	XnStatus Init();
diff --git a/Source/XnDeviceSensorV2/XnCmosInfo.cpp b/Source/XnDeviceSensorV2/XnCmosInfo.cpp
index 7af09b6..0eebe3c 100644
--- a/Source/XnDeviceSensorV2/XnCmosInfo.cpp
+++ b/Source/XnDeviceSensorV2/XnCmosInfo.cpp
@@ -48,7 +48,7 @@ XnStatus XnCmosInfo::SetCmosConfig(XnCMOSType nCmos, XnResolutions nResolution,
 		XnCmosBlankingInformation* pInfo = NULL;
 
 		// search the list if we already have this info
-		for (XnCmosBlankingDataList::Iterator it = m_CmosBlankingInfo.Begin(); it != m_CmosBlankingInfo.End(); ++it)
+		for (XnCmosBlankingDataList::Iterator it = m_CmosBlankingInfo.begin(); it != m_CmosBlankingInfo.end(); ++it)
 		{
 			XnCmosBlankingData& data = *it;
 			if (data.nRes == nResolution && data.nFPS == nFPS)
@@ -73,7 +73,7 @@ XnStatus XnCmosInfo::SetCmosConfig(XnCMOSType nCmos, XnResolutions nResolution,
 			XN_IS_STATUS_OK(nRetVal);
 
 			// take its info (take a pointer to the object in the list, and not to the one on the stack)
-			pInfo = &m_CmosBlankingInfo.Begin()->BlankingInfo;
+			pInfo = &m_CmosBlankingInfo.begin()->BlankingInfo;
 		}
 
 		m_pCurrCmosBlankingInfo[nCmos] = &pInfo->Coefficients[nCmos];
diff --git a/Source/XnDeviceSensorV2/XnCmosInfo.h b/Source/XnDeviceSensorV2/XnCmosInfo.h
index 0f21147..9d4051b 100644
--- a/Source/XnDeviceSensorV2/XnCmosInfo.h
+++ b/Source/XnDeviceSensorV2/XnCmosInfo.h
@@ -26,7 +26,6 @@
 // Includes
 //---------------------------------------------------------------------------
 #include "XnSensorFirmware.h"
-#include <XnListT.h>
 
 //---------------------------------------------------------------------------
 // Types
@@ -49,7 +48,7 @@ public:
 	inline const XnCmosBlankingCoefficients* GetBlankingCoefficients(XnCMOSType nCmos) const { return m_pCurrCmosBlankingInfo[nCmos]; } 
 
 private:
-	typedef XnListT<XnCmosBlankingData> XnCmosBlankingDataList;
+	XN_DECLARE_LIST(XnCmosBlankingData, XnCmosBlankingDataList)
 
 	XnSensorFirmware* m_pFirmware;
 	XnDevicePrivateData* m_pDevicePrivateData;
diff --git a/Source/XnDeviceSensorV2/XnDataProcessor.cpp b/Source/XnDeviceSensorV2/XnDataProcessor.cpp
index 601038e..c29c373 100644
--- a/Source/XnDeviceSensorV2/XnDataProcessor.cpp
+++ b/Source/XnDeviceSensorV2/XnDataProcessor.cpp
@@ -33,12 +33,10 @@ XnDataProcessor::XnDataProcessor(XnDevicePrivateData* pDevicePrivateData, const
 	m_pDevicePrivateData(pDevicePrivateData),
 	m_csName(csName),
 	m_nLastPacketID(0),
-	m_nBytesReceived(0),
-	m_bUseHostTimestamps(FALSE)
+	m_nBytesReceived(0)
 {
 	m_TimeStampData.csStreamName = csName;
 	m_TimeStampData.bFirst = TRUE;
-	m_bUseHostTimestamps = pDevicePrivateData->pSensor->ShouldUseHostTimestamps();
 }
 
 XnDataProcessor::~XnDataProcessor()
@@ -82,11 +80,19 @@ void XnDataProcessor::ProcessData(const XnSensorProtocolResponseHeader* pHeader,
 void XnDataProcessor::OnPacketLost()
 {}
 
-XnUInt64 XnDataProcessor::CreateTimestampFromDevice(XnUInt32 nDeviceTimeStamp)
+XnUInt64 XnDataProcessor::GetTimeStamp(XnUInt32 nDeviceTimeStamp)
 {
+	const XnUInt64 nWrapPoint = ((XnUInt64)XN_MAX_UINT32) + 1;
+	XnUInt64 nResultInTicks;
+
 	XnUInt64 nNow;
 	xnOSGetHighResTimeStamp(&nNow);
 
+	const XnUInt32 nDumpCommentMaxLength = 200;
+	XnChar csDumpComment[nDumpCommentMaxLength] = "";
+
+	XnBool bCheckSanity = TRUE;
+
 	// we register the first TS calculated as time-zero. Every stream's TS data will be 
 	// synchronized with it
 	if (m_pDevicePrivateData->nGlobalReferenceTS == 0)
@@ -100,12 +106,6 @@ XnUInt64 XnDataProcessor::CreateTimestampFromDevice(XnUInt32 nDeviceTimeStamp)
 		xnOSLeaveCriticalSection(&m_pDevicePrivateData->hEndPointsCS);
 	}
 
-	const XnUInt64 nWrapPoint = ((XnUInt64)XN_MAX_UINT32) + 1;
-	XnUInt64 nResultInTicks;
-	const XnUInt32 nDumpCommentMaxLength = 200;
-	XnChar csDumpComment[nDumpCommentMaxLength] = "";
-	XnBool bCheckSanity = TRUE;
-
 	if (m_TimeStampData.bFirst)
 	{
 		/* 
@@ -212,29 +212,8 @@ XnUInt64 XnDataProcessor::CreateTimestampFromDevice(XnUInt32 nDeviceTimeStamp)
 	{
 		// sanity failed. We lost sync. restart
 		m_TimeStampData.bFirst = TRUE;
-		return CreateTimestampFromDevice(nDeviceTimeStamp);
+		return GetTimeStamp(nDeviceTimeStamp);
 	}
 }
 
-XnUInt64 XnDataProcessor::GetHostTimestamp()
-{
-	XnUInt64 nNow;
-	xnOSGetHighResTimeStamp(&nNow);
-
-	// we register the first TS calculated as time-zero. Every stream's TS data will be 
-	// synchronized with it
-	if (m_pDevicePrivateData->nGlobalReferenceTS == 0)
-	{
-		xnOSEnterCriticalSection(&m_pDevicePrivateData->hEndPointsCS);
-		if (m_pDevicePrivateData->nGlobalReferenceTS == 0)
-		{
-			m_pDevicePrivateData->nGlobalReferenceTS = nNow;
-			m_pDevicePrivateData->nGlobalReferenceOSTime = nNow;
-		}
-		xnOSLeaveCriticalSection(&m_pDevicePrivateData->hEndPointsCS);
-	}
 
-	XnUInt64 nResultTimeMicroseconds = nNow - m_pDevicePrivateData->nGlobalReferenceOSTime;
-	XnUInt64 nResultTimeMilliseconds = nResultTimeMicroseconds / 1000;
-	return (m_pDevicePrivateData->pSensor->IsHighResTimestamps() ? nResultTimeMicroseconds : nResultTimeMilliseconds);
-}
diff --git a/Source/XnDeviceSensorV2/XnDataProcessor.h b/Source/XnDeviceSensorV2/XnDataProcessor.h
index 5ecc8db..7132346 100644
--- a/Source/XnDeviceSensorV2/XnDataProcessor.h
+++ b/Source/XnDeviceSensorV2/XnDataProcessor.h
@@ -60,8 +60,6 @@ public:
 	*/
 	void ProcessData(const XnSensorProtocolResponseHeader* pHeader, const XnUChar* pData, XnUInt32 nDataOffset, XnUInt32 nDataSize);
 
-	inline XnBool ShouldUseHostTimestamps() { return m_bUseHostTimestamps; }
-
 //---------------------------------------------------------------------------
 // Virtual Functions
 //---------------------------------------------------------------------------
@@ -78,9 +76,7 @@ protected:
 	*
 	* @param	nDeviceTimeStamp	[in]	The device TS to translate.
 	*/ 
-	virtual XnUInt64 CreateTimestampFromDevice(XnUInt32 nDeviceTimeStamp);
-
-	XnUInt64 GetHostTimestamp();
+	virtual XnUInt64 GetTimeStamp(XnUInt32 nDeviceTimeStamp);
 
 //---------------------------------------------------------------------------
 // Class Members
@@ -97,7 +93,6 @@ protected:
 private:
 	/* Data used for calculating timestamps. */
 	XnTimeStampData m_TimeStampData;
-	XnBool m_bUseHostTimestamps;
 };
 
 #endif //__XN_DATA_PROCESSOR_H__
diff --git a/Source/XnDeviceSensorV2/XnDataProcessorHolder.h b/Source/XnDeviceSensorV2/XnDataProcessorHolder.h
index d26cf85..09804a9 100644
--- a/Source/XnDeviceSensorV2/XnDataProcessorHolder.h
+++ b/Source/XnDeviceSensorV2/XnDataProcessorHolder.h
@@ -45,8 +45,6 @@ public:
 	void ProcessData(const XnSensorProtocolResponseHeader* pHeader, const XnUChar* pData, XnUInt32 nDataOffset, XnUInt32 nDataSize);
 
 private:
-	XN_DISABLE_COPY_AND_ASSIGN(XnDataProcessorHolder);
-
 	XN_CRITICAL_SECTION_HANDLE m_hLock;
 	XnDataProcessor* m_pProcessor;
 };
diff --git a/Source/XnDeviceSensorV2/XnDepthProcessor.cpp b/Source/XnDeviceSensorV2/XnDepthProcessor.cpp
index 2b75f0f..336a501 100644
--- a/Source/XnDeviceSensorV2/XnDepthProcessor.cpp
+++ b/Source/XnDeviceSensorV2/XnDepthProcessor.cpp
@@ -34,12 +34,11 @@
 //---------------------------------------------------------------------------
 // Code
 //---------------------------------------------------------------------------
-XnDepthProcessor::XnDepthProcessor(XnSensorDepthStream* pStream, XnSensorStreamHelper* pHelper, XnFrameBufferManager* pBufferManager) :
-	XnFrameStreamProcessor(pStream, pHelper, pBufferManager, XN_SENSOR_PROTOCOL_RESPONSE_DEPTH_START, XN_SENSOR_PROTOCOL_RESPONSE_DEPTH_END),
+XnDepthProcessor::XnDepthProcessor(XnSensorDepthStream* pStream, XnSensorStreamHelper* pHelper) :
+	XnFrameStreamProcessor(pStream, pHelper, XN_SENSOR_PROTOCOL_RESPONSE_DEPTH_START, XN_SENSOR_PROTOCOL_RESPONSE_DEPTH_END),
 	m_pShiftToDepthTable(pStream->GetShiftToDepthTable()),
 	m_nPaddingPixelsOnEnd(0),
-	m_bShiftToDepthAllocated(FALSE),
-	m_nExpectedFrameSize(0)
+	m_bShiftToDepthAllocated(FALSE)
 {
 }
 
@@ -87,8 +86,6 @@ void XnDepthProcessor::OnStartOfFrame(const XnSensorProtocolResponseHeader* pHea
 	// call base
 	XnFrameStreamProcessor::OnStartOfFrame(pHeader);
 
-	m_nExpectedFrameSize = CalculateExpectedSize();
-
 	if (m_pDevicePrivateData->FWInfo.nFWVer >= XN_SENSOR_FW_VER_5_1 && pHeader->nTimeStamp != 0)
 	{
 		// PATCH: starting with v5.1, the timestamp field of the SOF packet, is the number of pixels
@@ -124,15 +121,13 @@ void XnDepthProcessor::OnEndOfFrame(const XnSensorProtocolResponseHeader* pHeade
 		m_nPaddingPixelsOnEnd = 0 ;
 	}
 
-	if (GetWriteBuffer()->GetSize() != GetExpectedSize())
+	XnUInt32 nExpectedSize = CalculateExpectedSize();
+	if (GetWriteBuffer()->GetSize() != nExpectedSize)
 	{
-		xnLogWarning(XN_MASK_SENSOR_READ, "Read: Depth buffer is corrupt. Size is %u (!= %u)", GetWriteBuffer()->GetSize(), GetExpectedSize());
+		xnLogWarning(XN_MASK_SENSOR_READ, "Read: Depth buffer is corrupt. Size is %u (!= %u)", GetWriteBuffer()->GetSize(), nExpectedSize);
 		FrameIsCorrupted();
 	}
 
-	// now add the size of the shifts map (appended at the end)
-	GetWriteBuffer()->UnsafeUpdateSize(GetWriteBuffer()->GetSize());
-
 	// call base
 	XnFrameStreamProcessor::OnEndOfFrame(pHeader);
 }
@@ -147,15 +142,12 @@ void XnDepthProcessor::PadPixels(XnUInt32 nPixels)
 		return;
 	}
 
-	XnDepthPixel* pDepth = GetDepthOutputBuffer();
-	XnDepthPixel* pShift = GetShiftsOutputBuffer();
+	XnDepthPixel* pWrite = (XnDepthPixel*)pWriteBuffer->GetUnsafeWritePointer();
 
 	// place the no-depth value
-	for (XnUInt32 i = 0; i < nPixels; ++i, ++pDepth, ++pShift)
-    {
-		*pDepth = GetStream()->GetNoDepthValue();
-		*pShift = 0;
-    }
+	for (XnUInt32 i = 0; i < nPixels; ++i, ++pWrite)
+		*pWrite = GetStream()->GetNoDepthValue();
+
 	pWriteBuffer->UnsafeUpdateSize(nPixels * sizeof(XnDepthPixel));
 }
 
@@ -165,3 +157,32 @@ void XnDepthProcessor::OnFrameReady(XnUInt32 nFrameID, XnUInt64 nFrameTS)
 
 	m_pDevicePrivateData->pSensor->GetFPSCalculator()->MarkInputDepth(nFrameID, nFrameTS);
 }
+
+void XnDepthProcessor::WriteShifts(XnUInt16* pShifts, XnUInt32 nCount)
+{
+	XnUInt32 nOutputSize = nCount * sizeof(XnDepthPixel);
+
+	// make sure we have enough room
+	if (CheckWriteBufferForOverflow(nOutputSize))
+	{
+		UnsafeWriteShifts(pShifts, nCount);
+	}
+}
+
+void XnDepthProcessor::UnsafeWriteShifts(XnUInt16* pShifts, XnUInt32 nCount)
+{
+	XnBuffer* pWriteBuffer = GetWriteBuffer();
+
+	XnDepthPixel* pWriteBuf = (XnDepthPixel*)pWriteBuffer->GetUnsafeWritePointer();
+	XnUInt16* pRaw = pShifts;
+	XnUInt16* pRawEnd = pShifts + nCount;
+
+	while (pRaw != pRawEnd)
+	{
+		*pWriteBuf = m_pShiftToDepthTable[*pRaw];
+		++pRaw;
+		++pWriteBuf;
+	}
+
+	pWriteBuffer->UnsafeUpdateSize(nCount * sizeof(XnDepthPixel));
+}
diff --git a/Source/XnDeviceSensorV2/XnDepthProcessor.h b/Source/XnDeviceSensorV2/XnDepthProcessor.h
index f3ecc64..3c081c5 100644
--- a/Source/XnDeviceSensorV2/XnDepthProcessor.h
+++ b/Source/XnDeviceSensorV2/XnDepthProcessor.h
@@ -47,7 +47,7 @@
 class XnDepthProcessor : public XnFrameStreamProcessor
 {
 public:
-	XnDepthProcessor(XnSensorDepthStream* pStream, XnSensorStreamHelper* pHelper, XnFrameBufferManager* pBufferManager);
+	XnDepthProcessor(XnSensorDepthStream* pStream, XnSensorStreamHelper* pHelper);
 	virtual ~XnDepthProcessor();
 
 	XnStatus Init();
@@ -73,38 +73,14 @@ protected:
 		return m_pShiftToDepthTable[nShift];
 	}
 
-	inline XnUInt32 GetExpectedSize()
-	{
-		return m_nExpectedFrameSize;
-	}
-
-	inline XnDepthPixel* GetDepthOutputBuffer()
-	{
-		return (XnDepthPixel*)GetWriteBuffer()->GetUnsafeWritePointer();
-	}
-
-	inline XnUInt16* GetShiftsOutputBuffer()
-	{
-		return (XnUInt16*)(GetWriteBuffer()->GetUnsafeWritePointer() + GetExpectedSize());
-	}
-
-	inline XnBool CheckDepthBufferForOverflow(XnUInt32 nWriteSize)
-	{
-		// Check there is enough room for current depth pixels + the entire shift map
-		return CheckWriteBufferForOverflow(nWriteSize + GetExpectedSize());
-	}
-
-	inline XnUInt32 GetFreeSpaceInDepthBuffer()
-	{
-		return GetWriteBuffer()->GetFreeSpaceInBuffer() - GetExpectedSize();
-	}
+	void WriteShifts(XnUInt16* pShifts, XnUInt32 nCount);
+	void UnsafeWriteShifts(XnUInt16* pShifts, XnUInt32 nCount);
+	XnUInt32 CalculateExpectedSize();
 
 private:
 	void PadPixels(XnUInt32 nPixels);
-	XnUInt32 CalculateExpectedSize();
 
 	XnUInt32 m_nPaddingPixelsOnEnd;
-	XnUInt32 m_nExpectedFrameSize;
 	XnBool m_bShiftToDepthAllocated;
 	XnDepthPixel* m_pShiftToDepthTable;
 };
diff --git a/Source/XnDeviceSensorV2/XnDeviceSensor.h b/Source/XnDeviceSensorV2/XnDeviceSensor.h
index dbf79fb..e856163 100644
--- a/Source/XnDeviceSensorV2/XnDeviceSensor.h
+++ b/Source/XnDeviceSensorV2/XnDeviceSensor.h
@@ -161,19 +161,27 @@ class XnCmosInfo;
 
 typedef struct XnSensorObjects
 {
-	XnSensorObjects(XnSensorFirmware* pFirmware, XnDevicePrivateData* pDevicePrivateData, XnSensorFPS* pFPS, XnCmosInfo* pCmosInfo) :
+	XnSensorObjects(XnSensorFirmware* pFirmware, XnDevicePrivateData* pDevicePrivateData, XnSensorFixedParams* pFixedParams, XnSensorFPS* pFPS, XnCmosInfo* pCmosInfo) :
 		pFirmware(pFirmware),
 		pDevicePrivateData(pDevicePrivateData),
+		pFixedParams(pFixedParams),
 		pFPS(pFPS),
 		pCmosInfo(pCmosInfo)
 	{}
 
 	XnSensorFirmware* pFirmware;
 	XnDevicePrivateData* pDevicePrivateData;
+	XnSensorFixedParams* pFixedParams;
 	XnSensorFPS* pFPS;
 	XnCmosInfo* pCmosInfo;
 } XnSensorObjects;
 
+typedef struct XnSensorInfo
+{
+	XnSensorVer nSensorVer;
+//	XnChar     cSensorID[XN_SENSOR_PROTOCOL_SENSOR_ID_LENGTH+1];
+} XnSensorInfo;
+
 typedef struct XnHWInfo
 {
 	XnHWVer	  nHWVer;
@@ -246,27 +254,6 @@ typedef XnStatus (XN_CALLBACK_TYPE* NewAudioDataCallback)(void* pCookie);
 struct XnSpecificUsbDevice; // Forward Declaration
 class XnSensor; // Forward Declaration
 
-typedef struct XnDeviceAudioBuffer
-{
-	XN_CRITICAL_SECTION_HANDLE hLock;
-	/** A single (big) buffer for audio. */
-	XN_AUDIO_TYPE* pAudioBuffer;
-	/** An array of pointers into the audio buffer. */
-	XnUInt64* pAudioPacketsTimestamps;
-	/** The index of the next packet that should be written. */
-	volatile XnUInt32 nAudioWriteIndex;
-	/** The index of the next packet that can be read. */
-	volatile XnUInt32 nAudioReadIndex;
-	/** Size of the audio buffer, in packets. */
-	XnUInt32 nAudioBufferNumOfPackets;
-	/** Size of the audio buffer, in bytes. */
-	XnUInt32 nAudioBufferSize;
-	XnUInt32 nAudioPacketSize;
-	/** A callback for new data */
-	NewAudioDataCallback pAudioCallback;
-	void* pAudioCallbackCookie;
-} XnDeviceAudioBuffer;
-
 typedef struct XnDevicePrivateData
 {
 	XnVersions Version;
@@ -276,10 +263,13 @@ typedef struct XnDevicePrivateData
 	XnChar				cpSensorID[XN_SENSOR_PROTOCOL_SENSOR_ID_LENGTH+1];
 	XnUInt8				nBoardID;
 	XN_SENSOR_HANDLE	SensorHandle;
+	XnSensorInfo		SensorInfo;
 	XnFirmwareInfo		FWInfo;
 	XnHWInfo			HWInfo;
 	XnChipInfo			ChipInfo;
 
+	XN_CRITICAL_SECTION_HANDLE hAudioBufferCriticalSection;
+
 	XnSpecificUsbDevice* pSpecificDepthUsb;
 	XnSpecificUsbDevice* pSpecificImageUsb;
 	XnSpecificUsbDevice* pSpecificMiscUsb;
@@ -288,6 +278,25 @@ typedef struct XnDevicePrivateData
 
 	XnCropping IRCropping;
 
+	/** A single (big) buffer for audio. */
+	XN_AUDIO_TYPE* pAudioBuffer;
+	/** An array of pointers into the audio buffer. */
+	XnUInt64* pAudioPacketsTimestamps;
+	/** The index of the next packet that should be written. */
+	volatile XnUInt32 nAudioWriteIndex;
+	/** The index of the next packet that can be read. */
+	volatile XnUInt32 nAudioReadIndex;
+	/** Size of the audio buffer, in packets. */
+	XnUInt32 nAudioBufferNumOfPackets;
+	/** Size of the audio buffer, in bytes. */
+	XnUInt32 nAudioBufferSize;
+	XnUInt32 nAudioPacketSize;
+	/** When true, when reading from device, if frames were lost, their audio will also be dropped. */
+	XnBool bSyncAudio;
+	/** A callback for new data */
+	NewAudioDataCallback pAudioCallback;
+	void* pAudioCallbackCookie;
+
 	XnFloat fDeviceFrequency;
 
 	/** Keeps the global reference TS (the one marking time-zero). */
diff --git a/Source/XnDeviceSensorV2/XnDeviceSensorIO.cpp b/Source/XnDeviceSensorV2/XnDeviceSensorIO.cpp
index eacf514..8fd955c 100644
--- a/Source/XnDeviceSensorV2/XnDeviceSensorIO.cpp
+++ b/Source/XnDeviceSensorV2/XnDeviceSensorIO.cpp
@@ -24,12 +24,15 @@
 //---------------------------------------------------------------------------
 #include "XnDeviceSensorIO.h"
 #include "XnDeviceSensor.h"
-#include <XnStringsHashT.h>
+#include <XnStringsHash.h>
 
 //---------------------------------------------------------------------------
 // Defines
 //---------------------------------------------------------------------------
 #define XN_SENSOR_VENDOR_ID			0x1D27
+#define XN_SENSOR_5_0_PRODUCT_ID	0x0500
+#define XN_SENSOR_6_0_PRODUCT_ID	0x0600
+#define XN_SENSOR_6_0_1_PRODUCT_ID	0x0601
 
 //---------------------------------------------------------------------------
 // Enums
@@ -41,18 +44,6 @@ typedef enum
 } XnFWUsbInterface;
 
 //---------------------------------------------------------------------------
-// Globals
-//---------------------------------------------------------------------------
-XnUInt16 XnSensorIO::ms_supportedProducts[] = 
-{
-	0x0500,
-	0x0600,
-	0x0601,
-};
-
-XnUInt32 XnSensorIO::ms_supportedProductsCount = sizeof(XnSensorIO::ms_supportedProducts) / sizeof(XnSensorIO::ms_supportedProducts[0]);
-
-//---------------------------------------------------------------------------
 // Code
 //---------------------------------------------------------------------------
 XnSensorIO::XnSensorIO(XN_SENSOR_HANDLE* pSensorHandle) :
@@ -64,10 +55,7 @@ XnSensorIO::XnSensorIO(XN_SENSOR_HANDLE* pSensorHandle) :
 
 XnSensorIO::~XnSensorIO()
 {
-	for (XnUInt32 i = 0; i < m_aRegistrationHandles.GetSize(); ++i)
-	{
-		xnUSBUnregisterFromConnectivityEvents(m_aRegistrationHandles[i]);
-	}
+
 }
 
 XnStatus XnSensorIO::OpenDevice(const XnChar* strPath)
@@ -368,7 +356,7 @@ XnStatus XnSensorIO::CloseDevice()
 	return (XN_STATUS_OK);
 }
 
-XnStatus Enumerate(XnUInt16 nProduct, XnStringsSet& devicesSet)
+XnStatus Enumerate(XnUInt16 nProduct, XnStringsHash& devicesSet)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 	
@@ -380,7 +368,7 @@ XnStatus Enumerate(XnUInt16 nProduct, XnStringsSet& devicesSet)
 
 	for (XnUInt32 i = 0; i < nCount; ++i)
 	{
-		nRetVal = devicesSet.Set(astrDevicePaths[i]);
+		nRetVal = devicesSet.Set(astrDevicePaths[i], NULL);
 		XN_IS_STATUS_OK(nRetVal);
 	}
 
@@ -399,35 +387,41 @@ XnStatus XnSensorIO::EnumerateSensors(XnConnectionString* aConnectionStrings, Xn
 
 // Temporary patch: "Cache" the devices since running USB enum on the MacOSX platform takes several seconds due to problems in libusb!		
 #if (XN_PLATFORM == XN_PLATFORM_MACOSX)	
-	static XnStringsSet devicesSet;
+	static XnStringsHash devicesSet;
 	
 	if (devicesSet.Size() == 0)
 	{
-		// search for supported devices
-		for (XnUInt32 i = 0; i < ms_supportedProductsCount; ++i)
-		{
-			nRetVal = Enumerate(ms_supportedProducts[i], devicesSet);
-			XN_IS_STATUS_OK(nRetVal);
-		}
+		// search for a v6.0.1 device
+		nRetVal = Enumerate(XN_SENSOR_6_0_1_PRODUCT_ID, devicesSet);
+		XN_IS_STATUS_OK(nRetVal);
+
+		// search for a v6.0 device
+		nRetVal = Enumerate(XN_SENSOR_6_0_PRODUCT_ID, devicesSet);
+		XN_IS_STATUS_OK(nRetVal);	
 	}
 #else
-	XnStringsSet devicesSet;
+	XnStringsHash devicesSet;
 
-	// search for supported devices
-	for (XnUInt32 i = 0; i < ms_supportedProductsCount; ++i)
-	{
-		nRetVal = Enumerate(ms_supportedProducts[i], devicesSet);
-		XN_IS_STATUS_OK(nRetVal);
-	}
+	// search for a v6.0.1 device
+	nRetVal = Enumerate(XN_SENSOR_6_0_1_PRODUCT_ID, devicesSet);
+	XN_IS_STATUS_OK(nRetVal);
+
+	// search for a v6.0 device
+	nRetVal = Enumerate(XN_SENSOR_6_0_PRODUCT_ID, devicesSet);
+	XN_IS_STATUS_OK(nRetVal);
+
+	// search for a v5.0 device
+	nRetVal = Enumerate(XN_SENSOR_5_0_PRODUCT_ID, devicesSet);
+	XN_IS_STATUS_OK(nRetVal);
 #endif
 	
 	// now copy back
 	XnUInt32 nCount = 0;
-	for (XnStringsSet::ConstIterator it = devicesSet.Begin(); it != devicesSet.End(); ++it, ++nCount)
+	for (XnStringsHash::ConstIterator it = devicesSet.begin(); it != devicesSet.end(); ++it, ++nCount)
 	{
 		if (nCount < *pnCount)
 		{
-			strcpy(aConnectionStrings[nCount], it->Key());
+			strcpy(aConnectionStrings[nCount], it.Key());
 		}
 	}
 
@@ -470,36 +464,13 @@ XnStatus XnSensorIO::IsSensorLowBandwidth(const XnConnectionString connectionStr
 	return (XN_STATUS_OK);
 }
 
-void XN_CALLBACK_TYPE XnSensorIO::OnConnectivityEvent(XnUSBEventArgs* pArgs, void* pCookie)
-{
-	XnSensorIO* pThis = (XnSensorIO*)pCookie;
-	if (strcmp(pThis->m_strDeviceName, pArgs->strDevicePath) == 0)
-	{
-		pThis->m_pCallbackPtr(pArgs->eventType, const_cast<XnChar*>(pArgs->strDevicePath), pThis->m_pCallbackData);
-	}
-}
-
 XnStatus XnSensorIO::SetCallback(XnUSBEventCallbackFunctionPtr pCallbackPtr, void* pCallbackData)
 {
+	//TODO: Support multiple sensors - this won't work for more than one.
 	XnStatus nRetVal = XN_STATUS_OK;
 	
-	if (m_aRegistrationHandles.GetSize() == 0)
-	{
-		// register for USB events
-		for (XnUInt32 i = 0; i < ms_supportedProductsCount; ++i)
-		{
-			XnRegistrationHandle hRegistration = NULL;
-			nRetVal = xnUSBRegisterToConnectivityEvents(XN_SENSOR_VENDOR_ID, ms_supportedProducts[i], OnConnectivityEvent, this, &hRegistration);
-			XN_IS_STATUS_OK(nRetVal);
-
-			nRetVal = m_aRegistrationHandles.AddLast(hRegistration);
-			XN_IS_STATUS_OK(nRetVal);
-		}
-	}
-
-	// set callbacks
-	m_pCallbackPtr = pCallbackPtr;
-	m_pCallbackData = pCallbackData;
+	// try to register callback to a 5.0 device
+	nRetVal = xnUSBSetCallbackHandler(XN_SENSOR_VENDOR_ID, XN_SENSOR_5_0_PRODUCT_ID, NULL, pCallbackPtr, pCallbackData);
 
 	return nRetVal;
 }
diff --git a/Source/XnDeviceSensorV2/XnDeviceSensorIO.h b/Source/XnDeviceSensorV2/XnDeviceSensorIO.h
index 7f491b9..a329975 100644
--- a/Source/XnDeviceSensorV2/XnDeviceSensorIO.h
+++ b/Source/XnDeviceSensorV2/XnDeviceSensorIO.h
@@ -27,7 +27,6 @@
 //---------------------------------------------------------------------------
 #include <XnPlatform.h>
 #include <XnUSB.h>
-#include <XnArray.h>
 #include <XnStreamParams.h>
 #include <XnDevice.h>
 #include "XnFirmwareInfo.h"
@@ -95,18 +94,11 @@ public:
 	const XnChar* GetDevicePath();
 
 private:
-	static void XN_CALLBACK_TYPE OnConnectivityEvent(XnUSBEventArgs* pArgs, void* pCookie);
-
 	XN_SENSOR_HANDLE* m_pSensorHandle;
 	XnBool m_bMiscSupported;
 	XnSensorUsbInterface m_interface;
 	XnChar m_strDeviceName[XN_DEVICE_MAX_STRING_LENGTH];
 	XnBool m_bIsLowBandwidth;
-	XnArray<XnRegistrationHandle> m_aRegistrationHandles;
-	XnUSBEventCallbackFunctionPtr m_pCallbackPtr; 
-	void* m_pCallbackData;
-	static XnUInt16 ms_supportedProducts[];
-	static XnUInt32 ms_supportedProductsCount;
 };
 
 #endif //__XN_DEVICE_SENSOR_I_O_H__
diff --git a/Source/XnDeviceSensorV2/XnDeviceSensorInit.cpp b/Source/XnDeviceSensorV2/XnDeviceSensorInit.cpp
index f05393c..1b22fce 100644
--- a/Source/XnDeviceSensorV2/XnDeviceSensorInit.cpp
+++ b/Source/XnDeviceSensorV2/XnDeviceSensorInit.cpp
@@ -61,6 +61,9 @@ XnStatus XnDeviceSensorInit(XnDevicePrivateData* pDevicePrivateData)
 
 	BayerUpdateGamma(1.0);
 
+	nRetVal = xnOSCreateCriticalSection(&pDevicePrivateData->hAudioBufferCriticalSection);
+	XN_IS_STATUS_OK(nRetVal);
+
 	return (XN_STATUS_OK);
 }
 
@@ -243,12 +246,6 @@ XnStatus XnDeviceSensorConfigureVersion(XnDevicePrivateData* pDevicePrivateData)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 	
-	// GetVersion is exactly the same in all versions, except a change that was made in version 5.1.
-	// so, we'll start with that, and if doesn't work we'll try previous protocols
-	XnHostProtocolUsbCore usb = XN_USB_CORE_JANGO;
-	nRetVal = XnHostProtocolInitFWParams(pDevicePrivateData, 5, 1, 0, usb);
-	XN_IS_STATUS_OK(nRetVal);
-
 	nRetVal = XnHostProtocolGetVersion(pDevicePrivateData, pDevicePrivateData->Version);
 	
 	// Strange bug: sometimes, when sending first command to device, no reply is received, so try again
@@ -258,30 +255,13 @@ XnStatus XnDeviceSensorConfigureVersion(XnDevicePrivateData* pDevicePrivateData)
 		nRetVal = XnHostProtocolGetVersion(pDevicePrivateData, pDevicePrivateData->Version);
 	}
 	
-	// if command failed for any reason, try again with older protocol
 	if (nRetVal != XN_STATUS_OK)
 	{
-		nRetVal = XnHostProtocolInitFWParams(pDevicePrivateData, 5, 0, 0, usb);
-		XN_IS_STATUS_OK(nRetVal);
-
-		nRetVal = XnHostProtocolGetVersion(pDevicePrivateData, pDevicePrivateData->Version);
+		return nRetVal;
 	}
 
-	// if it still fails, give up
-	XN_IS_STATUS_OK(nRetVal);
-
-	// check which usb core is used (don't check error code. If this fails, assume JANGO
-	if (XN_STATUS_OK != XnHostProtocolGetUsbCoreType(pDevicePrivateData, usb))
-	{
-		usb = XN_USB_CORE_JANGO;
-	}
-
-	// Now that we have the actual version, configure protocol accordingly
-	nRetVal = XnHostProtocolInitFWParams(pDevicePrivateData, pDevicePrivateData->Version.nMajor, pDevicePrivateData->Version.nMinor, pDevicePrivateData->Version.nBuild, usb);
-	XN_IS_STATUS_OK(nRetVal);
-
-	pDevicePrivateData->HWInfo.nHWVer = pDevicePrivateData->Version.HWVer;
-	pDevicePrivateData->ChipInfo.nChipVer = pDevicePrivateData->Version.ChipVer;
+	// Sensor HW Version is always 1.0 now...
+	pDevicePrivateData->SensorInfo.nSensorVer = XN_SENSOR_VER_2_0;
 
 	return (XN_STATUS_OK);
 }
diff --git a/Source/XnDeviceSensorV2/XnDeviceSensorProtocol.cpp b/Source/XnDeviceSensorV2/XnDeviceSensorProtocol.cpp
index b460151..6fae06e 100644
--- a/Source/XnDeviceSensorV2/XnDeviceSensorProtocol.cpp
+++ b/Source/XnDeviceSensorV2/XnDeviceSensorProtocol.cpp
@@ -115,9 +115,7 @@ XnBool XN_CALLBACK_TYPE XnDeviceSensorProtocolUsbEpCb(XnUChar* pBuffer, XnUInt32
 					break;
 				}
 				else
-				{
 					pBuffer++;
-				}
 			}
 
 			if (pBuffer == pBufEnd &&					// magic wasn't found
diff --git a/Source/XnDeviceSensorV2/XnExportedSensorDevice.cpp b/Source/XnDeviceSensorV2/XnExportedSensorDevice.cpp
index 6b7014a..3b68036 100644
--- a/Source/XnDeviceSensorV2/XnExportedSensorDevice.cpp
+++ b/Source/XnDeviceSensorV2/XnExportedSensorDevice.cpp
@@ -26,7 +26,7 @@
 #include <XnPsVersion.h>
 #include "XnSensorDevice.h"
 #include <XnOpenNI.h>
-#include <XnCommon.h>
+#include <XnCommon/XnCommon.h>
 #include "XnSensorServer.h"
 
 //---------------------------------------------------------------------------
@@ -75,7 +75,7 @@ XnStatus XnExportedSensorDevice::EnumerateProductionTrees(xn::Context& context,
 	if (nRetVal != XN_STATUS_OUTPUT_BUFFER_OVERFLOW)
 	{
 		// no sensor connected
-		return XN_STATUS_DEVICE_NOT_CONNECTED;
+		XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_NOT_CONNECTED, XN_MASK_DEVICE_SENSOR, "No PS sensor is connected!");
 	}
 
 	// allocate according to count
@@ -95,7 +95,7 @@ XnStatus XnExportedSensorDevice::EnumerateProductionTrees(xn::Context& context,
 	for (XnUInt32 i = 0; i < nCount; ++i)
 	{
 		// Each connection string is a sensor. Return it if it wasn't created already.
-		if (FindCreatedDevice(context.GetUnderlyingObject(), pConnStrings[i]) == m_createdDevices.End())
+		if (FindCreatedDevice(context.GetUnderlyingObject(), pConnStrings[i]) == m_createdDevices.end())
 		{
 			nRetVal = TreesList.Add(Description, pConnStrings[i], NULL);
 			if (nRetVal != XN_STATUS_OK)
@@ -183,7 +183,6 @@ XnStatus XnExportedSensorDevice::Create(xn::Context& context,
 	nRetVal = pDevice->Init();
 	if (nRetVal != XN_STATUS_OK)
 	{
-		XN_DELETE(pDevice);
 		XN_DELETE(pSensor);
 		return (nRetVal);
 	}
@@ -191,7 +190,6 @@ XnStatus XnExportedSensorDevice::Create(xn::Context& context,
 	nRetVal = m_createdDevices.AddLast(DeviceKey(context.GetUnderlyingObject(), strCreationInfo));
 	if (nRetVal != XN_STATUS_OK)
 	{
-		XN_DELETE(pDevice);
 		XN_DELETE(pSensor);
 		return (nRetVal);
 	}
@@ -214,7 +212,7 @@ void XnExportedSensorDevice::Destroy(xn::ModuleProductionNode* pInstance)
 	}
 	XnContext* pContext = pDevice->GetContext().GetUnderlyingObject();
 	CreatedDevices::Iterator it = FindCreatedDevice(pContext, strConnStr);
-	if (it == m_createdDevices.End())
+	if (it == m_createdDevices.end())
 	{
 		xnLogWarning(XN_MASK_DEVICE_SENSOR, "Couldn't find device in created devices ?! :(");
 		XN_ASSERT(FALSE);
@@ -240,8 +238,8 @@ XnExportedSensorDevice::DeviceKey::DeviceKey(XnContext* pContext, const XnChar*
 XnExportedSensorDevice::CreatedDevices::Iterator XnExportedSensorDevice::FindCreatedDevice(XnContext* pContext, 
 																                           const XnChar* strConnStr)
 {
-	CreatedDevices::Iterator it = m_createdDevices.Begin();
-	for (; it != m_createdDevices.End(); it++)
+	CreatedDevices::Iterator it = m_createdDevices.begin();
+	for (; it != m_createdDevices.end(); it++)
 	{
 		if ((it->m_pContext == pContext) && 
 			 (xnOSStrCmp(it->m_strConnStr, strConnStr) == 0))
diff --git a/Source/XnDeviceSensorV2/XnExportedSensorDevice.h b/Source/XnDeviceSensorV2/XnExportedSensorDevice.h
index 953d16c..96a8d46 100644
--- a/Source/XnDeviceSensorV2/XnExportedSensorDevice.h
+++ b/Source/XnDeviceSensorV2/XnExportedSensorDevice.h
@@ -25,9 +25,8 @@
 //---------------------------------------------------------------------------
 // Includes
 //---------------------------------------------------------------------------
-#include "XnSensor.h"
 #include <XnModuleCppInterface.h>
-#include <XnListT.h>
+#include "XnSensor.h"
 
 //---------------------------------------------------------------------------
 // Types
@@ -45,18 +44,16 @@ public:
 private:
 	struct DeviceKey
 	{
-		DeviceKey() {}
 		DeviceKey(XnContext* pContext, const XnChar* strConnStr);
-
 		XnContext* m_pContext;
 		XnChar m_strConnStr[XN_MAX_CREATION_INFO_LENGTH]; 
 	};
 
-	typedef XnListT<DeviceKey> CreatedDevices;
-
-	CreatedDevices::Iterator FindCreatedDevice(XnContext* pContext, const XnChar* strConnStr);
 
+	XN_DECLARE_LIST(DeviceKey, CreatedDevices);
 	CreatedDevices m_createdDevices;
+
+	CreatedDevices::Iterator FindCreatedDevice(XnContext* pContext, const XnChar* strConnStr);
 };
 
 #endif // __XN_EXPORTED_SENSOR_DEVICE_H__
\ No newline at end of file
diff --git a/Source/XnDeviceSensorV2/XnExportedSensorGenerator.cpp b/Source/XnDeviceSensorV2/XnExportedSensorGenerator.cpp
index e874797..8224788 100644
--- a/Source/XnDeviceSensorV2/XnExportedSensorGenerator.cpp
+++ b/Source/XnDeviceSensorV2/XnExportedSensorGenerator.cpp
@@ -26,7 +26,7 @@
 #include "XnExportedSensorDevice.h"
 #include <XnOpenNI.h>
 #include "XnSensorGenerator.h"
-#include <XnCommon.h>
+#include <XnCommon/XnCommon.h>
 
 //---------------------------------------------------------------------------
 // XnExportedSensorGenerator class
diff --git a/Source/XnDeviceSensorV2/XnFirmwareInfo.h b/Source/XnDeviceSensorV2/XnFirmwareInfo.h
index 21119e3..a56483c 100644
--- a/Source/XnDeviceSensorV2/XnFirmwareInfo.h
+++ b/Source/XnDeviceSensorV2/XnFirmwareInfo.h
@@ -26,7 +26,6 @@
 // Includes
 //---------------------------------------------------------------------------
 #include <XnStreamParams.h>
-#include <XnArray.h>
 
 //---------------------------------------------------------------------------
 // Types
@@ -43,8 +42,6 @@ public:
 	XnParamCurrentMode nCurrMode;
 
 	XnBool bAudioSupported;
-	XnBool bGetPresetsSupported;
-	XnBool bDeviceInfoSupported;
 
 	XnUInt16 nOpcodeGetVersion;
 	XnUInt16 nOpcodeKeepAlive;
@@ -60,14 +57,6 @@ public:
 	XnUInt16 nOpcodeGetCmosPresets;
 	XnUInt16 nOpcodeGetSerialNumber;
 	XnUInt16 nOpcodeGetFastConvergenceTEC;
-	XnUInt16 nOpcodeGetCMOSReg;
-	XnUInt16 nOpcodeSetCMOSReg;
-	XnUInt16 nOpcodeWriteI2C;
-	XnUInt16 nOpcodeReadI2C;
-	XnUInt16 nOpcodeReadAHB;
-	XnUInt16 nOpcodeWriteAHB;
-	XnUInt16 nOpcodeGetPlatformString;
-	XnUInt16 nOpcodeGetUsbCore;
 
 
 	XnBool bMirrorSupported;
@@ -83,14 +72,6 @@ public:
 
 	XnUInt8 nISOAlternativeInterface;
 	XnUInt8 nBulkAlternativeInterface;
-
-	XnBool bGetImageCmosTypeSupported;
-	XnBool bImageSupported;
-
-	XnArray<XnCmosPreset> depthModes;
-	XnArray<XnCmosPreset> imageBulkModes;
-	XnArray<XnCmosPreset> imageIsoModes;
-	XnArray<XnCmosPreset> irModes;
 };
 
 #endif //__XN_FIRMWARE_INFO_H__
\ No newline at end of file
diff --git a/Source/XnDeviceSensorV2/XnFirmwareStreams.cpp b/Source/XnDeviceSensorV2/XnFirmwareStreams.cpp
index e70270d..eb2e45d 100644
--- a/Source/XnDeviceSensorV2/XnFirmwareStreams.cpp
+++ b/Source/XnDeviceSensorV2/XnFirmwareStreams.cpp
@@ -87,7 +87,7 @@ XnStatus XnFirmwareStreams::CheckClaimStream(const XnChar* strType, XnResolution
 	XnStatus nRetVal = XN_STATUS_OK;
 	
 	// first of all, make sure this stream isn't claimed already
-	XnFirmwareStreamData* pStreamData = NULL;
+	XnFirmwareStreamData* pStreamData;
 	nRetVal = m_FirmwareStreams.Get(strType, pStreamData);
 	XN_IS_STATUS_OK(nRetVal);
 
@@ -99,7 +99,7 @@ XnStatus XnFirmwareStreams::CheckClaimStream(const XnChar* strType, XnResolution
 	if (strcmp(strType, XN_STREAM_TYPE_DEPTH) == 0)
 	{
 		// check if IR stream is configured
-		XnFirmwareStreamData* pIRStreamData = NULL;
+		XnFirmwareStreamData* pIRStreamData;
 		nRetVal = m_FirmwareStreams.Get(XN_STREAM_TYPE_IR, pIRStreamData);
 		XN_IS_STATUS_OK(nRetVal);
 
@@ -121,7 +121,7 @@ XnStatus XnFirmwareStreams::CheckClaimStream(const XnChar* strType, XnResolution
 	else if (strcmp(strType, XN_STREAM_TYPE_IR) == 0)
 	{
 		// check if image is configured
-		XnFirmwareStreamData* pImageStreamData = NULL;
+		XnFirmwareStreamData* pImageStreamData;
 		nRetVal = m_FirmwareStreams.Get(XN_STREAM_TYPE_IMAGE, pImageStreamData);
 		XN_IS_STATUS_OK(nRetVal);
 
@@ -131,7 +131,7 @@ XnStatus XnFirmwareStreams::CheckClaimStream(const XnChar* strType, XnResolution
 		}
 
 		// check if depth is configured
-		XnFirmwareStreamData* pDepthStreamData = NULL;
+		XnFirmwareStreamData* pDepthStreamData;
 		nRetVal = m_FirmwareStreams.Get(XN_STREAM_TYPE_DEPTH, pDepthStreamData);
 		XN_IS_STATUS_OK(nRetVal);
 
@@ -140,10 +140,7 @@ XnStatus XnFirmwareStreams::CheckClaimStream(const XnChar* strType, XnResolution
 			// check res
 			if (pDepthStreamData->nRes != nRes && (nRes != XN_RESOLUTION_SXGA || pDepthStreamData->nRes != XN_RESOLUTION_VGA))
 			{
-				if (m_pDevicePrivateData->FWInfo.nFWVer < XN_SENSOR_FW_VER_5_6) 
-				{
-					XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "Cannot set IR stream to resolution %d when Depth is set to resolution %d!", nRes, pDepthStreamData->nRes);
-				}
+				XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "Cannot set IR stream to resolution %d when Depth is set to resolution %d!", nRes, pDepthStreamData->nRes);
 			}
 
 			// check FPS
@@ -178,7 +175,7 @@ XnStatus XnFirmwareStreams::ClaimStream(const XnChar* strType, XnResolutions nRe
 	XN_IS_STATUS_OK(nRetVal);
 
 	// get stream data
-	XnFirmwareStreamData* pData = NULL;
+	XnFirmwareStreamData* pData;
 	nRetVal = m_FirmwareStreams.Get(strType, pData);
 	XN_IS_STATUS_OK(nRetVal);
 
@@ -197,7 +194,7 @@ XnStatus XnFirmwareStreams::ReleaseStream(const XnChar* strType, XnDeviceStream*
 	XnStatus nRetVal = XN_STATUS_OK;
 
 	// get stream data
-	XnFirmwareStreamData* pData = NULL;
+	XnFirmwareStreamData* pData;
 	nRetVal = m_FirmwareStreams.Get(strType, pData);
 	XN_IS_STATUS_OK(nRetVal);
 
@@ -220,7 +217,7 @@ XnStatus XnFirmwareStreams::LockStreamProcessor(const XnChar* strType, XnDeviceS
 	XnStatus nRetVal = XN_STATUS_OK;
 
 	// get stream data
-	XnFirmwareStreamData* pData = NULL;
+	XnFirmwareStreamData* pData;
 	nRetVal = m_FirmwareStreams.Get(strType, pData);
 	XN_IS_STATUS_OK(nRetVal);
 
@@ -239,7 +236,7 @@ XnStatus XnFirmwareStreams::UnlockStreamProcessor(const XnChar* strType, XnDevic
 	XnStatus nRetVal = XN_STATUS_OK;
 
 	// get stream data
-	XnFirmwareStreamData* pData = NULL;
+	XnFirmwareStreamData* pData;
 	nRetVal = m_FirmwareStreams.Get(strType, pData);
 	XN_IS_STATUS_OK(nRetVal);
 
@@ -258,7 +255,7 @@ XnStatus XnFirmwareStreams::ReplaceStreamProcessor(const XnChar* strType, XnDevi
 	XnStatus nRetVal = XN_STATUS_OK;
 
 	// get stream data
-	XnFirmwareStreamData* pData = NULL;
+	XnFirmwareStreamData* pData;
 	nRetVal = m_FirmwareStreams.Get(strType, pData);
 	XN_IS_STATUS_OK(nRetVal);
 
diff --git a/Source/XnDeviceSensorV2/XnFirmwareStreams.h b/Source/XnDeviceSensorV2/XnFirmwareStreams.h
index 3e6c6a8..49b2e58 100644
--- a/Source/XnDeviceSensorV2/XnFirmwareStreams.h
+++ b/Source/XnDeviceSensorV2/XnFirmwareStreams.h
@@ -26,7 +26,7 @@
 // Includes
 //---------------------------------------------------------------------------
 #include "XnDataProcessorHolder.h"
-#include <XnStringsHashT.h>
+#include <XnStringsHash.h>
 #include <XnDDK/XnDeviceStream.h>
 
 //---------------------------------------------------------------------------
@@ -69,7 +69,7 @@ private:
 		XnDeviceStream* pOwner;
 	};
 
-	typedef XnStringsHashT<XnFirmwareStreamData> XnFirmwareStreamsHash;
+	XN_DECLARE_STRINGS_HASH(XnFirmwareStreamData, XnFirmwareStreamsHash)
 
 	XnFirmwareStreamsHash m_FirmwareStreams;
 
diff --git a/Source/XnDeviceSensorV2/XnFrameStreamProcessor.cpp b/Source/XnDeviceSensorV2/XnFrameStreamProcessor.cpp
index 485cc12..79d8178 100644
--- a/Source/XnDeviceSensorV2/XnFrameStreamProcessor.cpp
+++ b/Source/XnDeviceSensorV2/XnFrameStreamProcessor.cpp
@@ -23,23 +23,21 @@
 // Includes
 //---------------------------------------------------------------------------
 #include "XnFrameStreamProcessor.h"
-#include "XnSensor.h"
 #include <XnProfiling.h>
 
 //---------------------------------------------------------------------------
 // Code
 //---------------------------------------------------------------------------
-XnFrameStreamProcessor::XnFrameStreamProcessor(XnFrameStream* pStream, XnSensorStreamHelper* pHelper, XnFrameBufferManager* pBufferManager, XnUInt16 nTypeSOF, XnUInt16 nTypeEOF) :
+XnFrameStreamProcessor::XnFrameStreamProcessor(XnFrameStream* pStream, XnSensorStreamHelper* pHelper, XnUInt16 nTypeSOF, XnUInt16 nTypeEOF) :
 	XnStreamProcessor(pStream, pHelper),
 	m_nTypeSOF(nTypeSOF),
 	m_nTypeEOF(nTypeEOF),
-	m_pTripleBuffer(pBufferManager),
+	m_pTripleBuffer(pStream->GetTripleBuffer()),
 	m_InDump(NULL),
 	m_InternalDump(NULL),
 	m_bFrameCorrupted(FALSE),
 	m_bAllowDoubleSOF(FALSE),
-	m_nLastSOFPacketID(0),
-	m_nFirstPacketTimestamp(0)
+	m_nLastSOFPacketID(0)
 {
 	sprintf(m_csInDumpMask, "%sIn", pStream->GetType());
 	sprintf(m_csInternalDumpMask, "Internal%s", pStream->GetType());
@@ -89,10 +87,6 @@ void XnFrameStreamProcessor::OnStartOfFrame(const XnSensorProtocolResponseHeader
 {
 	m_bFrameCorrupted = FALSE;
 	m_pTripleBuffer->GetWriteBuffer()->Reset();
-	if (m_pDevicePrivateData->pSensor->ShouldUseHostTimestamps())
-	{
-		m_nFirstPacketTimestamp = GetHostTimestamp();
-	}
 }
 
 void XnFrameStreamProcessor::OnEndOfFrame(const XnSensorProtocolResponseHeader* pHeader)
@@ -106,18 +100,7 @@ void XnFrameStreamProcessor::OnEndOfFrame(const XnSensorProtocolResponseHeader*
 	if (!m_bFrameCorrupted)
 	{
 		// mark the buffer as stable
-		XnUInt64 nTimestamp;
-		if (m_pDevicePrivateData->pSensor->ShouldUseHostTimestamps())
-		{
-			// use the host timestamp of the first packet
-			nTimestamp = m_nFirstPacketTimestamp;
-		}
-		else
-		{
-			// use timestamp in last packet
-			nTimestamp = CreateTimestampFromDevice(pHeader->nTimeStamp);
-		}
-		
+		XnUInt64 nTimestamp = GetTimeStamp(pHeader->nTimeStamp);
 		XnUInt32 nFrameID;
 		m_pTripleBuffer->MarkWriteBufferAsStable(nTimestamp, &nFrameID);
 
diff --git a/Source/XnDeviceSensorV2/XnFrameStreamProcessor.h b/Source/XnDeviceSensorV2/XnFrameStreamProcessor.h
index 4d8d406..c917e5a 100644
--- a/Source/XnDeviceSensorV2/XnFrameStreamProcessor.h
+++ b/Source/XnDeviceSensorV2/XnFrameStreamProcessor.h
@@ -46,7 +46,7 @@ public:
 	* @param	nTypeSOF			[in]	The packet type that signifies start-of-frame.
 	* @param	nTypeEOF			[in]	The packet type that signifies end-of-frame.
 	*/
-	XnFrameStreamProcessor(XnFrameStream* pStream, XnSensorStreamHelper* pHelper, XnFrameBufferManager* pBufferManager, XnUInt16 nTypeSOF, XnUInt16 nTypeEOF);
+	XnFrameStreamProcessor(XnFrameStream* pStream, XnSensorStreamHelper* pHelper, XnUInt16 nTypeSOF, XnUInt16 nTypeEOF);
 
 	/** 
 	* Destroys a frame-based stream processor
@@ -173,7 +173,6 @@ private:
 	XnBool m_bFrameCorrupted;
 	XnBool m_bAllowDoubleSOF;
 	XnUInt16 m_nLastSOFPacketID;
-	XnUInt64 m_nFirstPacketTimestamp;
 };
 
 #endif //__XN_FRAME_STREAM_PROCESSOR_H__
diff --git a/Source/XnDeviceSensorV2/XnHostProtocol.cpp b/Source/XnDeviceSensorV2/XnHostProtocol.cpp
index 158d1b6..c080369 100644
--- a/Source/XnDeviceSensorV2/XnHostProtocol.cpp
+++ b/Source/XnDeviceSensorV2/XnHostProtocol.cpp
@@ -45,229 +45,76 @@
 
 #define MAX_PACKET_SIZE 512
 
-inline XnInt32 CompareVersion(XnUInt8 nMajor1, XnUInt8 nMinor1, XnUInt16 nBuild1, XnUInt8 nMajor2, XnUInt8 nMinor2, XnUInt16 nBuild2)
+XnStatus XnHostProtocolInitFWParams(XnDevicePrivateData* pDevicePrivateData, XnFWVer nFWVer)
 {
-	XnInt32 nResult = nMajor1 - nMajor2;
+	XnStatus nRetVal = XN_STATUS_OK;
 
-	if (nResult == 0)
+	switch (nFWVer)
 	{
-		nResult = nMinor1 - nMinor2;
-	}
+	case XN_SENSOR_FW_VER_5_6:
+		nRetVal = XnHostProtocolInitFWParams(pDevicePrivateData, XN_SENSOR_FW_VER_5_5);
+		XN_IS_STATUS_OK(nRetVal);
 
-	if (nResult == 0)
-	{
-		nResult = nBuild1 - nBuild2;
-	}
+		// audio is no longer supported - switched to UAC
+		pDevicePrivateData->FWInfo.bAudioSupported = FALSE;
 
-	return (nResult);
-}
+		pDevicePrivateData->FWInfo.nFWVer = nFWVer;
+		break;
 
-static XnFWVer GetFWVersion(XnUInt8 nMajor, XnUInt8 nMinor, XnUInt16 nBuild)
-{
-	if (CompareVersion(nMajor, nMinor, nBuild, 5, 7, 0) >= 0)
-	{
-		return XN_SENSOR_FW_VER_5_7;
-	}
-	if (CompareVersion(nMajor, nMinor, nBuild, 5, 6, 0) >= 0)
-	{
-		return XN_SENSOR_FW_VER_5_6;
-	}
-	else if (CompareVersion(nMajor, nMinor, nBuild, 5, 5, 0) >= 0)
-	{
-		return XN_SENSOR_FW_VER_5_5;
-	}
-	else if (CompareVersion(nMajor, nMinor, nBuild, 5, 4, 0) >= 0)
-	{
-		return XN_SENSOR_FW_VER_5_4;
-	}
-	else if (CompareVersion(nMajor, nMinor, nBuild, 5, 3, 0) >= 0)
-	{
-		return XN_SENSOR_FW_VER_5_3;
-	}
-	else if (CompareVersion(nMajor, nMinor, nBuild, 5, 2, 0) >= 0)
-	{
-		return XN_SENSOR_FW_VER_5_2;
-	}
-	else if (CompareVersion(nMajor, nMinor, nBuild, 5, 1, 0) >= 0)
-	{
-		return XN_SENSOR_FW_VER_5_1;
-	}
-	else if (CompareVersion(nMajor, nMinor, nBuild, 5, 0, 0) >= 0)
-	{
-		return XN_SENSOR_FW_VER_5_0;
-	}
-	else if (CompareVersion(nMajor, nMinor, nBuild, 4, 0, 0) >= 0)
-	{
-		return XN_SENSOR_FW_VER_4_0;
-	}
-	else if (CompareVersion(nMajor, nMinor, nBuild, 3, 0, 0) >= 0)
-	{
-		return XN_SENSOR_FW_VER_3_0;
-	}
-	else if (CompareVersion(nMajor, nMinor, nBuild, 1, 2, 0) >= 0)
-	{
-		return XN_SENSOR_FW_VER_1_2;
-	}
-	else if (CompareVersion(nMajor, nMinor, nBuild, 1, 2, 0) >= 0)
-	{
-		return XN_SENSOR_FW_VER_1_2;
-	}
-	else if (CompareVersion(nMajor, nMinor, nBuild, 1, 1, 0) >= 0)
-	{
-		return XN_SENSOR_FW_VER_1_1;
-	}
-	else
-	{
-		return XN_SENSOR_FW_VER_0_17;
-	}
-}
+	case XN_SENSOR_FW_VER_5_5:
+		nRetVal = XnHostProtocolInitFWParams(pDevicePrivateData, XN_SENSOR_FW_VER_5_4);
+		XN_IS_STATUS_OK(nRetVal);
 
-XnStatus XnHostProtocolInitFWParams(XnDevicePrivateData* pDevicePrivateData, XnUInt8 nMajor, XnUInt8 nMinor, XnUInt16 nBuild, XnHostProtocolUsbCore usb)
-{
-	XnStatus nRetVal = XN_STATUS_OK;
+		// only difference is the interfaces order
+		pDevicePrivateData->FWInfo.nBulkAlternativeInterface = 0;
+		pDevicePrivateData->FWInfo.nISOAlternativeInterface = 1;
 
-	// we start with oldest settings (FW version 0.17), and change them for newer versions
-	pDevicePrivateData->FWInfo.nFWMagic = XN_FW_MAGIC_25;
-	pDevicePrivateData->FWInfo.nHostMagic = XN_HOST_MAGIC_25;
-	pDevicePrivateData->FWInfo.nProtocolHeaderSize = sizeof(XnHostProtocolHeaderV25);
-	pDevicePrivateData->FWInfo.nProtocolMaxPacketSize = XN_PROTOCOL_MAX_PACKET_SIZE_V0_17;
-	pDevicePrivateData->FWInfo.bAudioSupported = FALSE;
-	pDevicePrivateData->FWInfo.bMirrorSupported = FALSE;
-	pDevicePrivateData->FWInfo.bGetPresetsSupported = FALSE;
-	pDevicePrivateData->FWInfo.bDeviceInfoSupported = FALSE;
-
-	pDevicePrivateData->FWInfo.nOpcodeGetVersion = OPCODE_V017_GET_VERSION;
-	pDevicePrivateData->FWInfo.nOpcodeKeepAlive = OPCODE_V017_KEEP_ALIVE;
-	pDevicePrivateData->FWInfo.nOpcodeGetParam = OPCODE_V017_GET_PARAM;
-	pDevicePrivateData->FWInfo.nOpcodeSetParam = OPCODE_V017_SET_PARAM;
-	pDevicePrivateData->FWInfo.nOpcodeGetFixedParams = OPCODE_V017_GET_FIXED_PARAMS;
-	pDevicePrivateData->FWInfo.nOpcodeGetMode = OPCODE_INVALID;
-	pDevicePrivateData->FWInfo.nOpcodeSetMode = OPCODE_INVALID;
-	pDevicePrivateData->FWInfo.nOpcodeAlgorithmParams = OPCODE_V017_ALGORITM_PARAMS;
-	pDevicePrivateData->FWInfo.nOpcodeReset = OPCODE_V017_RESET;
-	pDevicePrivateData->FWInfo.nOpcodeSetCmosBlanking = OPCODE_INVALID;
-	pDevicePrivateData->FWInfo.nOpcodeGetCmosBlanking = OPCODE_INVALID;
-	pDevicePrivateData->FWInfo.nOpcodeGetCmosPresets = OPCODE_INVALID;
-	pDevicePrivateData->FWInfo.nOpcodeGetSerialNumber = OPCODE_INVALID;
-	pDevicePrivateData->FWInfo.nOpcodeGetFastConvergenceTEC = OPCODE_INVALID;
-	pDevicePrivateData->FWInfo.nOpcodeGetCMOSReg = OPCODE_V017_GET_CMOS_REGISTER;
-	pDevicePrivateData->FWInfo.nOpcodeSetCMOSReg = OPCODE_V017_SET_CMOS_REGISTER;
-	pDevicePrivateData->FWInfo.nOpcodeWriteI2C = OPCODE_INVALID;
-	pDevicePrivateData->FWInfo.nOpcodeReadI2C = OPCODE_INVALID;
-	pDevicePrivateData->FWInfo.nOpcodeReadAHB = OPCODE_V017_READ_AHB;
-	pDevicePrivateData->FWInfo.nOpcodeWriteAHB = OPCODE_V017_WRITE_AHB;
-	pDevicePrivateData->FWInfo.nOpcodeGetPlatformString = OPCODE_INVALID;
-	pDevicePrivateData->FWInfo.nOpcodeGetUsbCore = OPCODE_GET_USB_CORE_TYPE;
-
-
-	pDevicePrivateData->FWInfo.nUSBDelayReceive = 100;
-	pDevicePrivateData->FWInfo.nUSBDelayExecutePreSend = 1;
-	pDevicePrivateData->FWInfo.nUSBDelayExecutePostSend = 10;
-	pDevicePrivateData->FWInfo.nUSBDelaySoftReset = 800;
-	pDevicePrivateData->FWInfo.nUSBDelaySetParamFlicker = 3000;
-	pDevicePrivateData->FWInfo.nUSBDelaySetParamStream0Mode = 1;
-	pDevicePrivateData->FWInfo.nUSBDelaySetParamStream1Mode = 300;
-	pDevicePrivateData->FWInfo.nUSBDelaySetParamStream2Mode = 1;
-
-	pDevicePrivateData->FWInfo.bGetImageCmosTypeSupported = FALSE;
-	pDevicePrivateData->FWInfo.bImageSupported = TRUE;
-
-	// depth cmos modes
-	pDevicePrivateData->FWInfo.depthModes.Clear();
-	XnCmosPreset depthModes[] = 
-	{
-		{ XN_IO_DEPTH_FORMAT_COMPRESSED_PS, XN_RESOLUTION_QVGA, 30 },
-		{ XN_IO_DEPTH_FORMAT_COMPRESSED_PS, XN_RESOLUTION_QVGA, 60 },
-		{ XN_IO_DEPTH_FORMAT_COMPRESSED_PS, XN_RESOLUTION_VGA, 30 },
-		{ XN_IO_DEPTH_FORMAT_UNCOMPRESSED_11_BIT, XN_RESOLUTION_QVGA, 30 },
-		{ XN_IO_DEPTH_FORMAT_UNCOMPRESSED_11_BIT, XN_RESOLUTION_QVGA, 60 },
-		{ XN_IO_DEPTH_FORMAT_UNCOMPRESSED_11_BIT, XN_RESOLUTION_VGA, 30 },
-		{ XN_IO_DEPTH_FORMAT_UNCOMPRESSED_12_BIT, XN_RESOLUTION_QVGA, 30 },
-		{ XN_IO_DEPTH_FORMAT_UNCOMPRESSED_12_BIT, XN_RESOLUTION_QVGA, 60 },
-		{ XN_IO_DEPTH_FORMAT_UNCOMPRESSED_12_BIT, XN_RESOLUTION_VGA, 30 },
-		{ XN_IO_DEPTH_FORMAT_UNCOMPRESSED_16_BIT, XN_RESOLUTION_QVGA, 30 },
-		{ XN_IO_DEPTH_FORMAT_UNCOMPRESSED_16_BIT, XN_RESOLUTION_QVGA, 60 },
-		{ XN_IO_DEPTH_FORMAT_UNCOMPRESSED_16_BIT, XN_RESOLUTION_VGA, 30 },
-	};
-	nRetVal = pDevicePrivateData->FWInfo.depthModes.AddLast(depthModes, sizeof(depthModes)/sizeof(depthModes[0]));
-	XN_IS_STATUS_OK(nRetVal);
+		pDevicePrivateData->FWInfo.nFWVer = nFWVer;
+		break;
 
-	// image cmos modes
-	pDevicePrivateData->FWInfo.imageBulkModes.Clear();
-	pDevicePrivateData->FWInfo.imageIsoModes.Clear();
+	case XN_SENSOR_FW_VER_5_4:
+		nRetVal = XnHostProtocolInitFWParams(pDevicePrivateData, XN_SENSOR_FW_VER_5_3);
+		XN_IS_STATUS_OK(nRetVal);
 
-	XnCmosPreset imageCommonModes[] =
-	{
-		{ XN_IO_IMAGE_FORMAT_YUV422, XN_RESOLUTION_QVGA, 30 },
-		{ XN_IO_IMAGE_FORMAT_YUV422, XN_RESOLUTION_QVGA, 60 },
-		{ XN_IO_IMAGE_FORMAT_YUV422, XN_RESOLUTION_VGA, 30 },
-	};
-	nRetVal = pDevicePrivateData->FWInfo.imageBulkModes.AddLast(imageCommonModes, sizeof(imageCommonModes)/sizeof(imageCommonModes[0]));
-	XN_IS_STATUS_OK(nRetVal);
-	nRetVal = pDevicePrivateData->FWInfo.imageIsoModes.AddLast(imageCommonModes, sizeof(imageCommonModes)/sizeof(imageCommonModes[0]));
-	XN_IS_STATUS_OK(nRetVal);
+		pDevicePrivateData->FWInfo.nOpcodeGetCmosPresets = OPCODE_GET_CMOS_PRESETS;
+		pDevicePrivateData->FWInfo.nOpcodeGetSerialNumber = OPCODE_GET_SERIAL_NUMBER;
+		pDevicePrivateData->FWInfo.nOpcodeGetFastConvergenceTEC= OPCODE_GET_FAST_CONVERGENCE_TEC;
 
-	XnCmosPreset imageIsoModes[] =
-	{
-		{ XN_IO_IMAGE_FORMAT_UNCOMPRESSED_YUV422, XN_RESOLUTION_QVGA, 30 },
-		{ XN_IO_IMAGE_FORMAT_UNCOMPRESSED_YUV422, XN_RESOLUTION_QVGA, 60 },
-		{ XN_IO_IMAGE_FORMAT_UNCOMPRESSED_YUV422, XN_RESOLUTION_VGA, 30 },
-	};
-	nRetVal = pDevicePrivateData->FWInfo.imageIsoModes.AddLast(imageIsoModes, sizeof(imageIsoModes)/sizeof(imageIsoModes[0]));
-	XN_IS_STATUS_OK(nRetVal);
+		pDevicePrivateData->FWInfo.nFWVer = nFWVer;
+		break;
 
-	// IR cmos modes
-	pDevicePrivateData->FWInfo.irModes.Clear();
-	XnCmosPreset irModes[] = 
-	{
-		{ 0, XN_RESOLUTION_QVGA, 30 },
-		{ 0, XN_RESOLUTION_QVGA, 60 },
-		{ 0, XN_RESOLUTION_VGA, 30 },
-		{ 0, XN_RESOLUTION_SXGA, 30 },
-	};
-	nRetVal = pDevicePrivateData->FWInfo.irModes.AddLast(irModes, sizeof(irModes)/sizeof(irModes[0]));
-	XN_IS_STATUS_OK(nRetVal);
+	case XN_SENSOR_FW_VER_5_3:
+		nRetVal = XnHostProtocolInitFWParams(pDevicePrivateData, XN_SENSOR_FW_VER_5_2);
+		XN_IS_STATUS_OK(nRetVal);
 
-	if (CompareVersion(nMajor, nMinor, nBuild, 1, 1, 0) >= 0)
-	{
-		// opcodes were changed
-		pDevicePrivateData->FWInfo.nOpcodeGetVersion = OPCODE_V110_GET_VERSION;
-		pDevicePrivateData->FWInfo.nOpcodeKeepAlive = OPCODE_V110_KEEP_ALIVE;
-		pDevicePrivateData->FWInfo.nOpcodeGetParam = OPCODE_V110_GET_PARAM;
-		pDevicePrivateData->FWInfo.nOpcodeSetParam = OPCODE_V110_SET_PARAM;
-		pDevicePrivateData->FWInfo.nOpcodeGetFixedParams = OPCODE_V110_GET_FIXED_PARAMS;
-		pDevicePrivateData->FWInfo.nOpcodeGetMode = OPCODE_V110_GET_MODE;
-		pDevicePrivateData->FWInfo.nOpcodeSetMode = OPCODE_V110_SET_MODE;
-		pDevicePrivateData->FWInfo.nOpcodeAlgorithmParams = OPCODE_V110_ALGORITHM_PARAMS;
-		pDevicePrivateData->FWInfo.nOpcodeReset = OPCODE_INVALID;
-		pDevicePrivateData->FWInfo.nOpcodeSetCmosBlanking = OPCODE_INVALID;
-		pDevicePrivateData->FWInfo.nOpcodeGetCmosBlanking = OPCODE_INVALID;
-		pDevicePrivateData->FWInfo.nOpcodeGetCmosPresets = OPCODE_INVALID;
-		pDevicePrivateData->FWInfo.nOpcodeGetSerialNumber = OPCODE_INVALID;
-		pDevicePrivateData->FWInfo.nOpcodeGetFastConvergenceTEC = OPCODE_INVALID;
-		pDevicePrivateData->FWInfo.nOpcodeGetCMOSReg = OPCODE_V110_GET_CMOS_REGISTER;
-		pDevicePrivateData->FWInfo.nOpcodeSetCMOSReg = OPCODE_V110_SET_CMOS_REGISTER;
-		pDevicePrivateData->FWInfo.nOpcodeWriteI2C = OPCODE_INVALID;
-		pDevicePrivateData->FWInfo.nOpcodeReadI2C = OPCODE_INVALID;
-		pDevicePrivateData->FWInfo.nOpcodeReadAHB = OPCODE_V110_READ_AHB;
-		pDevicePrivateData->FWInfo.nOpcodeWriteAHB = OPCODE_V110_WRITE_AHB;
+		pDevicePrivateData->FWInfo.nFWVer = nFWVer;
+		break;
 
-	}
+	case XN_SENSOR_FW_VER_5_2:
+		nRetVal = XnHostProtocolInitFWParams(pDevicePrivateData, XN_SENSOR_FW_VER_5_1);
+		XN_IS_STATUS_OK(nRetVal);
 
-	if (CompareVersion(nMajor, nMinor, nBuild, 1, 2, 0) >= 0)
-	{
-		// protocol header was changed
+		pDevicePrivateData->FWInfo.nFWVer = nFWVer;
+		break;
+
+	case XN_SENSOR_FW_VER_5_1:
+		nRetVal = XnHostProtocolInitFWParams(pDevicePrivateData, XN_SENSOR_FW_VER_5_0);
+		XN_IS_STATUS_OK(nRetVal);
+
+		pDevicePrivateData->FWInfo.nOpcodeGetCmosBlanking = OPCODE_GET_CMOS_BLANKING;
+		pDevicePrivateData->FWInfo.nFWVer = nFWVer;
+		break;
+
+	case XN_SENSOR_FW_VER_5_0:
+		pDevicePrivateData->FWInfo.nFWVer = nFWVer;
 		pDevicePrivateData->FWInfo.nFWMagic = XN_FW_MAGIC_26;
 		pDevicePrivateData->FWInfo.nHostMagic = XN_HOST_MAGIC_26;
 		pDevicePrivateData->FWInfo.nProtocolHeaderSize = sizeof(XnHostProtocolHeaderV26);
-	}
-
-	if (CompareVersion(nMajor, nMinor, nBuild, 3, 0, 0) >= 0)
-	{
-		// audio support!
+		pDevicePrivateData->FWInfo.nProtocolMaxPacketSize = XN_PROTOCOL_MAX_PACKET_SIZE_V5_0;
 		pDevicePrivateData->FWInfo.bAudioSupported = TRUE;
 
-		// opcodes were changed
+		pDevicePrivateData->FWInfo.bMirrorSupported = TRUE;
+
 		pDevicePrivateData->FWInfo.nOpcodeGetVersion = OPCODE_GET_VERSION;
 		pDevicePrivateData->FWInfo.nOpcodeKeepAlive = OPCODE_KEEP_ALIVE;
 		pDevicePrivateData->FWInfo.nOpcodeGetParam = OPCODE_GET_PARAM;
@@ -277,212 +124,153 @@ XnStatus XnHostProtocolInitFWParams(XnDevicePrivateData* pDevicePrivateData, XnU
 		pDevicePrivateData->FWInfo.nOpcodeSetMode = OPCODE_SET_MODE;
 		pDevicePrivateData->FWInfo.nOpcodeAlgorithmParams = OPCODE_ALGORITM_PARAMS;
 		pDevicePrivateData->FWInfo.nOpcodeReset = OPCODE_INVALID;
-		pDevicePrivateData->FWInfo.nOpcodeSetCmosBlanking = OPCODE_INVALID;
+		pDevicePrivateData->FWInfo.nOpcodeSetCmosBlanking = OPCODE_SET_CMOS_BLANKING;
 		pDevicePrivateData->FWInfo.nOpcodeGetCmosBlanking = OPCODE_INVALID;
 		pDevicePrivateData->FWInfo.nOpcodeGetCmosPresets = OPCODE_INVALID;
 		pDevicePrivateData->FWInfo.nOpcodeGetSerialNumber = OPCODE_INVALID;
 		pDevicePrivateData->FWInfo.nOpcodeGetFastConvergenceTEC = OPCODE_INVALID;
-		pDevicePrivateData->FWInfo.nOpcodeGetCMOSReg = OPCODE_INVALID;
-		pDevicePrivateData->FWInfo.nOpcodeSetCMOSReg = OPCODE_INVALID;
-		pDevicePrivateData->FWInfo.nOpcodeWriteI2C = OPCODE_I2C_WRITE;
-		pDevicePrivateData->FWInfo.nOpcodeReadI2C = OPCODE_I2C_READ;
-		pDevicePrivateData->FWInfo.nOpcodeReadAHB = OPCODE_READ_AHB;
-		pDevicePrivateData->FWInfo.nOpcodeWriteAHB = OPCODE_WRITE_AHB;
-
-	}
-
-	if (CompareVersion(nMajor, nMinor, nBuild, 4, 0, 0) >= 0)
-	{
-		// audio removed...
-		pDevicePrivateData->FWInfo.bAudioSupported = FALSE;
 
-	}
-
-	if (CompareVersion(nMajor, nMinor, nBuild, 5, 0, 0) >= 0)
-	{
-		// max packet size changed
-		pDevicePrivateData->FWInfo.nProtocolMaxPacketSize = XN_PROTOCOL_MAX_PACKET_SIZE_V5_0;
-		// audio is back on
-		pDevicePrivateData->FWInfo.bAudioSupported = TRUE;
-		// mirror supported
-		pDevicePrivateData->FWInfo.bMirrorSupported = TRUE;
-
-		// opcodes changes
-		pDevicePrivateData->FWInfo.nOpcodeSetCmosBlanking = OPCODE_SET_CMOS_BLANKING;
-
-		// ISO endpoints interface was added
 		pDevicePrivateData->FWInfo.nISOAlternativeInterface = 0;
 		pDevicePrivateData->FWInfo.nBulkAlternativeInterface = 1;
-	}
-
-	if (CompareVersion(nMajor, nMinor, nBuild, 5, 1, 0) >= 0)
-	{
-		// added high-res IR
-		XnCmosPreset irHighResMode = { 0, XN_RESOLUTION_SXGA, 30 };
-		nRetVal = pDevicePrivateData->FWInfo.irModes.AddLast(irHighResMode);
-		XN_IS_STATUS_OK(nRetVal);
-
-		// opcode added
-		pDevicePrivateData->FWInfo.nOpcodeGetCmosBlanking = OPCODE_GET_CMOS_BLANKING;
-	}
-
-	if (CompareVersion(nMajor, nMinor, nBuild, 5, 2, 0) >= 0)
-	{
-		// 25 FPS modes were added
-		XnCmosPreset depthModes25FPS[] = 
-		{
-			{ XN_IO_DEPTH_FORMAT_COMPRESSED_PS, XN_RESOLUTION_QVGA, 25 },
-			{ XN_IO_DEPTH_FORMAT_COMPRESSED_PS, XN_RESOLUTION_VGA, 25 },
-			{ XN_IO_DEPTH_FORMAT_UNCOMPRESSED_11_BIT, XN_RESOLUTION_QVGA, 25 },
-			{ XN_IO_DEPTH_FORMAT_UNCOMPRESSED_11_BIT, XN_RESOLUTION_VGA, 25 },
-			{ XN_IO_DEPTH_FORMAT_UNCOMPRESSED_12_BIT, XN_RESOLUTION_QVGA, 25 },
-			{ XN_IO_DEPTH_FORMAT_UNCOMPRESSED_12_BIT, XN_RESOLUTION_VGA, 25 },
-			{ XN_IO_DEPTH_FORMAT_UNCOMPRESSED_16_BIT, XN_RESOLUTION_QVGA, 25 },
-			{ XN_IO_DEPTH_FORMAT_UNCOMPRESSED_16_BIT, XN_RESOLUTION_VGA, 25 },
-		};
-		nRetVal = pDevicePrivateData->FWInfo.depthModes.AddLast(depthModes, sizeof(depthModes)/sizeof(depthModes[0]));
-		XN_IS_STATUS_OK(nRetVal);
-
-		XnCmosPreset imageModes25FpsCommon[] =
-		{
-			{ XN_IO_IMAGE_FORMAT_YUV422, XN_RESOLUTION_QVGA, 25 },
-			{ XN_IO_IMAGE_FORMAT_YUV422, XN_RESOLUTION_VGA, 25 },
-		};
-		nRetVal = pDevicePrivateData->FWInfo.imageBulkModes.AddLast(imageModes25FpsCommon, sizeof(imageModes25FpsCommon)/sizeof(imageModes25FpsCommon[0]));
-		XN_IS_STATUS_OK(nRetVal);
-		nRetVal = pDevicePrivateData->FWInfo.imageIsoModes.AddLast(imageModes25FpsCommon, sizeof(imageModes25FpsCommon)/sizeof(imageModes25FpsCommon[0]));
-		XN_IS_STATUS_OK(nRetVal);
-
-		XnCmosPreset imageModes25FpsIso[] =
-		{
-			{ XN_IO_IMAGE_FORMAT_UNCOMPRESSED_YUV422, XN_RESOLUTION_QVGA, 25 },
-			{ XN_IO_IMAGE_FORMAT_UNCOMPRESSED_YUV422, XN_RESOLUTION_VGA, 25 },
-		};
-		nRetVal = pDevicePrivateData->FWInfo.imageIsoModes.AddLast(imageModes25FpsIso, sizeof(imageModes25FpsIso)/sizeof(imageModes25FpsIso[0]));
-		XN_IS_STATUS_OK(nRetVal);
-
-		XnCmosPreset irModes25Fps[] =
-		{
-			{ 0, XN_RESOLUTION_QVGA, 25 },
-			{ 0, XN_RESOLUTION_VGA, 25 },
-		};
-		nRetVal = pDevicePrivateData->FWInfo.irModes.AddLast(irModes25Fps, sizeof(irModes25Fps)/sizeof(irModes25Fps[0]));
-		XN_IS_STATUS_OK(nRetVal);
-
-		// added high-res image modes (UXGA for 5.2, SXGA for 5.3 and newer)
-		XnCmosPreset imageHighResBayerMode = { XN_IO_IMAGE_FORMAT_BAYER, XN_RESOLUTION_UXGA, 30 };
-		if (CompareVersion(nMajor, nMinor, nBuild, 5, 3, 0) >= 0)
-		{
-			imageHighResBayerMode.nResolution = XN_RESOLUTION_SXGA;
-		}
-		nRetVal = pDevicePrivateData->FWInfo.imageBulkModes.AddLast(imageHighResBayerMode);
-		XN_IS_STATUS_OK(nRetVal);
-		nRetVal = pDevicePrivateData->FWInfo.imageIsoModes.AddLast(imageHighResBayerMode);
-		XN_IS_STATUS_OK(nRetVal);
-	}
 
-	if (CompareVersion(nMajor, nMinor, nBuild, 5, 3, 15) == 0)
-	{
-		pDevicePrivateData->FWInfo.nUSBDelaySetParamFlicker = 300;
-	}	
 
-	if (CompareVersion(nMajor, nMinor, nBuild, 5, 3, 16) >= 0 && 
-		!pDevicePrivateData->pSensor->IsLowBandwidth())
-	{
-		if (usb == XN_USB_CORE_JANGO)
-		{
-			pDevicePrivateData->FWInfo.nUSBDelayReceive = 1;
-			pDevicePrivateData->FWInfo.nUSBDelayExecutePreSend = 0;
-			pDevicePrivateData->FWInfo.nUSBDelayExecutePostSend = 0;
-		}
-
-		pDevicePrivateData->FWInfo.nUSBDelaySoftReset = 1;
-		pDevicePrivateData->FWInfo.nUSBDelaySetParamFlicker = 1;
-		pDevicePrivateData->FWInfo.nUSBDelaySetParamStream0Mode = 1;
-		pDevicePrivateData->FWInfo.nUSBDelaySetParamStream1Mode = 1;
-		pDevicePrivateData->FWInfo.nUSBDelaySetParamStream2Mode = 1;
-	}
-
-	if (CompareVersion(nMajor, nMinor, nBuild, 5, 3, 25) >= 0)
-	{
-		pDevicePrivateData->FWInfo.bDeviceInfoSupported = TRUE;
-	}
-
-	if (CompareVersion(nMajor, nMinor, nBuild, 5, 3, 28) >= 0)
-	{
-		// YUV is also supported in high-res
-		XnCmosPreset imageHighResYuvMode = { XN_IO_IMAGE_FORMAT_YUV422, XN_RESOLUTION_SXGA, 30 };
-		nRetVal = pDevicePrivateData->FWInfo.imageBulkModes.AddLast(imageHighResYuvMode);
-		XN_IS_STATUS_OK(nRetVal);
-		nRetVal = pDevicePrivateData->FWInfo.imageIsoModes.AddLast(imageHighResYuvMode);
-		XN_IS_STATUS_OK(nRetVal);
+		break;
 
-		XnCmosPreset imageHighResYuvModeIso = { XN_IO_IMAGE_FORMAT_UNCOMPRESSED_YUV422, XN_RESOLUTION_SXGA, 30 };
-		nRetVal = pDevicePrivateData->FWInfo.imageIsoModes.AddLast(imageHighResYuvModeIso);
-		XN_IS_STATUS_OK(nRetVal);
-	}
+	case XN_SENSOR_FW_VER_4_0:
+		pDevicePrivateData->FWInfo.nFWVer = nFWVer;
+		pDevicePrivateData->FWInfo.nFWMagic = XN_FW_MAGIC_26;
+		pDevicePrivateData->FWInfo.nHostMagic = XN_HOST_MAGIC_26;
+		pDevicePrivateData->FWInfo.nProtocolHeaderSize = sizeof(XnHostProtocolHeaderV26);
+		pDevicePrivateData->FWInfo.nProtocolMaxPacketSize = XN_PROTOCOL_MAX_PACKET_SIZE_V0_17;
+		pDevicePrivateData->FWInfo.bAudioSupported = FALSE;
+		pDevicePrivateData->FWInfo.bMirrorSupported = FALSE;
+
+		pDevicePrivateData->FWInfo.nOpcodeGetVersion = OPCODE_V400_GET_VERSION;
+		pDevicePrivateData->FWInfo.nOpcodeKeepAlive = OPCODE_V400_KEEP_ALIVE;
+		pDevicePrivateData->FWInfo.nOpcodeGetParam = OPCODE_V400_GET_PARAM;
+		pDevicePrivateData->FWInfo.nOpcodeSetParam = OPCODE_V400_SET_PARAM;
+		pDevicePrivateData->FWInfo.nOpcodeGetFixedParams = OPCODE_V400_GET_FIXED_PARAMS;
+		pDevicePrivateData->FWInfo.nOpcodeGetMode = OPCODE_V400_GET_MODE;
+		pDevicePrivateData->FWInfo.nOpcodeSetMode = OPCODE_V400_SET_MODE;
+		pDevicePrivateData->FWInfo.nOpcodeAlgorithmParams = OPCODE_V400_ALGORITM_PARAMS;
+		pDevicePrivateData->FWInfo.nOpcodeReset = OPCODE_INVALID;
+		pDevicePrivateData->FWInfo.nOpcodeSetCmosBlanking = OPCODE_INVALID;
+		pDevicePrivateData->FWInfo.nOpcodeGetCmosBlanking = OPCODE_INVALID;
+		pDevicePrivateData->FWInfo.nOpcodeGetCmosPresets = OPCODE_INVALID;
+		pDevicePrivateData->FWInfo.nOpcodeGetSerialNumber = OPCODE_INVALID;
+		pDevicePrivateData->FWInfo.nOpcodeGetFastConvergenceTEC = OPCODE_INVALID;
 
-	if (CompareVersion(nMajor, nMinor, nBuild, 5, 3, 29) >= 0)
-	{
-		pDevicePrivateData->FWInfo.nOpcodeGetCmosPresets = OPCODE_GET_CMOS_PRESETS;
-		pDevicePrivateData->FWInfo.bGetPresetsSupported = TRUE;
-	}
+		break;
+	case XN_SENSOR_FW_VER_3_0:
+		pDevicePrivateData->FWInfo.nFWVer = nFWVer;
+		pDevicePrivateData->FWInfo.nFWMagic = XN_FW_MAGIC_26;
+		pDevicePrivateData->FWInfo.nHostMagic = XN_HOST_MAGIC_26;
+		pDevicePrivateData->FWInfo.nProtocolHeaderSize = sizeof(XnHostProtocolHeaderV26);
+		pDevicePrivateData->FWInfo.nProtocolMaxPacketSize = XN_PROTOCOL_MAX_PACKET_SIZE_V0_17;
+		pDevicePrivateData->FWInfo.bAudioSupported = TRUE;
+		pDevicePrivateData->FWInfo.bMirrorSupported = FALSE;
+
+		pDevicePrivateData->FWInfo.nOpcodeGetVersion = OPCODE_V300_GET_VERSION;
+		pDevicePrivateData->FWInfo.nOpcodeKeepAlive = OPCODE_V300_KEEP_ALIVE;
+		pDevicePrivateData->FWInfo.nOpcodeGetParam = OPCODE_V300_GET_PARAM;
+		pDevicePrivateData->FWInfo.nOpcodeSetParam = OPCODE_V300_SET_PARAM;
+		pDevicePrivateData->FWInfo.nOpcodeGetFixedParams = OPCODE_V300_GET_FIXED_PARAMS;
+		pDevicePrivateData->FWInfo.nOpcodeGetMode = OPCODE_V300_GET_MODE;
+		pDevicePrivateData->FWInfo.nOpcodeSetMode = OPCODE_V300_SET_MODE;
+		pDevicePrivateData->FWInfo.nOpcodeAlgorithmParams = OPCODE_V300_ALGORITM_PARAMS;
+		pDevicePrivateData->FWInfo.nOpcodeReset = OPCODE_INVALID;
+		pDevicePrivateData->FWInfo.nOpcodeSetCmosBlanking = OPCODE_INVALID;
+		pDevicePrivateData->FWInfo.nOpcodeGetCmosBlanking = OPCODE_INVALID;
+		pDevicePrivateData->FWInfo.nOpcodeGetCmosPresets = OPCODE_INVALID;
+		pDevicePrivateData->FWInfo.nOpcodeGetSerialNumber = OPCODE_INVALID;
+		pDevicePrivateData->FWInfo.nOpcodeGetFastConvergenceTEC = OPCODE_INVALID;
 
-	if (CompareVersion(nMajor, nMinor, nBuild, 5, 4, 0) >= 0)
-	{
-		pDevicePrivateData->FWInfo.nOpcodeGetSerialNumber = OPCODE_GET_SERIAL_NUMBER;
-		pDevicePrivateData->FWInfo.nOpcodeGetFastConvergenceTEC = OPCODE_GET_FAST_CONVERGENCE_TEC;
-	}
+		break;
+	case XN_SENSOR_FW_VER_1_2:
+		pDevicePrivateData->FWInfo.nFWVer = nFWVer;
+		pDevicePrivateData->FWInfo.nFWMagic = XN_FW_MAGIC_26;
+		pDevicePrivateData->FWInfo.nHostMagic = XN_HOST_MAGIC_26;
+		pDevicePrivateData->FWInfo.nProtocolHeaderSize = sizeof(XnHostProtocolHeaderV26);
+		pDevicePrivateData->FWInfo.nProtocolMaxPacketSize = XN_PROTOCOL_MAX_PACKET_SIZE_V0_17;
+		pDevicePrivateData->FWInfo.bAudioSupported = FALSE;
+		pDevicePrivateData->FWInfo.bMirrorSupported = FALSE;
 
-	if (CompareVersion(nMajor, nMinor, nBuild, 5, 5, 0) >= 0)
-	{
-		// only difference is the interfaces order
-		pDevicePrivateData->FWInfo.nBulkAlternativeInterface = 0;
-		pDevicePrivateData->FWInfo.nISOAlternativeInterface = 1;
-	}
+		pDevicePrivateData->FWInfo.nOpcodeGetVersion = OPCODE_V110_GET_VERSION;
+		pDevicePrivateData->FWInfo.nOpcodeKeepAlive = OPCODE_V110_KEEP_ALIVE;
+		pDevicePrivateData->FWInfo.nOpcodeGetParam = OPCODE_V110_GET_PARAM;
+		pDevicePrivateData->FWInfo.nOpcodeSetParam = OPCODE_V110_SET_PARAM;
+		pDevicePrivateData->FWInfo.nOpcodeGetFixedParams = OPCODE_V110_GET_FIXED_PARAMS;
+		pDevicePrivateData->FWInfo.nOpcodeGetMode = OPCODE_V110_GET_MODE;
+		pDevicePrivateData->FWInfo.nOpcodeSetMode = OPCODE_V110_SET_MODE;
+		pDevicePrivateData->FWInfo.nOpcodeAlgorithmParams = OPCODE_V110_ALGORITHM_PARAMS;
+		pDevicePrivateData->FWInfo.nOpcodeReset = OPCODE_INVALID;
+		pDevicePrivateData->FWInfo.nOpcodeSetCmosBlanking = OPCODE_INVALID;
+		pDevicePrivateData->FWInfo.nOpcodeGetCmosBlanking = OPCODE_INVALID;
+		pDevicePrivateData->FWInfo.nOpcodeGetCmosPresets = OPCODE_INVALID;
+		pDevicePrivateData->FWInfo.nOpcodeGetSerialNumber = OPCODE_INVALID;
+		pDevicePrivateData->FWInfo.nOpcodeGetFastConvergenceTEC = OPCODE_INVALID;
 
-	if (CompareVersion(nMajor, nMinor, nBuild, 5, 6, 0) >= 0)
-	{
-		// audio is no longer supported - switched to UAC
+		break;
+	case XN_SENSOR_FW_VER_1_1:
+		pDevicePrivateData->FWInfo.nFWVer = nFWVer;
+		pDevicePrivateData->FWInfo.nFWMagic = XN_FW_MAGIC_25;
+		pDevicePrivateData->FWInfo.nHostMagic = XN_HOST_MAGIC_25;
+		pDevicePrivateData->FWInfo.nProtocolHeaderSize = sizeof(XnHostProtocolHeaderV25);
+		pDevicePrivateData->FWInfo.nProtocolMaxPacketSize = XN_PROTOCOL_MAX_PACKET_SIZE_V0_17;
 		pDevicePrivateData->FWInfo.bAudioSupported = FALSE;
-	}
-
-	if (CompareVersion(nMajor, nMinor, nBuild, 5, 6, 2) >= 0)
-	{
-		// add QQVGA depth modes
-		XnCmosPreset aQQmodes[] = 
-		{
-			{ XN_IO_DEPTH_FORMAT_COMPRESSED_PS, XN_RESOLUTION_QQVGA, 30 },
-			{ XN_IO_DEPTH_FORMAT_UNCOMPRESSED_11_BIT, XN_RESOLUTION_QQVGA, 30 },
-			{ XN_IO_DEPTH_FORMAT_UNCOMPRESSED_12_BIT, XN_RESOLUTION_QQVGA, 30 },
-			{ XN_IO_DEPTH_FORMAT_UNCOMPRESSED_16_BIT, XN_RESOLUTION_QQVGA, 30 },
-		};
-		nRetVal = pDevicePrivateData->FWInfo.depthModes.AddLast(aQQmodes, sizeof(aQQmodes)/sizeof(aQQmodes[0]));
-		XN_IS_STATUS_OK(nRetVal);
-	}
+		pDevicePrivateData->FWInfo.bMirrorSupported = FALSE;
 
-	if (CompareVersion(nMajor, nMinor, nBuild, 5, 6, 9) >= 0)
-	{
-		pDevicePrivateData->FWInfo.bGetImageCmosTypeSupported = TRUE;
-	}
+		pDevicePrivateData->FWInfo.nOpcodeGetVersion = OPCODE_V110_GET_VERSION;
+		pDevicePrivateData->FWInfo.nOpcodeKeepAlive = OPCODE_V110_KEEP_ALIVE;
+		pDevicePrivateData->FWInfo.nOpcodeGetParam = OPCODE_V110_GET_PARAM;
+		pDevicePrivateData->FWInfo.nOpcodeSetParam = OPCODE_V110_SET_PARAM;
+		pDevicePrivateData->FWInfo.nOpcodeGetFixedParams = OPCODE_V110_GET_FIXED_PARAMS;
+		pDevicePrivateData->FWInfo.nOpcodeGetMode = OPCODE_V110_GET_MODE;
+		pDevicePrivateData->FWInfo.nOpcodeSetMode = OPCODE_V110_SET_MODE;
+		pDevicePrivateData->FWInfo.nOpcodeAlgorithmParams = OPCODE_V110_ALGORITHM_PARAMS;
+		pDevicePrivateData->FWInfo.nOpcodeReset = OPCODE_INVALID;
+		pDevicePrivateData->FWInfo.nOpcodeSetCmosBlanking = OPCODE_INVALID;
+		pDevicePrivateData->FWInfo.nOpcodeGetCmosBlanking = OPCODE_INVALID;
+		pDevicePrivateData->FWInfo.nOpcodeGetCmosPresets = OPCODE_INVALID;
+		pDevicePrivateData->FWInfo.nOpcodeGetSerialNumber = OPCODE_INVALID;
+		pDevicePrivateData->FWInfo.nOpcodeGetFastConvergenceTEC = OPCODE_INVALID;
 
-	if (CompareVersion(nMajor, nMinor, nBuild, 5, 7, 0) >= 0)
-	{
-		pDevicePrivateData->FWInfo.nOpcodeGetPlatformString = OPCODE_GET_PLATFORM_STRING;
-	}
+		break;
+	case XN_SENSOR_FW_VER_0_17:
+		pDevicePrivateData->FWInfo.nFWVer = nFWVer;
+		pDevicePrivateData->FWInfo.nFWMagic = XN_FW_MAGIC_25;
+		pDevicePrivateData->FWInfo.nHostMagic = XN_HOST_MAGIC_25;
+		pDevicePrivateData->FWInfo.nProtocolHeaderSize = sizeof(XnHostProtocolHeaderV25);
+		pDevicePrivateData->FWInfo.nProtocolMaxPacketSize = XN_PROTOCOL_MAX_PACKET_SIZE_V0_17;
+		pDevicePrivateData->FWInfo.bAudioSupported = FALSE;
+		pDevicePrivateData->FWInfo.bMirrorSupported = FALSE;
+
+		pDevicePrivateData->FWInfo.nOpcodeGetVersion = OPCODE_V017_GET_VERSION;
+		pDevicePrivateData->FWInfo.nOpcodeKeepAlive = OPCODE_V017_KEEP_ALIVE;
+		pDevicePrivateData->FWInfo.nOpcodeGetParam = OPCODE_V017_GET_PARAM;
+		pDevicePrivateData->FWInfo.nOpcodeSetParam = OPCODE_V017_SET_PARAM;
+		pDevicePrivateData->FWInfo.nOpcodeGetFixedParams = OPCODE_V017_GET_FIXED_PARAMS;
+		pDevicePrivateData->FWInfo.nOpcodeGetMode = OPCODE_INVALID;
+		pDevicePrivateData->FWInfo.nOpcodeSetMode = OPCODE_INVALID;
+		pDevicePrivateData->FWInfo.nOpcodeAlgorithmParams = OPCODE_V017_ALGORITM_PARAMS;
+		pDevicePrivateData->FWInfo.nOpcodeReset = OPCODE_V017_RESET;
+		pDevicePrivateData->FWInfo.nOpcodeSetCmosBlanking = OPCODE_INVALID;
+		pDevicePrivateData->FWInfo.nOpcodeGetCmosBlanking = OPCODE_INVALID;
+		pDevicePrivateData->FWInfo.nOpcodeGetCmosPresets = OPCODE_INVALID;
+		pDevicePrivateData->FWInfo.nOpcodeGetSerialNumber = OPCODE_INVALID;
+		pDevicePrivateData->FWInfo.nOpcodeGetFastConvergenceTEC = OPCODE_INVALID;
 
-	if (CompareVersion(nMajor, nMinor, nBuild, 5, 8, 0) >= 0)
-	{
-		xnLogWarning(XN_MASK_SENSOR_PROTOCOL, "Sensor version %d.%d.%x is newer than latest known. Trying to use 5.7 protocol...", nMajor, nMinor, nBuild);
+		break;
+	default:
+		return (XN_STATUS_IO_DEVICE_WRONG_VERSION);
 	}
 
 	pDevicePrivateData->FWInfo.nCurrMode = XN_MODE_PS;
-	pDevicePrivateData->FWInfo.nFWVer = GetFWVersion(nMajor, nMinor, nBuild);
 
 	return (XN_STATUS_OK);
 }
 
-XnStatus XnHostProtocolInitHeader(const XnDevicePrivateData* pDevicePrivateData, void* pBuffer, XnUInt32 nSize, XnUInt16 nOpcode)
+XnStatus XnHostProtocolInitHeader(XnDevicePrivateData* pDevicePrivateData, void* pBuffer, XnUInt32 nSize, XnUInt16 nOpcode)
 {
 	static XnUInt16 nId = 0;
 
@@ -507,12 +295,12 @@ XnStatus XnHostProtocolInitHeader(const XnDevicePrivateData* pDevicePrivateData,
 	return (XN_STATUS_OK);
 }
 
-XnStatus XnHostProtocolUSBSend(const XnDevicePrivateData* pDevicePrivateData,
+XnStatus XnHostProtocolUSBSend(XnDevicePrivateData* pDevicePrivateData,
 							   XnUChar* pBuffer, XnUInt16 nSize, XnUInt32 nTimeOut, XnBool bForceBulk)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 
-	const XnUsbControlConnection* pCtrlConnection = &pDevicePrivateData->SensorHandle.ControlConnection;
+	XnUsbControlConnection* pCtrlConnection = &pDevicePrivateData->SensorHandle.ControlConnection;
 
 	XnUInt32 nCounter = XN_USB_HOST_PROTOCOL_SEND_RETRIES;
 	while (nCounter-- != 0)
@@ -533,14 +321,14 @@ XnStatus XnHostProtocolUSBSend(const XnDevicePrivateData* pDevicePrivateData,
 	return nRetVal;
 }
 
-XnStatus XnHostProtocolUSBReceive(const XnDevicePrivateData* pDevicePrivateData,
+XnStatus XnHostProtocolUSBReceive(XnDevicePrivateData* pDevicePrivateData,
 								  XnUChar* pBuffer, XnUInt nSize, XnUInt32& nRead, XnUInt32 nTimeOut, XnBool bForceBulk, XnUInt32 nFailTimeout)
 {
 	XnStatus nRetVal;
 	XnUInt64 nMaxTime;
 	XnUInt64 nCurrTime;
 
-	const XnUsbControlConnection* pCtrlConnection = &pDevicePrivateData->SensorHandle.ControlConnection;
+	XnUsbControlConnection* pCtrlConnection = &pDevicePrivateData->SensorHandle.ControlConnection;
 
 	xnOSGetHighResTimeStamp(&nMaxTime);
 	nMaxTime += (nTimeOut * 1000);
@@ -583,7 +371,7 @@ XnStatus XnHostProtocolUSBReceive(const XnDevicePrivateData* pDevicePrivateData,
 	return nRetVal;
 }
 
-XnStatus ValidateReplyV26(const XnDevicePrivateData* pDevicePrivateData, XnUChar* pBuffer, XnUInt32 nBufferSize, XnUInt16 nExpectedOpcode, XnUInt16 nRequestId, XnUInt16& nDataSize, XnUChar** pDataBuf)
+XnStatus ValidateReplyV26(XnDevicePrivateData* pDevicePrivateData, XnUChar* pBuffer, XnUInt32 nBufferSize, XnUInt16 nExpectedOpcode, XnUInt16 nRequestId, XnUInt16& nDataSize, XnUChar** pDataBuf)
 {
 	XnUInt16 nHeaderOffset = 0;
 	XnHostProtocolHeaderV26* pHeader = (XnHostProtocolHeaderV26*)pBuffer;
@@ -655,7 +443,7 @@ XnStatus ValidateReplyV26(const XnDevicePrivateData* pDevicePrivateData, XnUChar
 	return XN_STATUS_OK;
 }
 
-XnStatus ValidateReplyV25(const XnDevicePrivateData* pDevicePrivateData, XnUChar* pBuffer, XnUInt32 nBufferSize, XnUInt16 nExpectedOpcode, XnUInt16 nRequestId, XnUInt16& nDataSize, XnUChar** pDataBuf)
+XnStatus ValidateReplyV25(XnDevicePrivateData* pDevicePrivateData, XnUChar* pBuffer, XnUInt32 nBufferSize, XnUInt16 nExpectedOpcode, XnUInt16 nRequestId, XnUInt16& nDataSize, XnUChar** pDataBuf)
 {
 	XnUInt16 nHeaderOffset = 0;
 	XnHostProtocolHeaderV25* pHeader = (XnHostProtocolHeaderV25*)pBuffer;
@@ -725,7 +513,7 @@ XnStatus ValidateReplyV25(const XnDevicePrivateData* pDevicePrivateData, XnUChar
 	return XN_STATUS_OK;
 }
 
-XnUInt32 XnHostProtocolGetTimeOut(const XnDevicePrivateData* pDevicePrivateData, XnUInt16 nOpcode)
+XnUInt32 XnHostProtocolGetTimeOut(XnDevicePrivateData* pDevicePrivateData, XnUInt16 nOpcode)
 {
 	if  (nOpcode == pDevicePrivateData->FWInfo.nOpcodeKeepAlive)
 		return XN_USB_HOST_PROTOCOL_TIMEOUT_KEEP_ALIVE;
@@ -751,7 +539,7 @@ XnUInt32 XnHostProtocolGetSetParamRecvTimeOut(XnDevicePrivateData* pDevicePrivat
 		return 0;
 }
 
-XnStatus XnHostProtocolGetRequestID(const XnDevicePrivateData* pDevicePrivateData, XnUChar* pBuffer, XnUInt16* pnRequestId)
+XnStatus XnHostProtocolGetRequestID(XnDevicePrivateData* pDevicePrivateData, XnUChar* pBuffer, XnUInt16* pnRequestId)
 {
 	XnUInt16 nRequestId;
 
@@ -768,7 +556,7 @@ XnStatus XnHostProtocolGetRequestID(const XnDevicePrivateData* pDevicePrivateDat
 	return XN_STATUS_OK;
 }
 
-XnStatus XnHostProtocolReceiveReply(const XnDevicePrivateData* pDevicePrivateData, XnUChar* pBuffer, XnUInt32 nTimeOut, XnUInt16 nOpcode, XnUInt16 nRequestId, XnUInt32* pnReadBytes, XnUInt16* pnDataSize, XnUChar** ppRelevantBuffer, XnBool bForceBulk, XnUInt32 nRecvTimeout, XnUInt32 nFailTimeout)
+XnStatus XnHostProtocolReceiveReply(XnDevicePrivateData* pDevicePrivateData, XnUChar* pBuffer, XnUInt32 nTimeOut, XnUInt16 nOpcode, XnUInt16 nRequestId, XnUInt32* pnReadBytes, XnUInt16* pnDataSize, XnUChar** ppRelevantBuffer, XnBool bForceBulk, XnUInt32 nRecvTimeout, XnUInt32 nFailTimeout)
 {
 	XnStatus rc = XN_STATUS_OK;
 
@@ -826,7 +614,7 @@ XnStatus XnHostProtocolReceiveReply(const XnDevicePrivateData* pDevicePrivateDat
 	return rc;
 }
 
-XnStatus XnHostProtocolExecute(const XnDevicePrivateData* pDevicePrivateData,
+XnStatus XnHostProtocolExecute(XnDevicePrivateData* pDevicePrivateData,
 							   XnUChar* pBuffer, XnUInt16 nSize, XnUInt16 nOpcode,
 							   XnUChar** ppRelevantBuffer, XnUInt16& nDataSize, XnUInt32 nRecvTimeout = 0)
 {
@@ -924,7 +712,24 @@ XnStatus XnHostProtocolExecute(const XnDevicePrivateData* pDevicePrivateData,
 }
 
 
-XnStatus XnHostProtocolGetVersion(const XnDevicePrivateData* pDevicePrivateData, XnVersions& Version)
+XnInt32 compareVersion(const XnVersions& version, XnInt32 nMajor, XnInt32 nMinor, XnInt32 nBuild)
+{
+	XnInt32 nResult = version.nMajor - nMajor;
+
+	if (nResult == 0)
+	{
+		nResult = version.nMinor - nMinor;
+	}
+
+	if (nResult == 0)
+	{
+		nResult = version.nBuild - nBuild;
+	}
+
+	return nResult;
+}
+
+XnStatus XnHostProtocolGetVersion(XnDevicePrivateData* pDevicePrivateData, XnVersions& Version)
 {
 	XnUChar buffer[MAX_PACKET_SIZE] = {0};
 	XnUInt16 nDataSize;
@@ -932,15 +737,25 @@ XnStatus XnHostProtocolGetVersion(const XnDevicePrivateData* pDevicePrivateData,
 
 	xnLogVerbose(XN_MASK_SENSOR_PROTOCOL, "Getting hardware versions...");
 
+	XnHostProtocolInitFWParams(pDevicePrivateData, XN_SENSOR_FW_VER_5_1);
 	XnHostProtocolInitHeader(pDevicePrivateData, buffer, 0, pDevicePrivateData->FWInfo.nOpcodeGetVersion);
 	XnStatus rc = XnHostProtocolExecute(pDevicePrivateData,
 										buffer, pDevicePrivateData->FWInfo.nProtocolHeaderSize, pDevicePrivateData->FWInfo.nOpcodeGetVersion,
 										(XnUChar**)(&pVersion), nDataSize);
 	if (rc != XN_STATUS_OK)
 	{
-		xnLogError(XN_MASK_SENSOR_PROTOCOL, "Get version failed: %s", xnGetStatusString(rc));
+		XnHostProtocolInitFWParams(pDevicePrivateData, XN_SENSOR_FW_VER_1_1);
+		XnHostProtocolInitHeader(pDevicePrivateData, buffer, 0, pDevicePrivateData->FWInfo.nOpcodeGetVersion);
+		rc = XnHostProtocolExecute(pDevicePrivateData, 
+			buffer, pDevicePrivateData->FWInfo.nProtocolHeaderSize, pDevicePrivateData->FWInfo.nOpcodeGetVersion,
+			(XnUChar**)(&pVersion), nDataSize);	
 
-		return rc;
+		if (rc != XN_STATUS_OK)
+		{
+			xnLogError(XN_MASK_SENSOR_PROTOCOL, "Get version failed: %s", xnGetStatusString(rc));
+
+			return rc;
+		}
 	}
 
 	xnOSMemCopy(&Version, pVersion, sizeof(XnVersions));
@@ -952,127 +767,132 @@ XnStatus XnHostProtocolGetVersion(const XnDevicePrivateData* pDevicePrivateData,
 
 	*((XnUInt16*)&Version) = xnOSEndianSwapUINT16(*((XnUInt16*)pVersion));
 
-	if (Version.nMajor >= 5)
-	{
-		XnChar cpBuffer[XN_MAX_OS_NAME_LENGTH];
-		sprintf(cpBuffer, "%x", Version.nBuild);
-		Version.nBuild = (XnUInt16)atoi(cpBuffer);
-	}
+	if (compareVersion(Version, 5, 6, 0) > 0)
+	{
+		xnLogWarning(XN_MASK_SENSOR_PROTOCOL, "Sensor version %d.%d is newer than latest known. Trying to use 5.6 protocol...", Version.nMajor, Version.nMinor);
+		XnHostProtocolInitFWParams(pDevicePrivateData, XN_SENSOR_FW_VER_5_6);
+	}
+	else if (Version.nMajor == 5 && Version.nMinor == 6)
+		XnHostProtocolInitFWParams(pDevicePrivateData, XN_SENSOR_FW_VER_5_6);
+	else if (Version.nMajor == 5 && Version.nMinor == 5)
+		XnHostProtocolInitFWParams(pDevicePrivateData, XN_SENSOR_FW_VER_5_5);
+	else if (Version.nMajor == 5 && Version.nMinor == 4)
+		XnHostProtocolInitFWParams(pDevicePrivateData, XN_SENSOR_FW_VER_5_4);
+	else if (Version.nMajor == 5 && Version.nMinor == 3)
+		XnHostProtocolInitFWParams(pDevicePrivateData, XN_SENSOR_FW_VER_5_3);
+	else if (Version.nMajor == 5 && Version.nMinor == 2)
+		XnHostProtocolInitFWParams(pDevicePrivateData, XN_SENSOR_FW_VER_5_2);
+	else if (Version.nMajor == 5 && Version.nMinor == 1)
+		XnHostProtocolInitFWParams(pDevicePrivateData, XN_SENSOR_FW_VER_5_1);
+	else if (Version.nMajor == 5 && Version.nMinor == 0)
+		XnHostProtocolInitFWParams(pDevicePrivateData, XN_SENSOR_FW_VER_5_0);
+	else if (Version.nMajor >= 4)
+		XnHostProtocolInitFWParams(pDevicePrivateData, XN_SENSOR_FW_VER_4_0);
+	else if (Version.nMajor == 3 && Version.nMinor == 0)
+		XnHostProtocolInitFWParams(pDevicePrivateData, XN_SENSOR_FW_VER_3_0);
+	else if (Version.nMajor == 1 && Version.nMinor == 2)
+		XnHostProtocolInitFWParams(pDevicePrivateData, XN_SENSOR_FW_VER_1_2);
+	else if (Version.nMajor == 1 && Version.nMinor == 1)
+		XnHostProtocolInitFWParams(pDevicePrivateData, XN_SENSOR_FW_VER_1_1);
+	else if (Version.nMajor == 0)
+		XnHostProtocolInitFWParams(pDevicePrivateData, XN_SENSOR_FW_VER_0_17);
 
 	Version.SDK.nMajor = XN_PS_MAJOR_VERSION;
 	Version.SDK.nMinor = XN_PS_MINOR_VERSION;
 	Version.SDK.nMaintenance = XN_PS_MAINTENANCE_VERSION;
 	Version.SDK.nBuild = XN_PS_BUILD_VERSION;
 
-	// find out hardware version (for pre-RD boards)
 	if (Version.nFPGA == XN_FPGA_VER_FPDB_26)
 	{
-		Version.HWVer = XN_SENSOR_HW_VER_FPDB_10;
+		pDevicePrivateData->HWInfo.nHWVer = XN_SENSOR_HW_VER_FPDB_10;
 	}
 	else if (Version.nFPGA == XN_FPGA_VER_FPDB_25)
 	{
-		Version.HWVer = XN_SENSOR_HW_VER_FPDB_10;
+		pDevicePrivateData->HWInfo.nHWVer = XN_SENSOR_HW_VER_FPDB_10;
 	}
 	else if (Version.nFPGA == XN_FPGA_VER_CDB)
 	{
-		Version.HWVer = XN_SENSOR_HW_VER_CDB_10;
+		pDevicePrivateData->HWInfo.nHWVer = XN_SENSOR_HW_VER_CDB_10;
 	}
-	else if (Version.nFPGA == XN_FPGA_VER_CDB)
-	{
-		Version.HWVer = XN_SENSOR_HW_VER_CDB_10;
-	}
-	else if (Version.nFPGA == XN_FPGA_VER_RD3)
-	{
-		Version.HWVer = XN_SENSOR_HW_VER_RD_3;
-	}
-	else if (Version.nFPGA == XN_FPGA_VER_RD5)
-	{
-		Version.HWVer = XN_SENSOR_HW_VER_RD_5;
-	}
-	else if (Version.nFPGA == XN_FPGA_VER_RD1081)
-	{
-		Version.HWVer = XN_SENSOR_HW_VER_RD1081;
-	}	
-	else if (Version.nFPGA == XN_FPGA_VER_RD1082)
-	{
-		Version.HWVer = XN_SENSOR_HW_VER_RD1082;
-	}	
 	else
 	{
-		Version.HWVer = XN_SENSOR_HW_VER_UNKNOWN;
+		pDevicePrivateData->HWInfo.nHWVer = XN_SENSOR_HW_VER_UNKNOWN;
 	}
 
-	// find out chip version
 	if (Version.nChip == XN_CHIP_VER_PS1000)
 	{
-		Version.ChipVer = XN_SENSOR_CHIP_VER_PS1000;
+		pDevicePrivateData->ChipInfo.nChipVer = XN_SENSOR_CHIP_VER_PS1000;
 	}
 	else if (Version.nChip == XN_CHIP_VER_PS1080)
 	{
-		Version.ChipVer = XN_SENSOR_CHIP_VER_PS1080;
+		pDevicePrivateData->ChipInfo.nChipVer = XN_SENSOR_CHIP_VER_PS1080;
 	}
-	else if (Version.nChip == XN_CHIP_VER_PS1080A6)
-	{
-		Version.ChipVer = XN_SENSOR_CHIP_VER_PS1080A6;
-	}	
 	else
 	{
-		Version.ChipVer = XN_SENSOR_CHIP_VER_UNKNOWN;
+		pDevicePrivateData->ChipInfo.nChipVer = XN_SENSOR_CHIP_VER_UNKNOWN;
 	}
 
-	// find out sensor version
-	Version.SensorVer = XN_SENSOR_VER_UNKNOWN;
-
-	Version.FWVer = GetFWVersion(Version.nMajor, Version.nMinor, Version.nBuild);
-
-	if (Version.FWVer == XN_SENSOR_FW_VER_5_0)
+	if (pDevicePrivateData->FWInfo.nFWVer == XN_SENSOR_FW_VER_4_0)
 	{
-		Version.HWVer = XN_SENSOR_HW_VER_RD_5;
+		pDevicePrivateData->SensorInfo.nSensorVer = XN_SENSOR_VER_4_0;
 	}
-	else if (Version.FWVer == XN_SENSOR_FW_VER_5_1)
+	else if (pDevicePrivateData->FWInfo.nFWVer == XN_SENSOR_FW_VER_3_0)
 	{
-		Version.HWVer = XN_SENSOR_HW_VER_RD_5;
+		pDevicePrivateData->SensorInfo.nSensorVer = XN_SENSOR_VER_3_0;
+		pDevicePrivateData->HWInfo.nHWVer = XN_SENSOR_HW_VER_RD_3;
 	}
-	else if (Version.FWVer == XN_SENSOR_FW_VER_5_2)
+	else if (pDevicePrivateData->FWInfo.nFWVer == XN_SENSOR_FW_VER_5_0 || pDevicePrivateData->FWInfo.nFWVer == XN_SENSOR_FW_VER_5_1)
 	{
-		Version.HWVer = XN_SENSOR_HW_VER_RD_5;
+		pDevicePrivateData->SensorInfo.nSensorVer = XN_SENSOR_VER_5_0;
+		pDevicePrivateData->HWInfo.nHWVer = XN_SENSOR_HW_VER_RD_5;
 	}
-	else if (Version.FWVer == XN_SENSOR_FW_VER_5_3)
+	else
 	{
-		Version.HWVer = XN_SENSOR_HW_VER_RD1081;
+		pDevicePrivateData->SensorInfo.nSensorVer = XN_SENSOR_VER_2_0;
 	}
-	else if (Version.FWVer == XN_SENSOR_FW_VER_5_4)
+
+	Version.FWVer = pDevicePrivateData->FWInfo.nFWVer;
+	Version.HWVer = pDevicePrivateData->HWInfo.nHWVer;
+	Version.SensorVer = pDevicePrivateData->SensorInfo.nSensorVer;
+	Version.ChipVer = pDevicePrivateData->ChipInfo.nChipVer;
+
+	if (Version.nMajor >= 5)
 	{
-		Version.HWVer = XN_SENSOR_HW_VER_RD1082;
+		XnChar cpBuffer[XN_MAX_OS_NAME_LENGTH];
+		sprintf(cpBuffer, "%x", Version.nBuild);
+		Version.nBuild = (XnUInt16)atoi(cpBuffer);
 	}
-	else if (Version.FWVer == XN_SENSOR_FW_VER_5_5)
+
+	if (!pDevicePrivateData->pSensor->IsLowBandwidth() &&
+		compareVersion(Version, 5, 3, 16) >= 0)
 	{
-		Version.HWVer = XN_SENSOR_HW_VER_RD1082;
+		pDevicePrivateData->FWInfo.nUSBDelayReceive = 1;
+		pDevicePrivateData->FWInfo.nUSBDelayExecutePreSend = 0;
+		pDevicePrivateData->FWInfo.nUSBDelayExecutePostSend = 0;
+		pDevicePrivateData->FWInfo.nUSBDelaySoftReset = 1;
+		pDevicePrivateData->FWInfo.nUSBDelaySetParamFlicker = 1;
+		pDevicePrivateData->FWInfo.nUSBDelaySetParamStream0Mode = 1;
+		pDevicePrivateData->FWInfo.nUSBDelaySetParamStream1Mode = 1;
+		pDevicePrivateData->FWInfo.nUSBDelaySetParamStream2Mode = 1;
 	}
-	else if (Version.FWVer == XN_SENSOR_FW_VER_5_6)
+	else
 	{
-		if (CompareVersion(Version.nMajor, Version.nMinor, Version.nBuild, 5, 6, 6) >= 0) 
-		{
-			if (Version.nFPGA == 0)
-			{
-				Version.HWVer = XN_SENSOR_HW_VER_RD1081;
-			}
-			else if (Version.nFPGA == 1)
-			{
-				Version.HWVer = XN_SENSOR_HW_VER_RD1082;
-			}		
-		}
-		else
+		pDevicePrivateData->FWInfo.nUSBDelayReceive = 100;
+		pDevicePrivateData->FWInfo.nUSBDelayExecutePreSend = 1;
+		pDevicePrivateData->FWInfo.nUSBDelayExecutePostSend = 10;
+		pDevicePrivateData->FWInfo.nUSBDelaySoftReset = 800;
+		pDevicePrivateData->FWInfo.nUSBDelaySetParamFlicker = 3000;
+		pDevicePrivateData->FWInfo.nUSBDelaySetParamStream0Mode = 1;
+		pDevicePrivateData->FWInfo.nUSBDelaySetParamStream1Mode = 300;
+		pDevicePrivateData->FWInfo.nUSBDelaySetParamStream2Mode = 1;
+
+		if (compareVersion(Version, 5, 3, 15) == 0)
 		{
-			Version.HWVer = XN_SENSOR_HW_VER_RD1082;
-		}
+			pDevicePrivateData->FWInfo.nUSBDelaySetParamFlicker = 300;
+		}	
 	}
 
-	xnLogInfo(XN_MASK_SENSOR_PROTOCOL, 
-		"Hardware versions: FW=%d.%d.%d (%d) HW=%d Chip=%d Sensor=%d SYS=%d", 
-		Version.nMajor, Version.nMinor, Version.nBuild, 
-		Version.FWVer, Version.HWVer, Version.ChipVer, 
-		Version.SensorVer, Version.nSystemVersion);
+	xnLogInfo(XN_MASK_SENSOR_PROTOCOL, "Hardware versions: FW=%d.%d.%d (%d) HW=%d Chip=%d Sensor=%d SYS=%d", Version.nMajor, Version.nMinor, Version.nBuild, Version.FWVer, Version.HWVer, Version.ChipVer, Version.SensorVer, Version.nSystemVersion);
 
 	return XN_STATUS_OK;
 }
@@ -1099,52 +919,6 @@ XnStatus XnHostProtocolKeepAlive(XnDevicePrivateData* pDevicePrivateData)
 	return rc;
 }
 
-XnStatus XnHostProtocolReadAHB(XnDevicePrivateData* pDevicePrivateData, XnUInt32 nAddress, XnUInt32 &nValue)
-{
-	XnUChar buffer[MAX_PACKET_SIZE] = {0};
-	XnUChar* pDataBuf = buffer + pDevicePrivateData->FWInfo.nProtocolHeaderSize;
-
-	*(XnUInt32*)pDataBuf = XN_PREPARE_VAR32_IN_BUFFER(nAddress);
-
-	XnHostProtocolInitHeader(pDevicePrivateData, buffer, sizeof(XnUInt32), pDevicePrivateData->FWInfo.nOpcodeReadAHB);
-
-	XnUInt16 nDataSize;
-	XnUInt32* pValue = NULL;
-
-	XnStatus rc = XnHostProtocolExecute(pDevicePrivateData, 
-										buffer, pDevicePrivateData->FWInfo.nProtocolHeaderSize+sizeof(XnUInt32), pDevicePrivateData->FWInfo.nOpcodeReadAHB,
-										(XnUChar**)(&pValue), nDataSize);
-	if (rc != XN_STATUS_OK)
-	{
-		return rc;
-	}
-
-	nValue = XN_PREPARE_VAR32_IN_BUFFER(*pValue);
-
-	return XN_STATUS_OK;
-}
-
-XnStatus XnHostProtocolWriteAHB(XnDevicePrivateData* pDevicePrivateData, XnUInt32 nAddress, XnUInt32 nValue,
-								XnUInt32 nMask)
-{
-	XnUChar buffer[MAX_PACKET_SIZE] = {0};
-	XnUChar* pDataBuf = buffer + pDevicePrivateData->FWInfo.nProtocolHeaderSize;
-
-	xnLogInfo(XN_MASK_SENSOR_PROTOCOL, "Write AHB: 0x%08x 0x%08x 0x%08x", nAddress, nValue, nMask);
-
-	*(XnUInt32*)pDataBuf = XN_PREPARE_VAR32_IN_BUFFER(nAddress);
-	*(((XnUInt32*)pDataBuf)+1) = XN_PREPARE_VAR32_IN_BUFFER(nValue);
-	*(((XnUInt32*)pDataBuf)+2) = XN_PREPARE_VAR32_IN_BUFFER(nMask);
-
-	XnHostProtocolInitHeader(pDevicePrivateData, buffer, sizeof(XnUInt32)*3, pDevicePrivateData->FWInfo.nOpcodeWriteAHB);
-
-	XnUInt16 nDataSize;
-
-	XnStatus rc = XnHostProtocolExecute(pDevicePrivateData, 
-										buffer, pDevicePrivateData->FWInfo.nProtocolHeaderSize+sizeof(XnUInt32)*3, pDevicePrivateData->FWInfo.nOpcodeWriteAHB,
-										NULL, nDataSize);
-	return rc;
-}
 
 XnStatus XnHostProtocolGetParam(XnDevicePrivateData* pDevicePrivateData, XnUInt16 nParam, XnUInt16& nValue)
 {
@@ -1427,182 +1201,6 @@ XnStatus XnHostProtocolSetMode(XnDevicePrivateData* pDevicePrivateData, XnUInt16
 	return XN_STATUS_OK;
 }
 
-XnStatus XnHostProtocolGetCMOSRegister(XnDevicePrivateData* pDevicePrivateData, XnCMOSType nCMOS, XnUInt16 nAddress,
-									   XnUInt16& nValue)
-{
-	XnUChar buffer[MAX_PACKET_SIZE] = {0};
-	XnUChar* pDataBuf = buffer + pDevicePrivateData->FWInfo.nProtocolHeaderSize;
-
-	*(XnUInt16*)pDataBuf = XN_PREPARE_VAR16_IN_BUFFER((XnUInt16)nCMOS);
-	*(((XnUInt16*)pDataBuf)+1) = XN_PREPARE_VAR16_IN_BUFFER(nAddress);
-
-	XnHostProtocolInitHeader(pDevicePrivateData, buffer, sizeof(XnUInt16)*2, pDevicePrivateData->FWInfo.nOpcodeGetCMOSReg);
-
-	XnUInt16 nDataSize;
-	XnUInt16* pValue = NULL;
-
-	XnStatus rc = XnHostProtocolExecute(pDevicePrivateData, 
-										buffer, pDevicePrivateData->FWInfo.nProtocolHeaderSize+sizeof(XnUInt16)*2,
-										pDevicePrivateData->FWInfo.nOpcodeGetCMOSReg, (XnUChar**)(&pValue), nDataSize);
-	if (rc != XN_STATUS_OK)
-	{
-		return rc;
-	}
-
-	nValue = XN_PREPARE_VAR16_IN_BUFFER(*pValue);
-
-	return XN_STATUS_OK;
-}
-
-XnStatus XnHostProtocolSetCMOSRegister(XnDevicePrivateData* pDevicePrivateData, XnCMOSType nCMOS, XnUInt16 nAddress,
-									   XnUInt16 nValue)
-{
-	XnUChar buffer[MAX_PACKET_SIZE] = {0};
-	XnUChar* pDataBuf = buffer + pDevicePrivateData->FWInfo.nProtocolHeaderSize;
-
-	*(XnUInt16*)pDataBuf = XN_PREPARE_VAR16_IN_BUFFER((XnUInt16)nCMOS);
-	*(((XnUInt16*)pDataBuf)+1) = XN_PREPARE_VAR16_IN_BUFFER(nAddress);
-	*(((XnUInt16*)pDataBuf)+2) = XN_PREPARE_VAR16_IN_BUFFER(nValue);
-
-	XnHostProtocolInitHeader(pDevicePrivateData, buffer, sizeof(XnUInt16)*3, pDevicePrivateData->FWInfo.nOpcodeSetCMOSReg);
-
-	XnUInt16 nDataSize;
-
-	XnStatus rc = XnHostProtocolExecute(pDevicePrivateData, 
-										buffer, pDevicePrivateData->FWInfo.nProtocolHeaderSize+sizeof(XnUInt16)*3,
-										pDevicePrivateData->FWInfo.nOpcodeSetCMOSReg, NULL, nDataSize);
-
-	return rc;
-}
-
-XnStatus XnHostProtocolReadI2C(XnDevicePrivateData* pDevicePrivateData, XnI2CReadData* pI2CReadData)
-{
-	XnUChar buffer[MAX_PACKET_SIZE] = {0};
-	XnUChar* pDataBuf = buffer + pDevicePrivateData->FWInfo.nProtocolHeaderSize;
-
-	*(XnUInt16*)pDataBuf = XN_PREPARE_VAR16_IN_BUFFER(pI2CReadData->nBus);
-	*(((XnUInt16*)pDataBuf)+1) = XN_PREPARE_VAR16_IN_BUFFER(pI2CReadData->nSlaveAddress);
-	*(((XnUInt16*)pDataBuf)+2) = XN_PREPARE_VAR16_IN_BUFFER(pI2CReadData->nReadSize);
-	for (int i = 0; i < pI2CReadData->nWriteSize; i++)
-		*((XnUInt16*)pDataBuf+3+i) = XN_PREPARE_VAR16_IN_BUFFER(pI2CReadData->cpWriteBuffer[i]);
-
-	XnUInt16 nOpSize = sizeof(XnUInt16)*3 + (pI2CReadData->nWriteSize * sizeof(XnUInt16));
-	XnHostProtocolInitHeader(pDevicePrivateData, buffer, nOpSize, pDevicePrivateData->FWInfo.nOpcodeReadI2C);
-
-	XnUInt16 nDataSize;
-	XnUInt16* pValue = NULL;
-
-	XnStatus rc = XnHostProtocolExecute(pDevicePrivateData, 
-		buffer, pDevicePrivateData->FWInfo.nProtocolHeaderSize+nOpSize,
-		pDevicePrivateData->FWInfo.nOpcodeReadI2C, (XnUChar**)(&pValue), nDataSize);
-
-	if (rc != XN_STATUS_OK)
-	{
-		return rc;
-	}
-
-	for (int i = 0; i < nDataSize; i++)
-		pI2CReadData->cpReadBuffer[i] = XN_PREPARE_VAR16_IN_BUFFER(*(pValue+i));
-
-	return XN_STATUS_OK;
-}
-
-XnStatus XnHostProtocolWriteI2C(XnDevicePrivateData* pDevicePrivateData, const XnI2CWriteData* pI2CWriteData)
-{
-	XnUChar buffer[MAX_PACKET_SIZE] = {0};
-	XnUChar* pDataBuf = buffer + pDevicePrivateData->FWInfo.nProtocolHeaderSize;
-
-	*(XnUInt16*)pDataBuf = XN_PREPARE_VAR16_IN_BUFFER(pI2CWriteData->nBus);
-	*(((XnUInt16*)pDataBuf)+1) = XN_PREPARE_VAR16_IN_BUFFER(pI2CWriteData->nSlaveAddress);
-	for (int i = 0; i < pI2CWriteData->nWriteSize; i++)
-		*((XnUInt16*)pDataBuf+2+i) = XN_PREPARE_VAR16_IN_BUFFER(pI2CWriteData->cpWriteBuffer[i]);
-
-	XnUInt16 nOpSize = sizeof(XnUInt16)*2 + (pI2CWriteData->nWriteSize * sizeof(XnUInt16));
-	XnHostProtocolInitHeader(pDevicePrivateData, buffer, nOpSize, pDevicePrivateData->FWInfo.nOpcodeWriteI2C);
-
-	XnUInt16 nDataSize;
-
-	XnStatus rc = XnHostProtocolExecute(pDevicePrivateData, 
-		buffer, pDevicePrivateData->FWInfo.nProtocolHeaderSize+nOpSize,
-		pDevicePrivateData->FWInfo.nOpcodeWriteI2C, NULL, nDataSize);
-	if (rc != XN_STATUS_OK)
-	{
-		return rc;
-	}
-
-	return XN_STATUS_OK;
-}
-
-XnStatus XnHostProtocolGetCMOSRegisterI2C(XnDevicePrivateData* pDevicePrivateData, XnCMOSType nCMOS, XnUInt16 nAddress,
-										  XnUInt16& nValue)
-{
-	XnStatus nRetVal = XN_STATUS_OK;
-	XnI2CReadData I2CReadData;
-
-	nValue = 0;
-	I2CReadData.cpReadBuffer[0] = 0;
-	I2CReadData.cpReadBuffer[1] = 0;
-
-	I2CReadData.nReadSize = XN_PREPARE_VAR16_IN_BUFFER(2);
-	I2CReadData.nWriteSize = XN_PREPARE_VAR16_IN_BUFFER(1);
-	I2CReadData.cpWriteBuffer[0]=XN_PREPARE_VAR16_IN_BUFFER(nAddress);
-
-	if (nCMOS == XN_CMOS_TYPE_IMAGE)
-	{
-		I2CReadData.nBus = XN_PREPARE_VAR16_IN_BUFFER(pDevicePrivateData->pSensor->GetFixedParams()->GetImageCmosI2CBus());
-		I2CReadData.nSlaveAddress = XN_PREPARE_VAR16_IN_BUFFER(pDevicePrivateData->pSensor->GetFixedParams()->GetImageCmosI2CSlaveAddress());
-	}
-	else if (nCMOS == XN_CMOS_TYPE_DEPTH)
-	{
-		I2CReadData.nBus = XN_PREPARE_VAR16_IN_BUFFER(pDevicePrivateData->pSensor->GetFixedParams()->GetDepthCmosI2CBus());
-		I2CReadData.nSlaveAddress = XN_PREPARE_VAR16_IN_BUFFER(pDevicePrivateData->pSensor->GetFixedParams()->GetDepthCmosI2CSlaveAddress());
-	}
-	else
-	{
-		return (XN_STATUS_ERROR);
-	}
-
-	nRetVal = XnHostProtocolReadI2C(pDevicePrivateData, &I2CReadData);
-	XN_IS_STATUS_OK(nRetVal);
-
-	nValue = XN_PREPARE_VAR16_IN_BUFFER((I2CReadData.cpReadBuffer[0] << 8) + I2CReadData.cpReadBuffer[1]);
-
-	return XN_STATUS_OK;
-}
-
-XnStatus XnHostProtocolSetCMOSRegisterI2C(XnDevicePrivateData* pDevicePrivateData, XnCMOSType nCMOS, XnUInt16 nAddress,
-									   XnUInt16 nValue)
-
-{
-	XnStatus nRetVal = XN_STATUS_OK;
-	XnI2CWriteData I2CWriteData;
-
-	I2CWriteData.cpWriteBuffer[0] = XN_PREPARE_VAR16_IN_BUFFER(nAddress);
-	I2CWriteData.cpWriteBuffer[1] = XN_PREPARE_VAR16_IN_BUFFER((nValue >> 8) & 0xff);
-	I2CWriteData.cpWriteBuffer[2] = XN_PREPARE_VAR16_IN_BUFFER(nValue & 0xff);
-	I2CWriteData.nWriteSize = XN_PREPARE_VAR16_IN_BUFFER(3);
-
-	if (nCMOS == XN_CMOS_TYPE_IMAGE)
-	{
-		I2CWriteData.nBus = XN_PREPARE_VAR16_IN_BUFFER(pDevicePrivateData->pSensor->GetFixedParams()->GetImageCmosI2CBus());
-		I2CWriteData.nSlaveAddress = XN_PREPARE_VAR16_IN_BUFFER(pDevicePrivateData->pSensor->GetFixedParams()->GetImageCmosI2CSlaveAddress());
-	}
-	else if (nCMOS == XN_CMOS_TYPE_DEPTH)
-	{
-		I2CWriteData.nBus = XN_PREPARE_VAR16_IN_BUFFER(pDevicePrivateData->pSensor->GetFixedParams()->GetDepthCmosI2CBus());
-		I2CWriteData.nSlaveAddress = XN_PREPARE_VAR16_IN_BUFFER(pDevicePrivateData->pSensor->GetFixedParams()->GetDepthCmosI2CSlaveAddress());
-	}
-	else
-	{
-		return (XN_STATUS_ERROR);
-	}
-
-	nRetVal = XnHostProtocolWriteI2C(pDevicePrivateData, &I2CWriteData);
-	XN_IS_STATUS_OK(nRetVal);
-
-	return (XN_STATUS_OK);
-}
-
 
 #pragma pack (push, 1)
 typedef struct XnAlgorithmParamRequest
@@ -1636,15 +1234,6 @@ XnStatus XnHostProtocolAlgorithmParams(XnDevicePrivateData* pDevicePrivateData,
 	XnInt16 nDataRead = 0;
 	XnUInt16 nRequestSize = 0;
 
-	if (eAlgorithmType == XN_HOST_PROTOCOL_ALGORITHM_DEVICE_INFO && 
-		!pDevicePrivateData->FWInfo.bDeviceInfoSupported)
-	{
-		XnDeviceInformation* pDeviceInfo = (XnDeviceInformation*)pAlgorithmInformation;
-		strcpy(pDeviceInfo->strDeviceName, "PrimeSense Sensor");
-		strcpy(pDeviceInfo->strVendorData, "");
-		return XN_STATUS_OK;
-	}
-
 	xnLogVerbose(XN_MASK_SENSOR_PROTOCOL, "Getting algorithm params 0x%x for resolution %d and fps %d....", eAlgorithmType, nResolution, nFPS);
 
 	XnStatus rc;
@@ -2039,22 +1628,13 @@ XnStatus XnHostProtocolGetCmosPresets(XnDevicePrivateData* pDevicePrivateData, X
 		return XN_STATUS_OUTPUT_BUFFER_OVERFLOW;
 	}
 
-	XnCmosPreset* pValueEnd = pValue + nReturnedCount;
+	nCount = nReturnedCount;
 
-	nCount = 0;
-
-	while (pValue < pValueEnd)
+	for (XnUInt32 i = 0; i < nCount; ++i)
 	{
-		// workaround a FW bug - an extra preset arrives with FPS 0. Ignore it.
-		if (pValue->nFPS != 0)
-		{
-			aPresets[nCount].nFormat = XN_PREPARE_VAR16_IN_BUFFER(pValue->nFormat);
-			aPresets[nCount].nResolution = XN_PREPARE_VAR16_IN_BUFFER(pValue->nResolution);
-			aPresets[nCount].nFPS = XN_PREPARE_VAR16_IN_BUFFER(pValue->nFPS);
-			++nCount;
-		}
-
-		++pValue;
+		aPresets[i].nFormat = XN_PREPARE_VAR16_IN_BUFFER(pValue[i].nFormat);
+		aPresets[i].nResolution = XN_PREPARE_VAR16_IN_BUFFER(pValue[i].nResolution);
+		aPresets[i].nFPS = XN_PREPARE_VAR16_IN_BUFFER(pValue[i].nFPS);
 	}
 
 	return XN_STATUS_OK;
@@ -2085,63 +1665,4 @@ XnStatus XnHostProtocolGetSerialNumber (XnDevicePrivateData* pDevicePrivateData,
 	strcpy(cpSerialNumber, (XnChar*)serialNumberBuffer);
 
 	return XN_STATUS_OK;
-}
-
-XnStatus XnHostProtocolGetPlatformString(XnDevicePrivateData* pDevicePrivateData, XnChar* cpPlatformString)
-{
-	XnUChar buffer[MAX_PACKET_SIZE] = {0};
-
-	cpPlatformString[0] = '\0';
-
-	if (pDevicePrivateData->FWInfo.nOpcodeGetPlatformString == OPCODE_INVALID)
-	{
-		// for FW that doesn't support this opcode, we just return an empty string
-		return XN_STATUS_OK;
-	}
-
-	xnLogInfo(XN_MASK_SENSOR_PROTOCOL, "Reading sensor platform string...");
-
-	XnHostProtocolInitHeader(pDevicePrivateData, buffer, 0, pDevicePrivateData->FWInfo.nOpcodeGetPlatformString);
-
-	XnUInt16 nDataSize;
-	XnChar *platformStringBuffer = NULL;
-
-	XnStatus rc = XnHostProtocolExecute(pDevicePrivateData, 
-		buffer, pDevicePrivateData->FWInfo.nProtocolHeaderSize, pDevicePrivateData->FWInfo.nOpcodeGetPlatformString,
-		(XnUChar**)(&platformStringBuffer), nDataSize);
-	if (rc != XN_STATUS_OK)
-	{
-		xnLogError(XN_MASK_SENSOR_PROTOCOL, "Failed getting the sensor platform string: %s", xnGetStatusString(rc));
-		return rc;
-	}
-
-	XnUInt32 nBufferUsed = 0;
-	for (XnUInt32 i = 0; i < nDataSize*2; ++i)
-	{
-		cpPlatformString[nBufferUsed++] = platformStringBuffer[i*2];
-	}
-
-	cpPlatformString[nBufferUsed++] = '\0';
-
-	return XN_STATUS_OK;
-}
-
-XnStatus XnHostProtocolGetUsbCoreType(XnDevicePrivateData* pDevicePrivateData, XnHostProtocolUsbCore& nValue)
-{
-	XnUChar buffer[MAX_PACKET_SIZE] = {0};
-	XnUChar* pDataBuf = buffer + pDevicePrivateData->FWInfo.nProtocolHeaderSize;
-
-	XnHostProtocolInitHeader(pDevicePrivateData, buffer, 0, pDevicePrivateData->FWInfo.nOpcodeGetUsbCore);
-
-	XnUInt16 nDataSize;
-	XnUInt16* pValue = NULL;
-
-	XnStatus rc = XnHostProtocolExecute(pDevicePrivateData, 
-		buffer, pDevicePrivateData->FWInfo.nProtocolHeaderSize, pDevicePrivateData->FWInfo.nOpcodeGetUsbCore,
-		(XnUChar**)(&pValue), nDataSize);
-	XN_IS_STATUS_OK(rc);
-
-	nValue = (XnHostProtocolUsbCore)XN_PREPARE_VAR16_IN_BUFFER(*pValue);
-
-	return XN_STATUS_OK;
-}
+}
\ No newline at end of file
diff --git a/Source/XnDeviceSensorV2/XnHostProtocol.h b/Source/XnDeviceSensorV2/XnHostProtocol.h
index ead0738..36721c8 100644
--- a/Source/XnDeviceSensorV2/XnHostProtocol.h
+++ b/Source/XnDeviceSensorV2/XnHostProtocol.h
@@ -35,14 +35,9 @@
 #define XN_FPGA_VER_FPDB_26	0x21
 #define XN_FPGA_VER_FPDB_25	0x0
 #define XN_FPGA_VER_CDB		0x1
-#define XN_FPGA_VER_RD3		0x2
-#define XN_FPGA_VER_RD5		0x3
-#define XN_FPGA_VER_RD1081	0x4
-#define XN_FPGA_VER_RD1082	0x5
 
 #define XN_CHIP_VER_PS1000	0x00101010
 #define XN_CHIP_VER_PS1080	0x00202020
-#define XN_CHIP_VER_PS1080A6	0x00212020
 
 enum EPsProtocolOpCodes
 {
@@ -53,21 +48,37 @@ enum EPsProtocolOpCodes
 	OPCODE_GET_FIXED_PARAMS = 4,
 	OPCODE_GET_MODE = 5,
 	OPCODE_SET_MODE = 6,
-	OPCODE_I2C_WRITE = 10,
-	OPCODE_I2C_READ = 11,
-	OPCODE_READ_AHB = 20,
-	OPCODE_WRITE_AHB = 21,
 	OPCODE_ALGORITM_PARAMS = 22,
 	OPCODE_SET_CMOS_BLANKING = 34,
 	OPCODE_GET_CMOS_BLANKING = 35,
 	OPCODE_GET_CMOS_PRESETS = 36,
 	OPCODE_GET_SERIAL_NUMBER = 37,
 	OPCODE_GET_FAST_CONVERGENCE_TEC = 38,
-	OPCODE_GET_PLATFORM_STRING = 39,
-	OPCODE_GET_USB_CORE_TYPE = 40,
-	OPCODE_KILL = 999,
 };
 
+enum EPsProtocolOpCodes_V400
+{
+	OPCODE_V400_GET_VERSION = 0,
+	OPCODE_V400_KEEP_ALIVE = 1,
+	OPCODE_V400_GET_PARAM = 2,
+	OPCODE_V400_SET_PARAM = 3,
+	OPCODE_V400_GET_FIXED_PARAMS = 4,
+	OPCODE_V400_GET_MODE = 5,
+	OPCODE_V400_SET_MODE = 6,
+	OPCODE_V400_ALGORITM_PARAMS = 22,
+};
+
+enum EPsProtocolOpCodes_V300
+{
+	OPCODE_V300_GET_VERSION = 0,
+	OPCODE_V300_KEEP_ALIVE = 1,
+	OPCODE_V300_GET_PARAM = 2,
+	OPCODE_V300_SET_PARAM = 3,
+	OPCODE_V300_GET_FIXED_PARAMS = 4,
+	OPCODE_V300_GET_MODE = 5,
+	OPCODE_V300_SET_MODE = 6,
+	OPCODE_V300_ALGORITM_PARAMS = 22,
+};
 
 enum XnHostProtocolOpcodes_V110
 {
@@ -78,10 +89,6 @@ enum XnHostProtocolOpcodes_V110
 	OPCODE_V110_GET_FIXED_PARAMS = 4,
 	OPCODE_V110_GET_MODE = 5,
 	OPCODE_V110_SET_MODE = 6,
-	OPCODE_V110_GET_CMOS_REGISTER = 8,
-	OPCODE_V110_SET_CMOS_REGISTER = 9,
-	OPCODE_V110_READ_AHB = 20,
-	OPCODE_V110_WRITE_AHB = 21,
 	OPCODE_V110_ALGORITHM_PARAMS = 22,
 };
 
@@ -93,10 +100,6 @@ enum EPsProtocolOpCodes_V017
 	OPCODE_V017_SET_PARAM = 3,
 	OPCODE_V017_GET_FIXED_PARAMS = 4,
 	OPCODE_V017_RESET = 5,
-	OPCODE_V017_GET_CMOS_REGISTER = 7,
-	OPCODE_V017_SET_CMOS_REGISTER = 8,
-	OPCODE_V017_READ_AHB = 19,
-	OPCODE_V017_WRITE_AHB = 20,
 	OPCODE_V017_ALGORITM_PARAMS = 21,
 };
 
@@ -154,12 +157,6 @@ typedef enum
 	A2D_NUM_OF_SAMPLE_RATES
 } EA2d_SampleRate;
 
-typedef enum XnHostProtocolUsbCore
-{
-	XN_USB_CORE_JANGO = 0,
-	XN_USB_CORE_GADGETFS = 1,
-} XnHostProtocolUsbCore;
-
 #pragma pack(push,1)
 typedef struct
 {
@@ -191,10 +188,8 @@ typedef struct
 
 // All implemented protocol commands
 // Init
-XnStatus XnHostProtocolInitFWParams(XnDevicePrivateData* pDevicePrivateData, XnUInt8 nMajor, XnUInt8 nMinor, XnUInt16 nBuild, XnHostProtocolUsbCore usb);
-
 XnStatus XnHostProtocolKeepAlive		(XnDevicePrivateData* pDevicePrivateData);
-XnStatus XnHostProtocolGetVersion		(const XnDevicePrivateData* pDevicePrivateData, XnVersions& Version);
+XnStatus XnHostProtocolGetVersion		(XnDevicePrivateData* pDevicePrivateData, XnVersions& Version);
 XnStatus XnHostProtocolAlgorithmParams	(XnDevicePrivateData* pDevicePrivateData,
 										 XnHostProtocolAlgorithmType eAlgorithmType,
 										 void* pAlgorithmInformation, XnUInt16 nAlgInfoSize, XnResolutions nResolution, XnUInt16 nFPS);
@@ -224,15 +219,6 @@ XnStatus XnHostProtocolGetCmosBlanking	(XnDevicePrivateData* pDevicePrivateData,
 XnStatus XnHostProtocolGetCmosPresets	(XnDevicePrivateData* pDevicePrivateData, XnCMOSType nCMOSID, XnCmosPreset* aPresets, XnUInt32& nCount);
 
 XnStatus XnHostProtocolGetSerialNumber	(XnDevicePrivateData* pDevicePrivateData, XnChar* cpSerialNumber);
-XnStatus XnHostProtocolGetPlatformString(XnDevicePrivateData* pDevicePrivateData, XnChar* cpPlatformString);
-
-XnStatus XnHostProtocolGetCMOSRegister(XnDevicePrivateData* pDevicePrivateData, XnCMOSType nCMOS, XnUInt16 nAddress, XnUInt16& nValue);
-XnStatus XnHostProtocolSetCMOSRegister	(XnDevicePrivateData* pDevicePrivateData, XnCMOSType nCMOS, XnUInt16 nAddress, XnUInt16 nValue);
-XnStatus XnHostProtocolGetCMOSRegisterI2C(XnDevicePrivateData* pDevicePrivateData, XnCMOSType nCMOS, XnUInt16 nAddress, XnUInt16& nValue);
-XnStatus XnHostProtocolSetCMOSRegisterI2C (XnDevicePrivateData* pDevicePrivateData, XnCMOSType nCMOS, XnUInt16 nAddress, XnUInt16 nValue);
-XnStatus XnHostProtocolReadAHB			(XnDevicePrivateData* pDevicePrivateData, XnUInt32 nAddress, XnUInt32 &nValue);
-XnStatus XnHostProtocolWriteAHB			(XnDevicePrivateData* pDevicePrivateData, XnUInt32 nAddress, XnUInt32 nValue, XnUInt32 nMask);
-XnStatus XnHostProtocolGetUsbCoreType	(XnDevicePrivateData* pDevicePrivateData, XnHostProtocolUsbCore& nValue);
 
 
 #endif
diff --git a/Source/XnDeviceSensorV2/XnIRProcessor.cpp b/Source/XnDeviceSensorV2/XnIRProcessor.cpp
index f7766e7..b7428d4 100644
--- a/Source/XnDeviceSensorV2/XnIRProcessor.cpp
+++ b/Source/XnDeviceSensorV2/XnIRProcessor.cpp
@@ -39,8 +39,8 @@
 // Code
 //---------------------------------------------------------------------------
 
-XnIRProcessor::XnIRProcessor(XnSensorIRStream* pStream, XnSensorStreamHelper* pHelper, XnFrameBufferManager* pBufferManager) :
-	XnFrameStreamProcessor(pStream, pHelper, pBufferManager, XN_SENSOR_PROTOCOL_RESPONSE_IMAGE_START, XN_SENSOR_PROTOCOL_RESPONSE_IMAGE_END),
+XnIRProcessor::XnIRProcessor(XnSensorIRStream* pStream, XnSensorStreamHelper* pHelper) :
+	XnFrameStreamProcessor(pStream, pHelper, XN_SENSOR_PROTOCOL_RESPONSE_IMAGE_START, XN_SENSOR_PROTOCOL_RESPONSE_IMAGE_END),
 	m_nRefTimestamp(0)
 {
 }
@@ -268,7 +268,7 @@ void XnIRProcessor::OnEndOfFrame(const XnSensorProtocolResponseHeader* pHeader)
 	XN_PROFILING_END_SECTION
 }
 
-XnUInt64 XnIRProcessor::CreateTimestampFromDevice(XnUInt32 nDeviceTimeStamp)
+XnUInt64 XnIRProcessor::GetTimeStamp(XnUInt32 nDeviceTimeStamp)
 {
 	XnUInt64 nNow;
 	xnOSGetHighResTimeStamp(&nNow);
@@ -286,7 +286,7 @@ XnUInt64 XnIRProcessor::CreateTimestampFromDevice(XnUInt32 nDeviceTimeStamp)
 	}
 	else
 	{
-		XnUInt64 nResult = XnFrameStreamProcessor::CreateTimestampFromDevice(nDeviceTimeStamp);
+		XnUInt64 nResult = XnFrameStreamProcessor::GetTimeStamp(nDeviceTimeStamp);
 
 		// keep it as ref so that if depth is turned off, we'll continue from there
 		m_nRefTimestamp = nNow - nResult;
diff --git a/Source/XnDeviceSensorV2/XnIRProcessor.h b/Source/XnDeviceSensorV2/XnIRProcessor.h
index 19deb5f..ffa9465 100644
--- a/Source/XnDeviceSensorV2/XnIRProcessor.h
+++ b/Source/XnDeviceSensorV2/XnIRProcessor.h
@@ -35,7 +35,7 @@
 class XnIRProcessor : public XnFrameStreamProcessor
 {
 public:
-	XnIRProcessor(XnSensorIRStream* pStream, XnSensorStreamHelper* pHelper, XnFrameBufferManager* pBufferManager);
+	XnIRProcessor(XnSensorIRStream* pStream, XnSensorStreamHelper* pHelper);
 	virtual ~XnIRProcessor();
 
 	XnStatus Init();
@@ -46,7 +46,7 @@ protected:
 	//---------------------------------------------------------------------------
 	virtual void ProcessFramePacketChunk(const XnSensorProtocolResponseHeader* pHeader, const XnUChar* pData, XnUInt32 nDataOffset, XnUInt32 nDataSize);
 	virtual void OnEndOfFrame(const XnSensorProtocolResponseHeader* pHeader);
-	virtual XnUInt64 CreateTimestampFromDevice(XnUInt32 nDeviceTimeStamp);
+	virtual XnUInt64 GetTimeStamp(XnUInt32 nDeviceTimeStamp);
 
 	//---------------------------------------------------------------------------
 	// Internal Functions
diff --git a/Source/XnDeviceSensorV2/XnImageProcessor.cpp b/Source/XnDeviceSensorV2/XnImageProcessor.cpp
index 2fcd5e9..fa65b07 100644
--- a/Source/XnDeviceSensorV2/XnImageProcessor.cpp
+++ b/Source/XnDeviceSensorV2/XnImageProcessor.cpp
@@ -30,8 +30,8 @@
 // Code
 //---------------------------------------------------------------------------
 
-XnImageProcessor::XnImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper, XnFrameBufferManager* pBufferManager, XnBool bCompressedOutput /* = FALSE */) :
-	XnFrameStreamProcessor(pStream, pHelper, pBufferManager, XN_SENSOR_PROTOCOL_RESPONSE_IMAGE_START, XN_SENSOR_PROTOCOL_RESPONSE_IMAGE_END),
+XnImageProcessor::XnImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper, XnBool bCompressedOutput /* = FALSE */) :
+	XnFrameStreamProcessor(pStream, pHelper, XN_SENSOR_PROTOCOL_RESPONSE_IMAGE_START, XN_SENSOR_PROTOCOL_RESPONSE_IMAGE_END),
 	m_bCompressedOutput(bCompressedOutput)
 {
 }
@@ -53,19 +53,19 @@ XnStatus XnImageProcessor::Init()
 	nRetVal = XnFrameStreamProcessor::Init();
 	XN_IS_STATUS_OK(nRetVal);
 	
-	nRetVal = GetStream()->XResProperty().OnChangeEvent().Register(ActualResChangedCallback, this, m_hXResCallback);
+	nRetVal = GetStream()->XResProperty().OnChangeEvent().Register(ActualResChangedCallback, this, &m_hXResCallback);
 	XN_IS_STATUS_OK(nRetVal);
 
-	nRetVal = GetStream()->YResProperty().OnChangeEvent().Register(ActualResChangedCallback, this, m_hYResCallback);
+	nRetVal = GetStream()->YResProperty().OnChangeEvent().Register(ActualResChangedCallback, this, &m_hYResCallback);
 	XN_IS_STATUS_OK(nRetVal);
 
-	nRetVal = GetStream()->m_FirmwareCropSizeX.OnChangeEvent().Register(ActualResChangedCallback, this, m_hXCropCallback);
+	nRetVal = GetStream()->m_FirmwareCropSizeX.OnChangeEvent().Register(ActualResChangedCallback, this, &m_hXCropCallback);
 	XN_IS_STATUS_OK(nRetVal);
 
-	nRetVal = GetStream()->m_FirmwareCropSizeY.OnChangeEvent().Register(ActualResChangedCallback, this, m_hYCropCallback);
+	nRetVal = GetStream()->m_FirmwareCropSizeY.OnChangeEvent().Register(ActualResChangedCallback, this, &m_hYCropCallback);
 	XN_IS_STATUS_OK(nRetVal);
 
-	nRetVal = GetStream()->m_FirmwareCropEnabled.OnChangeEvent().Register(ActualResChangedCallback, this, m_hCropEnabledCallback);
+	nRetVal = GetStream()->m_FirmwareCropEnabled.OnChangeEvent().Register(ActualResChangedCallback, this, &m_hCropEnabledCallback);
 	XN_IS_STATUS_OK(nRetVal);
 
 	CalcActualRes();
diff --git a/Source/XnDeviceSensorV2/XnImageProcessor.h b/Source/XnDeviceSensorV2/XnImageProcessor.h
index cf1345d..f1a4583 100644
--- a/Source/XnDeviceSensorV2/XnImageProcessor.h
+++ b/Source/XnDeviceSensorV2/XnImageProcessor.h
@@ -34,7 +34,7 @@
 class XnImageProcessor : public XnFrameStreamProcessor
 {
 public:
-	XnImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper, XnFrameBufferManager* pBufferManager, XnBool bCompressedOutput = FALSE);
+	XnImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper, XnBool bCompressedOutput = FALSE);
 	virtual ~XnImageProcessor();
 
 	XnStatus Init();
diff --git a/Source/XnDeviceSensorV2/XnJpegImageProcessor.cpp b/Source/XnDeviceSensorV2/XnJpegImageProcessor.cpp
index 523ad34..11db885 100644
--- a/Source/XnDeviceSensorV2/XnJpegImageProcessor.cpp
+++ b/Source/XnDeviceSensorV2/XnJpegImageProcessor.cpp
@@ -29,8 +29,8 @@
 // Code
 //---------------------------------------------------------------------------
 
-XnJpegImageProcessor::XnJpegImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper, XnFrameBufferManager* pBufferManager) :
-	XnImageProcessor(pStream, pHelper, pBufferManager, TRUE)
+XnJpegImageProcessor::XnJpegImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper) :
+	XnImageProcessor(pStream, pHelper, TRUE)
 {
 	SetAllowDoubleSOFPackets(TRUE);
 }
diff --git a/Source/XnDeviceSensorV2/XnJpegImageProcessor.h b/Source/XnDeviceSensorV2/XnJpegImageProcessor.h
index 300acc4..e61ab2f 100644
--- a/Source/XnDeviceSensorV2/XnJpegImageProcessor.h
+++ b/Source/XnDeviceSensorV2/XnJpegImageProcessor.h
@@ -35,7 +35,7 @@
 class XnJpegImageProcessor : public XnImageProcessor
 {
 public:
-	XnJpegImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper, XnFrameBufferManager* pBufferManager);
+	XnJpegImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper);
 	~XnJpegImageProcessor();
 
 protected:
diff --git a/Source/XnDeviceSensorV2/XnJpegToRGBImageProcessor.cpp b/Source/XnDeviceSensorV2/XnJpegToRGBImageProcessor.cpp
index 2d50e9d..8095b5f 100644
--- a/Source/XnDeviceSensorV2/XnJpegToRGBImageProcessor.cpp
+++ b/Source/XnDeviceSensorV2/XnJpegToRGBImageProcessor.cpp
@@ -29,8 +29,8 @@
 // Code
 //---------------------------------------------------------------------------
 
-XnJpegToRGBImageProcessor::XnJpegToRGBImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper, XnFrameBufferManager* pBufferManager) :
-	XnImageProcessor(pStream, pHelper, pBufferManager)
+XnJpegToRGBImageProcessor::XnJpegToRGBImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper) :
+	XnImageProcessor(pStream, pHelper)
 {
 	SetAllowDoubleSOFPackets(TRUE);
 }
diff --git a/Source/XnDeviceSensorV2/XnJpegToRGBImageProcessor.h b/Source/XnDeviceSensorV2/XnJpegToRGBImageProcessor.h
index a9b360e..7cbcea6 100644
--- a/Source/XnDeviceSensorV2/XnJpegToRGBImageProcessor.h
+++ b/Source/XnDeviceSensorV2/XnJpegToRGBImageProcessor.h
@@ -35,7 +35,7 @@
 class XnJpegToRGBImageProcessor : public XnImageProcessor
 {
 public:
-	XnJpegToRGBImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper, XnFrameBufferManager* pBufferManager);
+	XnJpegToRGBImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper);
 	~XnJpegToRGBImageProcessor();
 
 	XnStatus Init();
diff --git a/Source/XnDeviceSensorV2/XnMultiPropChangedHandler.cpp b/Source/XnDeviceSensorV2/XnMultiPropChangedHandler.cpp
index f7cb40d..00eb9c4 100644
--- a/Source/XnDeviceSensorV2/XnMultiPropChangedHandler.cpp
+++ b/Source/XnDeviceSensorV2/XnMultiPropChangedHandler.cpp
@@ -42,7 +42,7 @@ XnStatus XnMultiPropChangedHandler::AddProperty(const XnChar* strName)
 	XnStatus nRetVal = XN_STATUS_OK;
 
 	XnCallbackHandle hCallback;
-	nRetVal = m_pNode->GetSensor()->RegisterToPropertyChange(m_strModule, strName, PropertyChangedCallback, this, hCallback);
+	nRetVal = m_pNode->GetSensor()->RegisterToPropertyChange(m_strModule, strName, PropertyChangedCallback, this, &hCallback);
 	XN_IS_STATUS_OK(nRetVal);
 
 	nRetVal = m_Registered.Set(strName, hCallback);
@@ -74,9 +74,9 @@ XnStatus XnMultiPropChangedHandler::AddProperties(const XnChar** strNames)
 
 void XnMultiPropChangedHandler::Unregister()
 {
-	for (XnPropertyHandleHash::Iterator it = m_Registered.Begin(); it != m_Registered.End(); ++it)
+	for (XnPropertyHandleHash::Iterator it = m_Registered.begin(); it != m_Registered.end(); ++it)
 	{
-		m_pNode->GetSensor()->UnregisterFromPropertyChange(m_strModule, it->Key(), it->Value());
+		m_pNode->GetSensor()->UnregisterFromPropertyChange(m_strModule, it.Key(), it.Value());
 	}
 }
 
diff --git a/Source/XnDeviceSensorV2/XnMultiPropChangedHandler.h b/Source/XnDeviceSensorV2/XnMultiPropChangedHandler.h
index ecae7bf..dfadfe0 100644
--- a/Source/XnDeviceSensorV2/XnMultiPropChangedHandler.h
+++ b/Source/XnDeviceSensorV2/XnMultiPropChangedHandler.h
@@ -26,7 +26,7 @@
 // Includes
 //---------------------------------------------------------------------------
 #include <XnOpenNI.h>
-#include <XnStringsHashT.h>
+#include <XnStringsHash.h>
 #include "XnSensorProductionNode.h"
 #include <XnDevice.h>
 
@@ -50,7 +50,7 @@ protected:
 private:
 	static void XN_CALLBACK_TYPE PropertyChangedCallback(XnDeviceHandle pDeviceHandle, const XnChar* ModuleName, const XnChar* PropertyName, void* pCookie);
 
-	typedef XnStringsHashT<XnCallbackHandle> XnPropertyHandleHash;
+	XN_DECLARE_STRINGS_HASH(XnCallbackHandle, XnPropertyHandleHash);
 
 	XnPropertyHandleHash m_Registered;
 	XnSensorProductionNode* m_pNode;
diff --git a/Source/XnDeviceSensorV2/XnPSCompressedDepthProcessor.cpp b/Source/XnDeviceSensorV2/XnPSCompressedDepthProcessor.cpp
index 442c7d3..d0a98c5 100644
--- a/Source/XnDeviceSensorV2/XnPSCompressedDepthProcessor.cpp
+++ b/Source/XnDeviceSensorV2/XnPSCompressedDepthProcessor.cpp
@@ -29,8 +29,8 @@
 // Code
 //---------------------------------------------------------------------------
 
-XnPSCompressedDepthProcessor::XnPSCompressedDepthProcessor(XnSensorDepthStream* pStream, XnSensorStreamHelper* pHelper, XnFrameBufferManager* pBufferManager) :
-	XnDepthProcessor(pStream, pHelper, pBufferManager)
+XnPSCompressedDepthProcessor::XnPSCompressedDepthProcessor(XnSensorDepthStream* pStream, XnSensorStreamHelper* pHelper) :
+	XnDepthProcessor(pStream, pHelper)
 {
 }
 
@@ -60,12 +60,10 @@ XnPSCompressedDepthProcessor::~XnPSCompressedDepthProcessor()
 		z = XN_DEVICE_SENSOR_NO_DEPTH_VALUE;		\
 	}	
 
-#define XN_DEPTH_OUTPUT(pDepthOutput, pShiftOutput, pOutputEnd, nValue)		                \
-	XN_CHECK_UNC_DEPTH_OUTPUT(pDepthOutput, pOutputEnd, nValue)				                \
-	*pShiftOutput = (((nValue) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (nValue) : 0);     \
-	*pDepthOutput = GetOutput(nValue);										                \
-	++pShiftOutput;															                \
-	++pDepthOutput;
+#define XN_DEPTH_OUTPUT(pOutput, pOutputEnd, nValue)		\
+	XN_CHECK_UNC_DEPTH_OUTPUT(pOutput, pOutputEnd, nValue)	\
+	*pOutput = GetOutput(nValue);							\
+	++pOutput;
 
 #define INIT_INPUT(pInput, nInputSize)					\
 	const XnUInt8* __pInputOrig = pInput;				\
@@ -105,17 +103,17 @@ XnPSCompressedDepthProcessor::~XnPSCompressedDepthProcessor()
 #define GET_INPUT_READ_BYTES (__pCurrInput - __pInputOrig);
 
 XnStatus XnPSCompressedDepthProcessor::UncompressDepthPS(const XnUInt8* pInput, const XnUInt32 nInputSize,
-								   XnUInt16* pDepthOutput, XnUInt16* pShiftOutput, XnUInt32* pnOutputSize,
+								   XnUInt16* pOutput, XnUInt32* pnOutputSize,
 								   XnUInt32* pnActualRead, XnBool bLastPart)
 {
 	// Input is made of 4-bit elements.
 	INIT_INPUT(pInput, nInputSize);
 
-	XnUInt16* pOutputEnd = pDepthOutput + (*pnOutputSize / sizeof(XnDepthPixel));
+	XnUInt16* pOutputEnd = pOutput + (*pnOutputSize / sizeof(XnUInt16));
 	XnUInt16 nLastValue = 0;
 
 	const XnUInt8* pInputOrig = pInput;
-	XnUInt16* pOutputOrig = pDepthOutput;
+	XnUInt16* pOutputOrig = pOutput;
 
 	const XnUInt8* pInputLastPossibleStop = pInputOrig;
 	XnUInt16* pOutputLastPossibleStop = pOutputOrig;
@@ -143,7 +141,7 @@ XnStatus XnPSCompressedDepthProcessor::UncompressDepthPS(const XnUInt8* pInput,
 			nInput++;
 			while (nInput != 0)
 			{
-				XN_DEPTH_OUTPUT(pDepthOutput, pShiftOutput, pOutputEnd, nLastValue);
+				XN_DEPTH_OUTPUT(pOutput, pOutputEnd, nLastValue);
 				--nInput;
 			}
 			break;
@@ -171,7 +169,7 @@ XnStatus XnPSCompressedDepthProcessor::UncompressDepthPS(const XnUInt8* pInput,
 				{
 					// We can stop here. First input is a full value
 					pInputLastPossibleStop = GET_PREV_INPUT(2);
-					pOutputLastPossibleStop = pDepthOutput;
+					pOutputLastPossibleStop = pOutput;
 				}
 
 				nLargeValue = (nInput << 12);
@@ -187,19 +185,19 @@ XnStatus XnPSCompressedDepthProcessor::UncompressDepthPS(const XnUInt8* pInput,
 				nLastValue = (XnUInt16)(nLargeValue | nInput);
 			}
 
-			XN_DEPTH_OUTPUT(pDepthOutput, pShiftOutput, pOutputEnd, nLastValue);
+			XN_DEPTH_OUTPUT(pOutput, pOutputEnd, nLastValue);
 
 			break;
 		default: // all rest (smaller than 0xd) are diffs
 			// diff values are from -6 to 6 (0x0 to 0xc)
 			nLastValue += ((XnInt16)nInput - 6);
-			XN_DEPTH_OUTPUT(pDepthOutput, pShiftOutput, pOutputEnd, nLastValue);
+			XN_DEPTH_OUTPUT(pOutput, pOutputEnd, nLastValue);
 		}
 	}
 
 	if (bLastPart == TRUE)
 	{
-		*pnOutputSize = (XnUInt32)(pDepthOutput - pOutputOrig) * sizeof(XnUInt16);
+		*pnOutputSize = (XnUInt32)(pOutput - pOutputOrig) * sizeof(XnUInt16);
 		*pnActualRead = (XnUInt32)GET_INPUT_READ_BYTES;
 	}
 	else
@@ -245,12 +243,12 @@ void XnPSCompressedDepthProcessor::ProcessFramePacketChunk(const XnSensorProtoco
 		nBufSize = nDataSize;
 	}
 
-	XnUInt32 nOutputSize = GetFreeSpaceInDepthBuffer();
+	XnUInt32 nOutputSize = pWriteBuffer->GetFreeSpaceInBuffer();
 	XnUInt32 nWrittenOutput = nOutputSize;
 	XnUInt32 nActualRead = 0;
 	XnBool bLastPart = pHeader->nType == XN_SENSOR_PROTOCOL_RESPONSE_DEPTH_END && (nDataOffset + nDataSize) == pHeader->nBufSize;
-	XnStatus nRetVal = UncompressDepthPS(pBuf, nBufSize, GetDepthOutputBuffer(), 
-			GetShiftsOutputBuffer(), &nWrittenOutput, &nActualRead, bLastPart);
+	XnStatus nRetVal = UncompressDepthPS(pBuf, nBufSize, (XnUInt16*)pWriteBuffer->GetUnsafeWritePointer(), 
+		&nWrittenOutput, &nActualRead, bLastPart);
 
 	if (nRetVal != XN_STATUS_OK)
 	{
diff --git a/Source/XnDeviceSensorV2/XnPSCompressedDepthProcessor.h b/Source/XnDeviceSensorV2/XnPSCompressedDepthProcessor.h
index 01bd39a..0af4742 100644
--- a/Source/XnDeviceSensorV2/XnPSCompressedDepthProcessor.h
+++ b/Source/XnDeviceSensorV2/XnPSCompressedDepthProcessor.h
@@ -34,7 +34,7 @@
 class XnPSCompressedDepthProcessor : public XnDepthProcessor
 {
 public:
-	XnPSCompressedDepthProcessor(XnSensorDepthStream* pStream, XnSensorStreamHelper* pHelper, XnFrameBufferManager* pBufferManager);
+	XnPSCompressedDepthProcessor(XnSensorDepthStream* pStream, XnSensorStreamHelper* pHelper);
 	virtual ~XnPSCompressedDepthProcessor();
 
 	XnStatus Init();
@@ -51,7 +51,7 @@ protected:
 	// Internal Functions
 	//---------------------------------------------------------------------------
 	XnStatus UncompressDepthPS(const XnUInt8* pInput, const XnUInt32 nInputSize,
-		XnUInt16* pDepthOutput, XnUInt16* pShiftOutput, XnUInt32* pnOutputSize,
+		XnUInt16* pOutput, XnUInt32* pnOutputSize,
 		XnUInt32* pnActualRead, XnBool bLastPart);
 
 private:
diff --git a/Source/XnDeviceSensorV2/XnPSCompressedImageProcessor.cpp b/Source/XnDeviceSensorV2/XnPSCompressedImageProcessor.cpp
index 262a4e6..26a3d60 100644
--- a/Source/XnDeviceSensorV2/XnPSCompressedImageProcessor.cpp
+++ b/Source/XnDeviceSensorV2/XnPSCompressedImageProcessor.cpp
@@ -31,8 +31,8 @@
 // Code
 //---------------------------------------------------------------------------
 
-XnPSCompressedImageProcessor::XnPSCompressedImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper, XnFrameBufferManager* pBufferManager) :
-	XnImageProcessor(pStream, pHelper, pBufferManager)
+XnPSCompressedImageProcessor::XnPSCompressedImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper) :
+	XnImageProcessor(pStream, pHelper)
 {
 }
 
diff --git a/Source/XnDeviceSensorV2/XnPSCompressedImageProcessor.h b/Source/XnDeviceSensorV2/XnPSCompressedImageProcessor.h
index e9a973e..1a5702e 100644
--- a/Source/XnDeviceSensorV2/XnPSCompressedImageProcessor.h
+++ b/Source/XnDeviceSensorV2/XnPSCompressedImageProcessor.h
@@ -34,7 +34,7 @@
 class XnPSCompressedImageProcessor : public XnImageProcessor
 {
 public:
-	XnPSCompressedImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper, XnFrameBufferManager* pBufferManager);
+	XnPSCompressedImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper);
 	~XnPSCompressedImageProcessor();
 
 	XnStatus Init();
diff --git a/Source/XnDeviceSensorV2/XnPacked11DepthProcessor.cpp b/Source/XnDeviceSensorV2/XnPacked11DepthProcessor.cpp
index e760131..7e5cd4f 100644
--- a/Source/XnDeviceSensorV2/XnPacked11DepthProcessor.cpp
+++ b/Source/XnDeviceSensorV2/XnPacked11DepthProcessor.cpp
@@ -24,9 +24,6 @@
 //---------------------------------------------------------------------------
 #include "XnPacked11DepthProcessor.h"
 #include <XnProfiling.h>
-#ifdef XN_NEON
-#include <arm_neon.h>
-#endif
 
 //---------------------------------------------------------------------------
 // Defines
@@ -58,8 +55,8 @@
 //---------------------------------------------------------------------------
 // Code
 //---------------------------------------------------------------------------
-XnPacked11DepthProcessor::XnPacked11DepthProcessor(XnSensorDepthStream* pStream, XnSensorStreamHelper* pHelper, XnFrameBufferManager* pBufferManager) :
-	XnDepthProcessor(pStream, pHelper, pBufferManager)
+XnPacked11DepthProcessor::XnPacked11DepthProcessor(XnSensorDepthStream* pStream, XnSensorStreamHelper* pHelper) :
+	XnDepthProcessor(pStream, pHelper)
 {
 }
 
@@ -89,21 +86,12 @@ XnStatus XnPacked11DepthProcessor::Unpack11to16(const XnUInt8* pcInput, const Xn
 	*pnActualRead = 0;
 	XnBuffer* pWriteBuffer = GetWriteBuffer();
 
-	// Check there is enough room for the depth pixels
-	if (!CheckDepthBufferForOverflow(nNeededOutput))
+	if (!CheckWriteBufferForOverflow(nNeededOutput))
 	{
 		return XN_STATUS_OUTPUT_BUFFER_OVERFLOW;
 	}
 
-	XnUInt16* pShiftOut = GetShiftsOutputBuffer();
-	XnUInt16* pnOutput = GetDepthOutputBuffer();
-
-	XnUInt16 a0,a1,a2,a3,a4,a5,a6,a7;
-#ifdef XN_NEON
-	XnUInt16 shift[8];
-	XnUInt16 depth[8];
-	uint16x8_t Q0;
-#endif
+	XnUInt16* pnOutput = (XnUInt16*)pWriteBuffer->GetUnsafeWritePointer();
 
 	// Convert the 11bit packed data into 16bit shorts
 	for (XnUInt32 nElem = 0; nElem < nElements; ++nElem)
@@ -114,68 +102,17 @@ XnStatus XnPacked11DepthProcessor::Unpack11to16(const XnUInt8* pcInput, const Xn
 		//			---,---,-----,---,---,-----,---,---
 		// output:	  0,  1,    2,  3,  4,    5,  6,  7
 
-		a0 = (XN_TAKE_BITS(pcInput[0],8,0) << 3) | XN_TAKE_BITS(pcInput[1],3,5);
-		a1 = (XN_TAKE_BITS(pcInput[1],5,0) << 6) | XN_TAKE_BITS(pcInput[2],6,2);
-		a2 = (XN_TAKE_BITS(pcInput[2],2,0) << 9) | (XN_TAKE_BITS(pcInput[3],8,0) << 1) | XN_TAKE_BITS(pcInput[4],1,7);
-		a3 = (XN_TAKE_BITS(pcInput[4],7,0) << 4) | XN_TAKE_BITS(pcInput[5],4,4);
-		a4 = (XN_TAKE_BITS(pcInput[5],4,0) << 7) | XN_TAKE_BITS(pcInput[6],7,1);
-		a5 = (XN_TAKE_BITS(pcInput[6],1,0) << 10) | (XN_TAKE_BITS(pcInput[7],8,0) << 2) | XN_TAKE_BITS(pcInput[8],2,6);
-		a6 = (XN_TAKE_BITS(pcInput[8],6,0) << 5) | XN_TAKE_BITS(pcInput[9],5,3);
-		a7 = (XN_TAKE_BITS(pcInput[9],3,0) << 8) | XN_TAKE_BITS(pcInput[10],8,0);
-
-
-#ifdef XN_NEON
-		shift[0] = (((a0) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (a0) : 0);
-		shift[1] = (((a1) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (a1) : 0);
-		shift[2] = (((a2) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (a2) : 0);
-		shift[3] = (((a3) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (a3) : 0);
-		shift[4] = (((a4) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (a4) : 0);
-		shift[5] = (((a5) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (a5) : 0);
-		shift[6] = (((a6) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (a6) : 0);
-		shift[7] = (((a7) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (a7) : 0);
-
-		depth[0] = GetOutput(a0);
-		depth[1] = GetOutput(a1);
-		depth[2] = GetOutput(a2);
-		depth[3] = GetOutput(a3);
-		depth[4] = GetOutput(a4);
-		depth[5] = GetOutput(a5);
-		depth[6] = GetOutput(a6);
-		depth[7] = GetOutput(a7);
-
-		// Load
-		Q0 = vld1q_u16(depth);
-		// Store
-		vst1q_u16(pnOutput, Q0);
-
-		// Load
-		Q0 = vld1q_u16(shift);
-		// Store
-		vst1q_u16(pShiftOut, Q0);
-#else
-		pShiftOut[0] = (((a0) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (a0) : 0);
-		pShiftOut[1] = (((a1) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (a1) : 0);
-		pShiftOut[2] = (((a2) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (a2) : 0);
-		pShiftOut[3] = (((a3) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (a3) : 0);
-		pShiftOut[4] = (((a4) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (a4) : 0);
-		pShiftOut[5] = (((a5) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (a5) : 0);
-		pShiftOut[6] = (((a6) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (a6) : 0);
-		pShiftOut[7] = (((a7) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (a7) : 0);
-
-		pnOutput[0] = GetOutput(a0);
-		pnOutput[1] = GetOutput(a1);
-		pnOutput[2] = GetOutput(a2);
-		pnOutput[3] = GetOutput(a3);
-		pnOutput[4] = GetOutput(a4);
-		pnOutput[5] = GetOutput(a5);
-		pnOutput[6] = GetOutput(a6);
-		pnOutput[7] = GetOutput(a7);
-
-#endif
+		pnOutput[0] = GetOutput((XN_TAKE_BITS(pcInput[0],8,0) << 3) | XN_TAKE_BITS(pcInput[1],3,5));
+		pnOutput[1] = GetOutput((XN_TAKE_BITS(pcInput[1],5,0) << 6) | XN_TAKE_BITS(pcInput[2],6,2));
+		pnOutput[2] = GetOutput((XN_TAKE_BITS(pcInput[2],2,0) << 9) | (XN_TAKE_BITS(pcInput[3],8,0) << 1) | XN_TAKE_BITS(pcInput[4],1,7));
+		pnOutput[3] = GetOutput((XN_TAKE_BITS(pcInput[4],7,0) << 4) | XN_TAKE_BITS(pcInput[5],4,4));
+		pnOutput[4] = GetOutput((XN_TAKE_BITS(pcInput[5],4,0) << 7) | XN_TAKE_BITS(pcInput[6],7,1));
+		pnOutput[5] = GetOutput((XN_TAKE_BITS(pcInput[6],1,0) << 10) | (XN_TAKE_BITS(pcInput[7],8,0) << 2) | XN_TAKE_BITS(pcInput[8],2,6));
+		pnOutput[6] = GetOutput((XN_TAKE_BITS(pcInput[8],6,0) << 5) | XN_TAKE_BITS(pcInput[9],5,3));
+		pnOutput[7] = GetOutput((XN_TAKE_BITS(pcInput[9],3,0) << 8) | XN_TAKE_BITS(pcInput[10],8,0));
 
 		pcInput += XN_INPUT_ELEMENT_SIZE;
 		pnOutput += 8;
-		pShiftOut += 8;
 	}
 
 	*pnActualRead = (XnUInt32)(pcInput - pOrigInput);
diff --git a/Source/XnDeviceSensorV2/XnPacked11DepthProcessor.h b/Source/XnDeviceSensorV2/XnPacked11DepthProcessor.h
index 56b3102..5e9f14f 100644
--- a/Source/XnDeviceSensorV2/XnPacked11DepthProcessor.h
+++ b/Source/XnDeviceSensorV2/XnPacked11DepthProcessor.h
@@ -34,7 +34,7 @@
 class XnPacked11DepthProcessor : public XnDepthProcessor
 {
 public:
-	XnPacked11DepthProcessor(XnSensorDepthStream* pStream, XnSensorStreamHelper* pHelper, XnFrameBufferManager* pBufferManager);
+	XnPacked11DepthProcessor(XnSensorDepthStream* pStream, XnSensorStreamHelper* pHelper);
 	virtual ~XnPacked11DepthProcessor();
 
 	XnStatus Init();
diff --git a/Source/XnDeviceSensorV2/XnPacked12DepthProcessor.cpp b/Source/XnDeviceSensorV2/XnPacked12DepthProcessor.cpp
deleted file mode 100644
index 9437063..0000000
--- a/Source/XnDeviceSensorV2/XnPacked12DepthProcessor.cpp
+++ /dev/null
@@ -1,331 +0,0 @@
-/****************************************************************************
-*                                                                           *
-*  PrimeSense Sensor 5.x Alpha                                              *
-*  Copyright (C) 2011 PrimeSense Ltd.                                       *
-*                                                                           *
-*  This file is part of PrimeSense Sensor.                                  *
-*                                                                           *
-*  PrimeSense Sensor is free software: you can redistribute it and/or modify*
-*  it under the terms of the GNU Lesser General Public License as published *
-*  by the Free Software Foundation, either version 3 of the License, or     *
-*  (at your option) any later version.                                      *
-*                                                                           *
-*  PrimeSense Sensor is distributed in the hope that it will be useful,     *
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the             *
-*  GNU Lesser General Public License for more details.                      *
-*                                                                           *
-*  You should have received a copy of the GNU Lesser General Public License *
-*  along with PrimeSense Sensor. If not, see <http://www.gnu.org/licenses/>.*
-*                                                                           *
-****************************************************************************/
-//---------------------------------------------------------------------------
-// Includes
-//---------------------------------------------------------------------------
-#include "XnPacked12DepthProcessor.h"
-#include <XnProfiling.h>
-#ifdef XN_NEON
-#include <arm_neon.h>
-#endif
-
-//---------------------------------------------------------------------------
-// Defines
-//---------------------------------------------------------------------------
-/* The size of an input element in the stream. */
-#define XN_INPUT_ELEMENT_SIZE 24
-/* The size of an output element in the stream. */
-#define XN_OUTPUT_ELEMENT_SIZE 32
-
-//---------------------------------------------------------------------------
-// Macros
-//---------------------------------------------------------------------------
-/* Returns a set of <count> bits. For example XN_ON_BITS(4) returns 0xF */
-#define XN_ON_BITS(count)				((1 << count)-1)
-
-/* Creates a mask of <count> bits in offset <offset> */
-#define XN_CREATE_MASK(count, offset)	(XN_ON_BITS(count) << offset)
-
-/* Takes the <count> bits in offset <offset> from <source>.
-*  For example: 
-*  If we want 3 bits located in offset 2 from 0xF4:
-*  11110100
-*     ---
-*  we get 101, which is 0x5.
-*  and so, XN_TAKE_BITS(0xF4,3,2) == 0x5.
-*/
-#define XN_TAKE_BITS(source, count, offset)		((source & XN_CREATE_MASK(count, offset)) >> offset)
-
-//---------------------------------------------------------------------------
-// Code
-//---------------------------------------------------------------------------
-XnPacked12DepthProcessor::XnPacked12DepthProcessor(XnSensorDepthStream* pStream, XnSensorStreamHelper* pHelper, XnFrameBufferManager* pBufferManager) :
-	XnDepthProcessor(pStream, pHelper, pBufferManager)
-{
-}
-
-XnStatus XnPacked12DepthProcessor::Init()
-{
-	XnStatus nRetVal = XN_STATUS_OK;
-
-	nRetVal = XnDepthProcessor::Init();
-	XN_IS_STATUS_OK(nRetVal);
-
-	XN_VALIDATE_BUFFER_ALLOCATE(m_ContinuousBuffer, XN_INPUT_ELEMENT_SIZE);
-
-	return (XN_STATUS_OK);
-}
-
-XnPacked12DepthProcessor::~XnPacked12DepthProcessor()
-{
-}
-
-XnStatus XnPacked12DepthProcessor::Unpack12to16(const XnUInt8* pcInput, const XnUInt32 nInputSize, XnUInt32* pnActualRead)
-{
-	const XnUInt8* pOrigInput = pcInput;
-
-	XnUInt32 nElements = nInputSize / XN_INPUT_ELEMENT_SIZE; // floored
-	XnUInt32 nNeededOutput = nElements * XN_OUTPUT_ELEMENT_SIZE;
-
-	*pnActualRead = 0;
-	XnBuffer* pWriteBuffer = GetWriteBuffer();
-
-	if (!CheckDepthBufferForOverflow(nNeededOutput))
-	{
-		return XN_STATUS_OUTPUT_BUFFER_OVERFLOW;
-	}
-
-	XnUInt16* pnOutput = GetDepthOutputBuffer();
-	XnUInt16* pShiftOut = GetShiftsOutputBuffer();
-	XnUInt16 shift[16];
-#ifdef XN_NEON
-	XnUInt16 depth[16];
-	uint8x8x3_t inD3;
-	uint8x8_t rshft4D, lshft4D;
-	uint16x8_t rshft4Q, lshft4Q;
-	uint16x8_t depthQ;
-	uint16x8x2_t shiftQ2;
-#endif
-
-	// Convert the 11bit packed data into 16bit shorts
-	for (XnUInt32 nElem = 0; nElem < nElements; ++nElem)
-	{
-#ifndef XN_NEON
-		// input:	0,  1,2,3,  4,5,6,  7,8,9, 10,11,12, 13,14,15, 16,17,18, 19,20,21, 22,23
-		//			-,---,-,-,---,-,-,---,-,-,---,--,--,---,--,--,---,--,--,---,--,--,---,--
-		// bits:	8,4,4,8,8,4,4,8,8,4,4,8,8,4,4, 8, 8,4,4, 8, 8,4,4, 8, 8,4,4, 8, 8,4,4, 8
-		//			---,---,---,---,---,---,---,----,----,----,----,----,----,----,----,----
-		// output:	  0,  1,  2,  3,  4,  5,  6,   7,   8,   9,  10,  11,  12,  13,  14,  15
-
-		shift[0] = (XN_TAKE_BITS(pcInput[0],8,0) << 4) | XN_TAKE_BITS(pcInput[1],4,4);
-		shift[1] = (XN_TAKE_BITS(pcInput[1],4,0) << 8) | XN_TAKE_BITS(pcInput[2],8,0);
-		shift[2] = (XN_TAKE_BITS(pcInput[3],8,0) << 4) | XN_TAKE_BITS(pcInput[4],4,4);
-		shift[3] = (XN_TAKE_BITS(pcInput[4],4,0) << 8) | XN_TAKE_BITS(pcInput[5],8,0);
-		shift[4] = (XN_TAKE_BITS(pcInput[6],8,0) << 4) | XN_TAKE_BITS(pcInput[7],4,4);
-		shift[5] = (XN_TAKE_BITS(pcInput[7],4,0) << 8) | XN_TAKE_BITS(pcInput[8],8,0);
-		shift[6] = (XN_TAKE_BITS(pcInput[9],8,0) << 4) | XN_TAKE_BITS(pcInput[10],4,4);
-		shift[7] = (XN_TAKE_BITS(pcInput[10],4,0) << 8) | XN_TAKE_BITS(pcInput[11],8,0);
-		shift[8] = (XN_TAKE_BITS(pcInput[12],8,0) << 4) | XN_TAKE_BITS(pcInput[13],4,4);
-		shift[9] = (XN_TAKE_BITS(pcInput[13],4,0) << 8) | XN_TAKE_BITS(pcInput[14],8,0);
-		shift[10] = (XN_TAKE_BITS(pcInput[15],8,0) << 4) | XN_TAKE_BITS(pcInput[16],4,4);
-		shift[11] = (XN_TAKE_BITS(pcInput[16],4,0) << 8) | XN_TAKE_BITS(pcInput[17],8,0);
-		shift[12] = (XN_TAKE_BITS(pcInput[18],8,0) << 4) | XN_TAKE_BITS(pcInput[19],4,4);
-		shift[13] = (XN_TAKE_BITS(pcInput[19],4,0) << 8) | XN_TAKE_BITS(pcInput[20],8,0);
-		shift[14] = (XN_TAKE_BITS(pcInput[21],8,0) << 4) | XN_TAKE_BITS(pcInput[22],4,4);
-		shift[15] = (XN_TAKE_BITS(pcInput[22],4,0) << 8) | XN_TAKE_BITS(pcInput[23],8,0);
-
-		pShiftOut[0] = (((shift[0]) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (shift[0]) : 0);
-		pShiftOut[1] = (((shift[1]) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (shift[1]) : 0);
-		pShiftOut[2] = (((shift[2]) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (shift[2]) : 0);
-		pShiftOut[3] = (((shift[3]) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (shift[3]) : 0);
-		pShiftOut[4] = (((shift[4]) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (shift[4]) : 0);
-		pShiftOut[5] = (((shift[5]) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (shift[5]) : 0);
-		pShiftOut[6] = (((shift[6]) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (shift[6]) : 0);
-		pShiftOut[7] = (((shift[7]) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (shift[7]) : 0);
-		pShiftOut[8] = (((shift[0]) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (shift[8]) : 0);
-		pShiftOut[9] = (((shift[1]) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (shift[9]) : 0);
-		pShiftOut[10] = (((shift[2]) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (shift[10]) : 0);
-		pShiftOut[11] = (((shift[3]) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (shift[11]) : 0);
-		pShiftOut[12] = (((shift[4]) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (shift[12]) : 0);
-		pShiftOut[13] = (((shift[5]) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (shift[13]) : 0);
-		pShiftOut[14] = (((shift[6]) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (shift[14]) : 0);
-		pShiftOut[15] = (((shift[7]) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (shift[15]) : 0);
-
-		pnOutput[0] = GetOutput(shift[0]);
-		pnOutput[1] = GetOutput(shift[1]);
-		pnOutput[2] = GetOutput(shift[2]);
-		pnOutput[3] = GetOutput(shift[3]);
-		pnOutput[4] = GetOutput(shift[4]);
-		pnOutput[5] = GetOutput(shift[5]);
-		pnOutput[6] = GetOutput(shift[6]);
-		pnOutput[7] = GetOutput(shift[7]);
-		pnOutput[8] = GetOutput(shift[8]);
-		pnOutput[9] = GetOutput(shift[9]);
-		pnOutput[10] = GetOutput(shift[10]);
-		pnOutput[11] = GetOutput(shift[11]);
-		pnOutput[12] = GetOutput(shift[12]);
-		pnOutput[13] = GetOutput(shift[13]);
-		pnOutput[14] = GetOutput(shift[14]);
-		pnOutput[15] = GetOutput(shift[15]);
-
-#else
-		// input:	0,  1,2    (X8)
-		//			-,---,-
-		// bits:	8,4,4,8    (X8)
-		//			---,---
-		// output:	  0,  1    (X8)
-
-		// Split 24 bytes into 3 vectors (64 bit each)
-		inD3 = vld3_u8(pcInput);
-
-		// rshft4D0 contains 4 MSB of second vector (placed at offset 0)
-		rshft4D = vshr_n_u8(inD3.val[1], 4);
-		// lshft4D0 contains 4 LSB of second vector (placed at offset 4)
-		lshft4D = vshl_n_u8(inD3.val[1], 4);
-
-		// Expand 64 bit vectors to 128 bit (8 values of 16 bits)
-		shiftQ2.val[0] = vmovl_u8(inD3.val[0]);
-		shiftQ2.val[1] = vmovl_u8(inD3.val[2]);
-		rshft4Q = vmovl_u8(rshft4D);
-		lshft4Q = vmovl_u8(lshft4D);
-
-		// Even indexed shift = 8 bits from first vector + 4 MSB bits of second vector
-		shiftQ2.val[0] = vshlq_n_u16(shiftQ2.val[0], 4);
-		shiftQ2.val[0] = vorrq_u16(shiftQ2.val[0], rshft4Q);
-		
-		// Odd indexed shift = 4 LSB bits of second vector + 8 bits from third vector
-		lshft4Q = vshlq_n_u16(lshft4Q, 4);
-		shiftQ2.val[1] = vorrq_u16(shiftQ2.val[1], lshft4Q);
-		
-		// Interleave shift values to a single vector
-		vst2q_u16(shift, shiftQ2);
-
-		shift[0] = (((shift[0]) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (shift[0]) : 0);
-		shift[1] = (((shift[1]) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (shift[1]) : 0);
-		shift[2] = (((shift[2]) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (shift[2]) : 0);
-		shift[3] = (((shift[3]) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (shift[3]) : 0);
-		shift[4] = (((shift[4]) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (shift[4]) : 0);
-		shift[5] = (((shift[5]) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (shift[5]) : 0);
-		shift[6] = (((shift[6]) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (shift[6]) : 0);
-		shift[7] = (((shift[7]) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (shift[7]) : 0);
-		shift[8] = (((shift[0]) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (shift[8]) : 0);
-		shift[9] = (((shift[1]) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (shift[9]) : 0);
-		shift[10] = (((shift[2]) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (shift[10]) : 0);
-		shift[11] = (((shift[3]) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (shift[11]) : 0);
-		shift[12] = (((shift[4]) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (shift[12]) : 0);
-		shift[13] = (((shift[5]) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (shift[13]) : 0);
-		shift[14] = (((shift[6]) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (shift[14]) : 0);
-		shift[15] = (((shift[7]) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (shift[15]) : 0);
-
-		depth[0] = GetOutput(shift[0]);
-		depth[1] = GetOutput(shift[1]);
-
-		depth[2] = GetOutput(shift[2]);
-		depth[3] = GetOutput(shift[3]);
-
-		depth[4] = GetOutput(shift[4]);
-		depth[5] = GetOutput(shift[5]);
-
-		depth[6] = GetOutput(shift[6]);
-		depth[7] = GetOutput(shift[7]);
-
-		// Load
-		depthQ = vld1q_u16(depth);
-		//Store
-		vst1q_u16(pnOutput, depthQ);
-
-		// Load
-		depthQ = vld1q_u16(shift);
-		// Store
-		vst1q_u16(pShiftOut, depthQ);
-
-		depth[8] = GetOutput(shift[8]);
-		depth[9] = GetOutput(shift[9]);
-
-		depth[10] = GetOutput(shift[10]);
-		depth[11] = GetOutput(shift[11]);
-
-		depth[12] = GetOutput(shift[12]);
-		depth[13] = GetOutput(shift[13]);
-
-		depth[14] = GetOutput(shift[14]);
-		depth[15] = GetOutput(shift[15]);
-
-		// Load
-		depthQ = vld1q_u16(depth + 8);
-		// Store
-		vst1q_u16(pnOutput + 8, depthQ);
-
-		// Load
-		depthQ = vld1q_u16(shift + 8);
-		// Store
-		vst1q_u16(pShiftOut + 8, depthQ);
-
-#endif
-
-		pcInput += XN_INPUT_ELEMENT_SIZE;
-		pnOutput += 16;
-		pShiftOut += 16;
-	}
-
-
-	*pnActualRead = (XnUInt32)(pcInput - pOrigInput);
-	pWriteBuffer->UnsafeUpdateSize(nNeededOutput);
-
-	return XN_STATUS_OK;
-}
-
-void XnPacked12DepthProcessor::ProcessFramePacketChunk(const XnSensorProtocolResponseHeader* /*pHeader*/, const XnUChar* pData, XnUInt32 /*nDataOffset*/, XnUInt32 nDataSize)
-{
-	XN_PROFILING_START_SECTION("XnPacked12DepthProcessor::ProcessFramePacketChunk")
-
-	XnStatus nRetVal = XN_STATUS_OK;
-
-	// check if we have data from previous packet
-	if (m_ContinuousBuffer.GetSize() != 0)
-	{
-		// fill in to a whole element
-		XnUInt32 nReadBytes = XN_MIN(nDataSize, XN_INPUT_ELEMENT_SIZE - m_ContinuousBuffer.GetSize());
-		m_ContinuousBuffer.UnsafeWrite(pData, nReadBytes);
-		pData += nReadBytes;
-		nDataSize -= nReadBytes;
-
-		if (m_ContinuousBuffer.GetSize() == XN_INPUT_ELEMENT_SIZE)
-		{
-			// process it
-			XnUInt32 nActualRead = 0;
-			Unpack12to16(m_ContinuousBuffer.GetData(), XN_INPUT_ELEMENT_SIZE, &nActualRead);
-			m_ContinuousBuffer.Reset();
-		}
-	}
-
-	// find out the number of input elements we have
-	XnUInt32 nActualRead = 0;
-	nRetVal = Unpack12to16(pData, nDataSize, &nActualRead);
-	if (nRetVal == XN_STATUS_OK)
-	{
-		pData += nActualRead;
-		nDataSize -= nActualRead;
-
-		// if we have any bytes left, store them for next packet.
-		if (nDataSize > 0)
-		{
-			// no need to check for overflow. there can not be a case in which more than XN_INPUT_ELEMENT_SIZE
-			// are left.
-			m_ContinuousBuffer.UnsafeWrite(pData, nDataSize);
-		}
-	}
-
-	XN_PROFILING_END_SECTION
-}
-
-void XnPacked12DepthProcessor::OnStartOfFrame(const XnSensorProtocolResponseHeader* pHeader)
-{
-	XnDepthProcessor::OnStartOfFrame(pHeader);
-	m_ContinuousBuffer.Reset();
-}
-
-void XnPacked12DepthProcessor::OnEndOfFrame(const XnSensorProtocolResponseHeader* pHeader)
-{
-	XnDepthProcessor::OnEndOfFrame(pHeader);
-	m_ContinuousBuffer.Reset();
-}
diff --git a/Source/XnDeviceSensorV2/XnPacked12DepthProcessor.h b/Source/XnDeviceSensorV2/XnPacked12DepthProcessor.h
deleted file mode 100644
index aa379f6..0000000
--- a/Source/XnDeviceSensorV2/XnPacked12DepthProcessor.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-*                                                                           *
-*  PrimeSense Sensor 5.x Alpha                                              *
-*  Copyright (C) 2011 PrimeSense Ltd.                                       *
-*                                                                           *
-*  This file is part of PrimeSense Sensor.                                  *
-*                                                                           *
-*  PrimeSense Sensor is free software: you can redistribute it and/or modify*
-*  it under the terms of the GNU Lesser General Public License as published *
-*  by the Free Software Foundation, either version 3 of the License, or     *
-*  (at your option) any later version.                                      *
-*                                                                           *
-*  PrimeSense Sensor is distributed in the hope that it will be useful,     *
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the             *
-*  GNU Lesser General Public License for more details.                      *
-*                                                                           *
-*  You should have received a copy of the GNU Lesser General Public License *
-*  along with PrimeSense Sensor. If not, see <http://www.gnu.org/licenses/>.*
-*                                                                           *
-****************************************************************************/
-#ifndef __XN_PACKED_12_DEPTH_PROCESSOR_H__
-#define __XN_PACKED_12_DEPTH_PROCESSOR_H__
-
-//---------------------------------------------------------------------------
-// Includes
-//---------------------------------------------------------------------------
-#include "XnDepthProcessor.h"
-
-//---------------------------------------------------------------------------
-// Code
-//---------------------------------------------------------------------------
-
-class XnPacked12DepthProcessor : public XnDepthProcessor
-{
-public:
-	XnPacked12DepthProcessor(XnSensorDepthStream* pStream, XnSensorStreamHelper* pHelper, XnFrameBufferManager* pBufferManager);
-	virtual ~XnPacked12DepthProcessor();
-
-	XnStatus Init();
-
-protected:
-	//---------------------------------------------------------------------------
-	// Overridden Functions
-	//---------------------------------------------------------------------------
-	virtual void ProcessFramePacketChunk(const XnSensorProtocolResponseHeader* pHeader, const XnUChar* pData, XnUInt32 nDataOffset, XnUInt32 nDataSize);
-	virtual	void OnStartOfFrame(const XnSensorProtocolResponseHeader* pHeader);
-	virtual	void OnEndOfFrame(const XnSensorProtocolResponseHeader* pHeader);
-
-	//---------------------------------------------------------------------------
-	// Internal Functions
-	//---------------------------------------------------------------------------
-	XnStatus Unpack12to16(const XnUInt8* pcInput, const XnUInt32 nInputSize, XnUInt32* pnActualRead);
-
-	//---------------------------------------------------------------------------
-	// Class Members
-	//---------------------------------------------------------------------------
-private:
-	/* A buffer used for storing some left-over bytes for the next packet. */
-	XnBuffer m_ContinuousBuffer;
-};
-
-#endif //__XN_PACKED_12_DEPTH_PROCESSOR_H__
diff --git a/Source/XnDeviceSensorV2/XnParams.h b/Source/XnDeviceSensorV2/XnParams.h
index 222fcd3..6a2b4fe 100644
--- a/Source/XnDeviceSensorV2/XnParams.h
+++ b/Source/XnDeviceSensorV2/XnParams.h
@@ -107,7 +107,6 @@ typedef enum
 	PARAM_IMAGE_AUTO_EXPOSURE_MODE = 80,
 	PARAM_IMAGE_EXPOSURE_BAR = 81,
 	PARAM_IMAGE_LOW_LIGHT_COMPENSATION_MODE = 82,
-	PARAM_DEPTH_CLOSE_RANGE = 84,
 } EConfig_Params;
 
 typedef enum XnExecuter
diff --git a/Source/XnDeviceSensorV2/XnSensor.cpp b/Source/XnDeviceSensorV2/XnSensor.cpp
index b8b8d01..d7af809 100644
--- a/Source/XnDeviceSensorV2/XnSensor.cpp
+++ b/Source/XnDeviceSensorV2/XnSensor.cpp
@@ -39,7 +39,7 @@
 #define XN_SENSOR_MAX_STREAM_COUNT						5
 #define XN_SENSOR_FRAME_SYNC_MAX_DIFF					3
 #define XN_SENSOR_DEFAULT_CLOSE_STREAMS_ON_SHUTDOWN		TRUE
-#define XN_SENSOR_DEFAULT_HOST_TIMESTAMPS				FALSE
+#define XN_SENSOR_DEFAULT_ENABLE_MULTI_USERS			FALSE
 #define XN_GLOBAL_CONFIG_FILE_NAME						"GlobalDefaults.ini"
 
 // on weak platforms (Arm), we prefer to use BULK
@@ -62,12 +62,12 @@ typedef struct XnWaitForSycnhedFrameData
 //---------------------------------------------------------------------------
 // Code
 //---------------------------------------------------------------------------
-XnSensor::XnSensor(XnBool bResetOnStartup /* = TRUE */, XnBool bLeanInit /* = FALSE */) :
+XnSensor::XnSensor() :
 	XnDeviceBase(XN_DEVICE_NAME, TRUE),
 	m_ErrorState(XN_MODULE_PROPERTY_ERROR_STATE, XN_STATUS_OK),
-	m_ResetSensorOnStartup(XN_MODULE_PROPERTY_RESET_SENSOR_ON_STARTUP, bResetOnStartup),
-	m_LeanInit(XN_MODULE_PROPERTY_LEAN_INIT, bLeanInit),
-	m_Interface(XN_MODULE_PROPERTY_USB_INTERFACE, bResetOnStartup ? XN_SENSOR_DEFAULT_USB_INTERFACE : XN_SENSOR_USB_INTERFACE_DEFAULT),
+	m_ResetSensorOnStartup(XN_MODULE_PROPERTY_RESET_SENSOR_ON_STARTUP, TRUE),
+	m_Interface(XN_MODULE_PROPERTY_USB_INTERFACE, XN_SENSOR_DEFAULT_USB_INTERFACE),
+	m_NumberOfBuffers(XN_MODULE_PROPERTY_NUMBER_OF_BUFFERS, 6),
 	m_ReadFromEP1(XN_MODULE_PROPERTY_READ_ENDPOINT_1, TRUE),
 	m_ReadFromEP2(XN_MODULE_PROPERTY_READ_ENDPOINT_2, TRUE),
 	m_ReadFromEP3(XN_MODULE_PROPERTY_READ_ENDPOINT_3, TRUE),
@@ -81,23 +81,19 @@ XnSensor::XnSensor(XnBool bResetOnStartup /* = TRUE */, XnBool bLeanInit /* = FA
 	m_Version(XN_MODULE_PROPERTY_VERSION, &m_DevicePrivateData.Version, sizeof(m_DevicePrivateData.Version), NULL),
 	m_FixedParam(XN_MODULE_PROPERTY_FIXED_PARAMS, NULL),
 	m_CloseStreamsOnShutdown(XN_MODULE_PROPERTY_CLOSE_STREAMS_ON_SHUTDOWN, XN_SENSOR_DEFAULT_CLOSE_STREAMS_ON_SHUTDOWN),
-	m_HostTimestamps(XN_MODULE_PROPERTY_HOST_TIMESTAMPS, XN_SENSOR_DEFAULT_HOST_TIMESTAMPS),
 	m_ID(XN_MODULE_PROPERTY_ID),
 	m_InstancePointer(XN_SENSOR_PROPERTY_INSTANCE_POINTER),
 	m_USBPath(XN_MODULE_PROPERTY_USB_PATH),
 	m_DeviceName(XN_MODULE_PROPERTY_PHYSICAL_DEVICE_NAME),
 	m_VendorSpecificData(XN_MODULE_PROPERTY_VENDOR_SPECIFIC_DATA),
-	m_PlatformString(XN_MODULE_PROPERTY_SENSOR_PLATFORM_STRING),
+	m_AllowOtherUsers(XN_MODULE_PROPERTY_ENABLE_MULTI_USERS, XN_SENSOR_DEFAULT_ENABLE_MULTI_USERS),
 	m_AudioSupported(XN_MODULE_PROPERTY_AUDIO_SUPPORTED),
-	m_ImageSupported(XN_MODULE_PROPERTY_IMAGE_SUPPORTED),
-	m_ImageControl(XN_MODULE_PROPERTY_IMAGE_CONTROL, NULL),
-	m_DepthControl(XN_MODULE_PROPERTY_DEPTH_CONTROL, NULL),
-	m_AHB(XN_MODULE_PROPERTY_AHB, NULL),
 	m_Firmware(&m_DevicePrivateData),
+	m_FixedParams(&m_Firmware, &m_DevicePrivateData),
 	m_SensorIO(&m_DevicePrivateData.SensorHandle),
 	m_FPS(),
 	m_CmosInfo(&m_Firmware, &m_DevicePrivateData),
-	m_Objects(&m_Firmware, &m_DevicePrivateData, &m_FPS, &m_CmosInfo),
+	m_Objects(&m_Firmware, &m_DevicePrivateData, &m_FixedParams, &m_FPS, &m_CmosInfo),
 	m_FrameSyncDump(NULL),
 	m_bInitialized(FALSE)
 {
@@ -106,8 +102,9 @@ XnSensor::XnSensor(XnBool bResetOnStartup /* = TRUE */, XnBool bLeanInit /* = FA
 	m_strGlobalConfigFile[0] = '\0';
 
 	m_ResetSensorOnStartup.UpdateSetCallbackToDefault();
-	m_LeanInit.UpdateSetCallbackToDefault();
 	m_Interface.UpdateSetCallback(SetInterfaceCallback, this);
+	m_AllowOtherUsers.UpdateSetCallback(SetAllowOtherUsersCallback, this);
+	m_NumberOfBuffers.UpdateSetCallback(SetNumberOfBuffersCallback, this);
 	m_ReadFromEP1.UpdateSetCallback(SetReadEndpoint1Callback, this);
 	m_ReadFromEP2.UpdateSetCallback(SetReadEndpoint2Callback, this);
 	m_ReadFromEP3.UpdateSetCallback(SetReadEndpoint3Callback, this);
@@ -124,16 +121,8 @@ XnSensor::XnSensor(XnBool bResetOnStartup /* = TRUE */, XnBool bLeanInit /* = FA
 	m_FirmwareMode.UpdateGetCallback(GetFirmwareModeCallback, this);
 	m_FixedParam.UpdateGetCallback(GetFixedParamsCallback, this);
 	m_CloseStreamsOnShutdown.UpdateSetCallbackToDefault();
-	m_HostTimestamps.UpdateSetCallbackToDefault();
 	m_AudioSupported.UpdateGetCallback(GetAudioSupportedCallback, this);
-	m_ImageSupported.UpdateGetCallback(GetImageSupportedCallback, this);
 	m_InstancePointer.UpdateGetCallback(GetInstanceCallback, this);
-	m_ImageControl.UpdateSetCallback(SetImageCmosRegisterCallback, this);
-	m_ImageControl.UpdateGetCallback(GetImageCmosRegisterCallback, this);
-	m_DepthControl.UpdateSetCallback(SetDepthCmosRegisterCallback, this);
-	m_DepthControl.UpdateGetCallback(GetDepthCmosRegisterCallback, this);
-	m_AHB.UpdateSetCallback(WriteAHBCallback, this);
-	m_AHB.UpdateGetCallback(ReadAHBCallback, this);
 
 }
 
@@ -175,13 +164,13 @@ XnStatus XnSensor::InitImpl(const XnDeviceConfig *pDeviceConfig)
 
 	// Frame Sync
 	XnCallbackHandle hCallbackDummy;
-	nRetVal = m_FrameSync.OnChangeEvent().Register(FrameSyncPropertyChangedCallback, this, hCallbackDummy);
+	nRetVal = m_FrameSync.OnChangeEvent().Register(FrameSyncPropertyChangedCallback, this, &hCallbackDummy);
 	XN_IS_STATUS_OK(nRetVal);
 
-	nRetVal = GetFirmware()->GetParams()->m_Stream0Mode.OnChangeEvent().Register(FrameSyncPropertyChangedCallback, this, hCallbackDummy);
+	nRetVal = GetFirmware()->GetParams()->m_Stream0Mode.OnChangeEvent().Register(FrameSyncPropertyChangedCallback, this, &hCallbackDummy);
 	XN_IS_STATUS_OK(nRetVal);
 
-	nRetVal = GetFirmware()->GetParams()->m_Stream1Mode.OnChangeEvent().Register(FrameSyncPropertyChangedCallback, this, hCallbackDummy);
+	nRetVal = GetFirmware()->GetParams()->m_Stream1Mode.OnChangeEvent().Register(FrameSyncPropertyChangedCallback, this, &hCallbackDummy);
 	XN_IS_STATUS_OK(nRetVal);
 
 	// other stuff
@@ -217,6 +206,8 @@ XnStatus XnSensor::InitSensor(const XnDeviceConfig* pDeviceConfig)
 
 	xnOSMemSet(pDevicePrivateData->cpSensorID, 0, XN_SENSOR_PROTOCOL_SENSOR_ID_LENGTH);
 
+	pDevicePrivateData->bSyncAudio = TRUE;
+
 	switch (pDeviceConfig->DeviceMode)
 	{
 	case XN_DEVICE_MODE_READ:
@@ -245,36 +236,43 @@ XnStatus XnSensor::InitSensor(const XnDeviceConfig* pDeviceConfig)
 	XN_IS_STATUS_OK(nRetVal);
 
 	// init firmware
-	nRetVal = m_Firmware.Init((XnBool)m_ResetSensorOnStartup.GetValue(), (XnBool)m_LeanInit.GetValue());
+	nRetVal = m_Firmware.Init((XnBool)m_ResetSensorOnStartup.GetValue());
 	XN_IS_STATUS_OK(nRetVal);
 	m_bInitialized = TRUE;
 
 	m_ResetSensorOnStartup.UpdateSetCallback(NULL, NULL);
-	m_LeanInit.UpdateSetCallback(NULL, NULL);
 
-	// update device info properties
-	nRetVal = m_DeviceName.UnsafeUpdateValue(GetFixedParams()->GetDeviceName());
+	// Init modules
+	nRetVal = m_FixedParams.Init();
 	XN_IS_STATUS_OK(nRetVal);
-	nRetVal = m_VendorSpecificData.UnsafeUpdateValue(GetFixedParams()->GetVendorData());
+
+	XnDeviceInformation deviceInfo;
+	strcpy(deviceInfo.strDeviceName, "PrimeSense Sensor");
+	strcpy(deviceInfo.strVendorData, "");
+
+	// try to take device information (only supported from 5.3.25)
+	if (pDevicePrivateData->Version.nMajor > 5 ||
+		(pDevicePrivateData->Version.nMajor == 5 && pDevicePrivateData->Version.nMinor > 3) ||
+		(pDevicePrivateData->Version.nMajor == 5 && pDevicePrivateData->Version.nMinor == 3 && pDevicePrivateData->Version.nBuild >= 25))
+	{
+		nRetVal = XnHostProtocolAlgorithmParams(pDevicePrivateData, XN_HOST_PROTOCOL_ALGORITHM_DEVICE_INFO, 
+			&deviceInfo, sizeof(deviceInfo), (XnResolutions)0, 0);
+		XN_IS_STATUS_OK(nRetVal);
+	}
+
+	nRetVal = m_DeviceName.UnsafeUpdateValue(deviceInfo.strDeviceName);
 	XN_IS_STATUS_OK(nRetVal);
-	nRetVal = m_ID.UnsafeUpdateValue(GetFixedParams()->GetSensorSerial());
+	nRetVal = m_VendorSpecificData.UnsafeUpdateValue(deviceInfo.strVendorData);
 	XN_IS_STATUS_OK(nRetVal);
-	nRetVal = m_PlatformString.UnsafeUpdateValue(GetFixedParams()->GetPlatformString());
+
+	// update serial number
+	nRetVal = m_ID.UnsafeUpdateValue(m_FixedParams.GetSensorSerial());
 	XN_IS_STATUS_OK(nRetVal);
 
-	// Add supported streams
 	AddSupportedStream(XN_STREAM_TYPE_DEPTH);
+	AddSupportedStream(XN_STREAM_TYPE_IMAGE);
 	AddSupportedStream(XN_STREAM_TYPE_IR);
-
-	if (GetFirmware()->GetInfo()->bImageSupported)
-	{
-		AddSupportedStream(XN_STREAM_TYPE_IMAGE);
-	}
-
-	if (GetFirmware()->GetInfo()->bAudioSupported)
-	{
-		AddSupportedStream(XN_STREAM_TYPE_AUDIO);
-	}
+	AddSupportedStream(XN_STREAM_TYPE_AUDIO);
 
 	return XN_STATUS_OK;
 }
@@ -298,6 +296,13 @@ XnStatus XnSensor::Destroy()
 	m_bInitialized = FALSE;
 
 
+	// close critical sections
+	if (pDevicePrivateData->hAudioBufferCriticalSection != NULL)
+	{
+		xnOSCloseCriticalSection(&pDevicePrivateData->hAudioBufferCriticalSection);
+		pDevicePrivateData->hAudioBufferCriticalSection = NULL;
+	}
+
 	if (pDevicePrivateData->hEndPointsCS != NULL)
 	{
 		xnOSCloseCriticalSection(&pDevicePrivateData->hEndPointsCS);
@@ -344,12 +349,11 @@ XnStatus XnSensor::CreateDeviceModule(XnDeviceModuleHolder** ppModuleHolder)
 	XnDeviceModule* pModule = (*ppModuleHolder)->GetModule();
 	XnProperty* pProps[] = 
 	{ 
-		&m_ErrorState, &m_ResetSensorOnStartup, &m_LeanInit, &m_Interface, &m_ReadFromEP1,
-		&m_ReadFromEP2, &m_ReadFromEP3, &m_ReadData, &m_FirmwareParam, 
+		&m_ErrorState, &m_ResetSensorOnStartup, &m_Interface, &m_ReadFromEP1,
+		&m_ReadFromEP2, &m_ReadFromEP3, &m_ReadData, &m_NumberOfBuffers, &m_FirmwareParam, 
 		&m_CmosBlankingUnits, &m_CmosBlankingTime, &m_Reset, &m_FirmwareMode, &m_Version, 
 		&m_FixedParam, &m_FrameSync, &m_CloseStreamsOnShutdown, &m_InstancePointer, &m_ID,
-		&m_USBPath, &m_DeviceName, &m_VendorSpecificData, &m_AudioSupported, &m_ImageSupported,
-		&m_ImageControl, &m_DepthControl, &m_AHB, &m_HostTimestamps, &m_PlatformString,
+		&m_USBPath, &m_DeviceName, &m_VendorSpecificData, &m_AllowOtherUsers, &m_AudioSupported,
 	};
 
 	nRetVal = pModule->AddProperties(pProps, sizeof(pProps)/sizeof(XnProperty*));
@@ -402,21 +406,21 @@ XnStatus XnSensor::CreateStreamModule(const XnChar* StreamType, const XnChar* St
 	if (strcmp(StreamType, XN_STREAM_TYPE_DEPTH) == 0)
 	{
 		XnSensorDepthStream* pDepthStream;
-		XN_VALIDATE_NEW(pDepthStream, XnSensorDepthStream, StreamName, &m_Objects);
+		XN_VALIDATE_NEW(pDepthStream, XnSensorDepthStream, GetUSBPath(), StreamName, &m_Objects, (XnUInt32)m_NumberOfBuffers.GetValue(), AreOtherUsersAllowed());
 		pStream = pDepthStream;
 		pHelper = pDepthStream->GetHelper();
 	}
 	else if (strcmp(StreamType, XN_STREAM_TYPE_IMAGE) == 0)
 	{
 		XnSensorImageStream* pImageStream;
-		XN_VALIDATE_NEW(pImageStream, XnSensorImageStream, StreamName, &m_Objects);
+		XN_VALIDATE_NEW(pImageStream, XnSensorImageStream, GetUSBPath(), StreamName, &m_Objects, (XnUInt32)m_NumberOfBuffers.GetValue(), AreOtherUsersAllowed());
 		pStream = pImageStream;
 		pHelper = pImageStream->GetHelper();
 	}
 	else if (strcmp(StreamType, XN_STREAM_TYPE_IR) == 0)
 	{
 		XnSensorIRStream* pIRStream;
-		XN_VALIDATE_NEW(pIRStream, XnSensorIRStream, StreamName, &m_Objects);
+		XN_VALIDATE_NEW(pIRStream, XnSensorIRStream, GetUSBPath(), StreamName, &m_Objects, (XnUInt32)m_NumberOfBuffers.GetValue(), AreOtherUsersAllowed());
 		pStream = pIRStream;
 		pHelper = pIRStream->GetHelper();
 	}
@@ -427,9 +431,8 @@ XnStatus XnSensor::CreateStreamModule(const XnChar* StreamType, const XnChar* St
 			XN_LOG_WARNING_RETURN(XN_STATUS_UNSUPPORTED_STREAM, XN_MASK_DEVICE_SENSOR, "Audio is not supported by this FW!");
 		}
 
-		// TODO: use the allow other users property when constructing the audio stream
 		XnSensorAudioStream* pAudioStream;
-		XN_VALIDATE_NEW(pAudioStream, XnSensorAudioStream, GetUSBPath(), StreamName, &m_Objects, FALSE);
+		XN_VALIDATE_NEW(pAudioStream, XnSensorAudioStream, GetUSBPath(), StreamName, &m_Objects, AreOtherUsersAllowed());
 		pStream = pAudioStream;
 		pHelper = pAudioStream->GetHelper();
 	}
@@ -540,7 +543,7 @@ XnStatus XnSensor::ReadStream(XnStreamData* pStreamOutput)
 	return (XN_STATUS_OK);
 }
 
-XnStatus XnSensor::GetBufferPool(const XnChar* strStream, XnBufferPool** ppBufferPool)
+XnStatus XnSensor::GetSharedBufferPool(const XnChar* strStream, XnSharedMemoryBufferPool** ppBufferPool)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 	
@@ -549,38 +552,11 @@ XnStatus XnSensor::GetBufferPool(const XnChar* strStream, XnBufferPool** ppBuffe
 	XN_IS_STATUS_OK(nRetVal);
 
 	XnSensorStreamHolder* pSensorStreamHolder = (XnSensorStreamHolder*)(pHolder);
-	XnDeviceStream* pStream = pSensorStreamHolder->GetStream();
-
-	XnUInt64 nFrameBased;
-	nRetVal = pStream->GetProperty(XN_STREAM_PROPERTY_IS_FRAME_BASED, &nFrameBased);
-	XN_IS_STATUS_OK(nRetVal);
-
-	if (nFrameBased == 0)
-	{
-		return XN_STATUS_BAD_TYPE;
-	}
-
-	XnFrameStream* pFrameStream = (XnFrameStream*)pStream;
-	*ppBufferPool = pFrameStream->GetBufferPool();
+	*ppBufferPool = pSensorStreamHolder->GetSharedBufferPool();
 	
 	return (XN_STATUS_OK);
 }
 
-
-XnStatus XnSensor::GetStream(const XnChar* strStream, XnDeviceStream** ppStream)
-{
-	XnStatus nRetVal = XN_STATUS_OK;
-
-	XnDeviceModuleHolder* pHolder;
-	nRetVal = FindStream(strStream, &pHolder);
-	XN_IS_STATUS_OK(nRetVal);
-
-	XnSensorStreamHolder* pSensorStreamHolder = (XnSensorStreamHolder*)(pHolder);
-	*ppStream = pSensorStreamHolder->GetStream();
-
-	return XN_STATUS_OK;
-}
-
 XnBool XnSensor::HasSynchedFrameArrived(const XnChar* strDepthStream, const XnChar* strImageStream)
 {
 	// find both streams
@@ -737,6 +713,9 @@ XnStatus XnSensor::LoadConfigFromFile(const XnChar* csINIFilePath, const XnChar*
 	nRetVal = m_Interface.ReadValueFromFile(csINIFilePath, XN_MODULE_NAME_DEVICE);
 	XN_IS_STATUS_OK(nRetVal);
 
+	nRetVal = m_NumberOfBuffers.ReadValueFromFile(csINIFilePath, XN_MODULE_NAME_DEVICE);
+	XN_IS_STATUS_OK(nRetVal);
+
 	nRetVal = m_ReadFromEP1.ReadValueFromFile(csINIFilePath, XN_MODULE_NAME_DEVICE);
 	XN_IS_STATUS_OK(nRetVal);
 
@@ -759,7 +738,7 @@ XnStatus XnSensor::LoadConfigFromFile(const XnChar* csINIFilePath, const XnChar*
 	nRetVal = GetStreamsList(streams);
 	XN_IS_STATUS_OK(nRetVal);
 
-	for (XnDeviceModuleHolderList::Iterator it = streams.Begin(); it != streams.End(); ++it)
+	for (XnDeviceModuleHolderList::Iterator it = streams.begin(); it != streams.end(); ++it)
 	{
 		XnDeviceModuleHolder* pHolder = *it;
 		nRetVal = pHolder->GetModule()->LoadConfigFromFile(csINIFilePath);
@@ -881,26 +860,6 @@ XnStatus XnSensor::GetFirmwareParam(XnInnerParamData* pParam)
 	return (XN_STATUS_OK);
 }
 
-XnStatus XnSensor::ReadAHB(XnAHBData* pAHB)
-{
-	XnStatus nRetVal = XN_STATUS_OK;
-
-	nRetVal = XnHostProtocolReadAHB(&m_DevicePrivateData, pAHB->nRegister, pAHB->nValue);
-	XN_IS_STATUS_OK(nRetVal);
-
-	return (XN_STATUS_OK);
-}
-
-XnStatus XnSensor::WriteAHB(const XnAHBData* pAHB)
-{
-	XnStatus nRetVal = XN_STATUS_OK;
-
-	nRetVal = XnHostProtocolWriteAHB(&m_DevicePrivateData, pAHB->nRegister, pAHB->nValue, pAHB->nMask);
-	XN_IS_STATUS_OK(nRetVal);
-
-	return (XN_STATUS_OK);
-}
-
 
 XnStatus XnSensor::GetCmosBlankingUnits(XnCmosBlankingUnits* pBlanking)
 {
@@ -976,42 +935,6 @@ XnStatus XnSensor::GetFirmwareMode(XnParamCurrentMode* pnMode)
 	return (XN_STATUS_OK);
 }
 
-XnStatus XnSensor::GetDepthCmosRegister(XnControlProcessingData* pRegister)
-{
-	XnStatus nRetVal = XN_STATUS_OK;
-
-	if (m_Firmware.GetInfo()->nFWVer >= XN_SENSOR_FW_VER_3_0)
-	{
-		nRetVal = XnHostProtocolGetCMOSRegisterI2C(&m_DevicePrivateData, XN_CMOS_TYPE_DEPTH, pRegister->nRegister, pRegister->nValue);
-		XN_IS_STATUS_OK(nRetVal);
-	}
-	else
-	{
-		nRetVal = XnHostProtocolGetCMOSRegister(&m_DevicePrivateData, XN_CMOS_TYPE_DEPTH, pRegister->nRegister, pRegister->nValue);
-		XN_IS_STATUS_OK(nRetVal);
-	}
-
-	return (XN_STATUS_OK);
-}
-
-XnStatus XnSensor::GetImageCmosRegister(XnControlProcessingData* pRegister)
-{
-	XnStatus nRetVal = XN_STATUS_OK;
-
-	if (m_Firmware.GetInfo()->nFWVer >= XN_SENSOR_FW_VER_3_0)
-	{
-		nRetVal = XnHostProtocolGetCMOSRegisterI2C(&m_DevicePrivateData, XN_CMOS_TYPE_IMAGE, pRegister->nRegister, pRegister->nValue);
-		XN_IS_STATUS_OK(nRetVal);
-	}
-	else
-	{
-		nRetVal = XnHostProtocolGetCMOSRegister(&m_DevicePrivateData, XN_CMOS_TYPE_IMAGE, pRegister->nRegister, pRegister->nValue);
-		XN_IS_STATUS_OK(nRetVal);
-	}
-
-	return (XN_STATUS_OK);
-}
-
 
 XnStatus XnSensor::GetFixedParams(XnDynamicSizeBuffer* pBuffer)
 {
@@ -1073,23 +996,45 @@ XnStatus XnSensor::SetInterface(XnSensorUsbInterface nInterface)
 	return (XN_STATUS_OK);
 }
 
-XnStatus XnSensor::SetHostTimestamps(XnBool bHostTimestamps)
+XnStatus XnSensor::SetAllowOtherUsers(XnBool bAllowOtherUsers)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 
-	// we don't allow change if requested value is specific and different than current
+	// we only allow changing this *before* creating any streams
 	if (m_ReadData.GetValue() == TRUE &&
-		bHostTimestamps != m_HostTimestamps.GetValue())
+		m_AllowOtherUsers.GetValue() != bAllowOtherUsers)
 	{
 		return (XN_STATUS_DEVICE_PROPERTY_READ_ONLY);
 	}
 
-	nRetVal = m_HostTimestamps.UnsafeUpdateValue(bHostTimestamps);
+	nRetVal = m_AllowOtherUsers.UnsafeUpdateValue(bAllowOtherUsers);
 	XN_IS_STATUS_OK(nRetVal);
 
 	return (XN_STATUS_OK);
 }
 
+XnStatus XnSensor::SetNumberOfBuffers(XnUInt32 nCount)
+{
+	XnStatus nRetVal = XN_STATUS_OK;
+
+	// This is a special func. It can only be changed BEFORE reading starts
+	if (m_ReadData.GetValue() == FALSE)
+	{
+		nRetVal = m_NumberOfBuffers.UnsafeUpdateValue(nCount);
+		XN_IS_STATUS_OK(nRetVal);
+	}
+	else
+	{
+		// check it's the same value
+		if (nCount != m_NumberOfBuffers.GetValue())
+		{
+			return (XN_STATUS_DEVICE_PROPERTY_READ_ONLY);
+		}
+	}
+
+	return (XN_STATUS_OK);
+}
+
 XnStatus XnSensor::SetReadEndpoint1(XnBool bRead)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
@@ -1179,42 +1124,6 @@ XnStatus XnSensor::SetReadData(XnBool bRead)
 	return (XN_STATUS_OK);
 }
 
-XnStatus XnSensor::SetDepthCmosRegister(const XnControlProcessingData* pRegister)
-{
-	XnStatus nRetVal = XN_STATUS_OK;
-
-	if (m_Firmware.GetInfo()->nFWVer >= XN_SENSOR_FW_VER_3_0)
-	{
-		nRetVal = XnHostProtocolSetCMOSRegisterI2C(&m_DevicePrivateData, XN_CMOS_TYPE_DEPTH, pRegister->nRegister, pRegister->nValue);
-		XN_IS_STATUS_OK(nRetVal);
-	}
-	else
-	{
-		nRetVal = XnHostProtocolSetCMOSRegister(&m_DevicePrivateData, XN_CMOS_TYPE_DEPTH, pRegister->nRegister, pRegister->nValue);
-		XN_IS_STATUS_OK(nRetVal);
-	}
-
-	return (XN_STATUS_OK);
-}
-
-XnStatus XnSensor::SetImageCmosRegister(const XnControlProcessingData* pRegister)
-{
-	XnStatus nRetVal = XN_STATUS_OK;
-
-	if (m_Firmware.GetInfo()->nFWVer >= XN_SENSOR_FW_VER_3_0)
-	{
-		nRetVal = XnHostProtocolSetCMOSRegisterI2C(&m_DevicePrivateData, XN_CMOS_TYPE_IMAGE, pRegister->nRegister, pRegister->nValue);
-		XN_IS_STATUS_OK(nRetVal);
-	}
-	else
-	{
-		nRetVal = XnHostProtocolSetCMOSRegister(&m_DevicePrivateData, XN_CMOS_TYPE_IMAGE, pRegister->nRegister, pRegister->nValue);
-		XN_IS_STATUS_OK(nRetVal);
-	}
-
-	return (XN_STATUS_OK);
-}
-
 
 XnStatus XnSensor::SetFirmwareParam(const XnInnerParamData* pParam)
 {
@@ -1334,10 +1243,16 @@ XnStatus XN_CALLBACK_TYPE XnSensor::SetInterfaceCallback(XnActualIntProperty* /*
 	return pThis->XnSensor::SetInterface((XnSensorUsbInterface)nValue);
 }
 
-XnStatus XN_CALLBACK_TYPE XnSensor::SetHostTimestampsCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
+XnStatus XN_CALLBACK_TYPE XnSensor::SetAllowOtherUsersCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
+{
+	XnSensor* pThis = (XnSensor*)pCookie;
+	return pThis->XnSensor::SetAllowOtherUsers(nValue == 1);
+}
+
+XnStatus XN_CALLBACK_TYPE XnSensor::SetNumberOfBuffersCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
 {
 	XnSensor* pThis = (XnSensor*)pCookie;
-	return pThis->XnSensor::SetHostTimestamps(nValue == 1);
+	return pThis->SetNumberOfBuffers((XnUInt32)nValue);
 }
 
 XnStatus XN_CALLBACK_TYPE XnSensor::SetReadEndpoint1Callback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
@@ -1436,13 +1351,6 @@ XnStatus XN_CALLBACK_TYPE XnSensor::GetAudioSupportedCallback(const XnIntPropert
 	return XN_STATUS_OK;
 }
 
-XnStatus XN_CALLBACK_TYPE XnSensor::GetImageSupportedCallback(const XnIntProperty* /*pSender*/, XnUInt64* pnValue, void* pCookie)
-{
-	XnSensor* pThis = (XnSensor*)pCookie;
-	*pnValue = pThis->m_Firmware.GetInfo()->bImageSupported;
-	return XN_STATUS_OK;
-}
-
 XnStatus XN_CALLBACK_TYPE XnSensor::FrameSyncPropertyChangedCallback(const XnProperty* /*pSender*/, void* pCookie)
 {
 	XnSensor* pThis = (XnSensor*)pCookie;
@@ -1485,45 +1393,3 @@ XnStatus XN_CALLBACK_TYPE XnSensor::GetInstanceCallback(const XnGeneralProperty*
 	return XN_STATUS_OK;
 }
 
-XnStatus XN_CALLBACK_TYPE XnSensor::SetDepthCmosRegisterCallback(XnGeneralProperty* /*pSender*/, const XnGeneralBuffer& gbValue, void* pCookie)
-{
-	XN_VALIDATE_GENERAL_BUFFER_TYPE(gbValue, XnControlProcessingData);
-	XnSensor* pThis = (XnSensor*)pCookie;
-	return pThis->SetDepthCmosRegister((const XnControlProcessingData*)gbValue.pData);
-}
-
-XnStatus XN_CALLBACK_TYPE XnSensor::SetImageCmosRegisterCallback(XnGeneralProperty* /*pSender*/, const XnGeneralBuffer& gbValue, void* pCookie)
-{
-	XN_VALIDATE_GENERAL_BUFFER_TYPE(gbValue, XnControlProcessingData);
-	XnSensor* pThis = (XnSensor*)pCookie;
-	return pThis->SetImageCmosRegister((const XnControlProcessingData*)gbValue.pData);
-}
-
-XnStatus XN_CALLBACK_TYPE XnSensor::GetDepthCmosRegisterCallback(const XnGeneralProperty* /*pSender*/, const XnGeneralBuffer& gbValue, void* pCookie)
-{
-	XN_VALIDATE_GENERAL_BUFFER_TYPE(gbValue, XnControlProcessingData);
-	XnSensor* pThis = (XnSensor*)pCookie;
-	return pThis->GetDepthCmosRegister((XnControlProcessingData*)gbValue.pData);
-}
-
-XnStatus XN_CALLBACK_TYPE XnSensor::GetImageCmosRegisterCallback(const XnGeneralProperty* /*pSender*/, const XnGeneralBuffer& gbValue, void* pCookie)
-{
-	XN_VALIDATE_GENERAL_BUFFER_TYPE(gbValue, XnControlProcessingData);
-	XnSensor* pThis = (XnSensor*)pCookie;
-	return pThis->GetImageCmosRegister((XnControlProcessingData*)gbValue.pData);
-}
-
-XnStatus XN_CALLBACK_TYPE XnSensor::WriteAHBCallback(XnGeneralProperty* /*pSender*/, const XnGeneralBuffer& gbValue, void* pCookie)
-{
-	XN_VALIDATE_GENERAL_BUFFER_TYPE(gbValue, XnAHBData);
-	XnSensor* pThis = (XnSensor*)pCookie;
-	return pThis->WriteAHB((const XnAHBData*)gbValue.pData);
-}
-
-XnStatus XN_CALLBACK_TYPE XnSensor::ReadAHBCallback(const XnGeneralProperty* /*pSender*/, const XnGeneralBuffer& gbValue, void* pCookie)
-{
-	XN_VALIDATE_GENERAL_BUFFER_TYPE(gbValue, XnAHBData);
-	XnSensor* pThis = (XnSensor*)pCookie;
-	return pThis->ReadAHB((XnAHBData*)gbValue.pData);
-}
-
diff --git a/Source/XnDeviceSensorV2/XnSensor.h b/Source/XnDeviceSensorV2/XnSensor.h
index 1c3ab51..efcb633 100644
--- a/Source/XnDeviceSensorV2/XnSensor.h
+++ b/Source/XnDeviceSensorV2/XnSensor.h
@@ -50,7 +50,7 @@ class XnSensor : public XnDeviceBase
 	friend class XnServerSensorInvoker;
 
 public:
-	XnSensor(XnBool bResetOnStartup = TRUE, XnBool bLeanInit = FALSE);
+	XnSensor();
 	~XnSensor();
 
 	static XnStatus GetDefinition(XnDeviceDefinition* pDeviceDefinition);
@@ -68,7 +68,7 @@ public:
 	virtual XnStatus LoadConfigFromFile(const XnChar* csINIFilePath, const XnChar* csSectionName);
 
 public:
-	inline XnSensorFixedParams* GetFixedParams() { return GetFirmware()->GetFixedParams(); }
+	inline const XnSensorFixedParams* GetFixedParams() const { return &m_FixedParams; }
 	inline XnSensorFirmware* GetFirmware() { return &m_Firmware; }
 	inline XnSensorFPS* GetFPSCalculator() { return &m_FPS; }
 
@@ -82,8 +82,7 @@ public:
 	inline XnBool IsMiscSupported() const { return m_SensorIO.IsMiscEndpointSupported(); }
 	inline XnBool IsLowBandwidth() const { return m_SensorIO.IsLowBandwidth(); }
 
-	XnStatus GetBufferPool(const XnChar* strStream, XnBufferPool** ppBufferPool);
-	XnStatus GetStream(const XnChar* strStream, XnDeviceStream** ppStream);
+	XnStatus GetSharedBufferPool(const XnChar* strStream, XnSharedMemoryBufferPool** ppBufferPool);
 
 	inline XnStatus GetErrorState() { return (XnStatus)m_ErrorState.GetValue(); }
 	XnStatus SetErrorState(XnStatus errorState);
@@ -93,8 +92,7 @@ public:
 	XnStatus ConfigureModuleFromGlobalFile(const XnChar* strModule, const XnChar* strSection = NULL);
 
 	const XnChar* GetUSBPath() { return m_USBPath.GetValue(); }
-	XnBool ShouldUseHostTimestamps() { return (m_HostTimestamps.GetValue() == TRUE); }
-	XnBool HasReadingStarted() { return (m_ReadData.GetValue() == TRUE); }
+	XnBool AreOtherUsersAllowed() { return (m_AllowOtherUsers.GetValue() == TRUE); }
 
 
 protected:
@@ -129,16 +127,13 @@ private:
 	XnStatus GetFirmwareMode(XnParamCurrentMode* pnMode);
 	XnStatus GetLastRawFrame(const XnChar* strStream, XnUChar* pBuffer, XnUInt32 nDataSize);
 	XnStatus GetFixedParams(XnDynamicSizeBuffer* pBuffer);
-	XnStatus GetDepthCmosRegister(XnControlProcessingData* pRegister);
-	XnStatus GetImageCmosRegister(XnControlProcessingData* pRegister);
-	XnStatus ReadAHB(XnAHBData* pData);
 
 
 	//---------------------------------------------------------------------------
 	// Setters
 	//---------------------------------------------------------------------------
 	XnStatus SetInterface(XnSensorUsbInterface nInterface);
-	XnStatus SetHostTimestamps(XnBool bHostTimestamps);
+	XnStatus SetAllowOtherUsers(XnBool bAllowOtherUsers);
 	XnStatus SetNumberOfBuffers(XnUInt32 nCount);
 	XnStatus SetReadEndpoint1(XnBool bRead);
 	XnStatus SetReadEndpoint2(XnBool bRead);
@@ -149,16 +144,12 @@ private:
 	XnStatus SetCmosBlankingTime(const XnCmosBlankingTime* pBlanking);
 	XnStatus Reset(XnParamResetType nType);
 	XnStatus SetFirmwareMode(XnParamCurrentMode nMode);
-	XnStatus SetDepthCmosRegister(const XnControlProcessingData* pRegister);
-	XnStatus SetImageCmosRegister(const XnControlProcessingData* pRegister);
-	XnStatus WriteAHB(const XnAHBData* pData);
-
 
 	//---------------------------------------------------------------------------
 	// Callbacks
 	//---------------------------------------------------------------------------
 	static XnStatus XN_CALLBACK_TYPE SetInterfaceCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie);
-	static XnStatus XN_CALLBACK_TYPE SetHostTimestampsCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie);
+	static XnStatus XN_CALLBACK_TYPE SetAllowOtherUsersCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie);
 	static XnStatus XN_CALLBACK_TYPE SetNumberOfBuffersCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie);
 	static XnStatus XN_CALLBACK_TYPE SetReadEndpoint1Callback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie);
 	static XnStatus XN_CALLBACK_TYPE SetReadEndpoint2Callback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie);
@@ -178,13 +169,6 @@ private:
 	static XnStatus XN_CALLBACK_TYPE GetCmosBlankingTimeCallback(const XnGeneralProperty* pSender, const XnGeneralBuffer& gbValue, void* pCookie);
 	static XnStatus XN_CALLBACK_TYPE GetFirmwareModeCallback(const XnIntProperty* pSender, XnUInt64* pnValue, void* pCookie);
 	static XnStatus XN_CALLBACK_TYPE GetAudioSupportedCallback(const XnIntProperty* pSender, XnUInt64* pnValue, void* pCookie);
-	static XnStatus XN_CALLBACK_TYPE GetImageSupportedCallback(const XnIntProperty* pSender, XnUInt64* pnValue, void* pCookie);
-	static XnStatus XN_CALLBACK_TYPE SetDepthCmosRegisterCallback(XnGeneralProperty* pSender, const XnGeneralBuffer& gbValue, void* pCookie);
-	static XnStatus XN_CALLBACK_TYPE SetImageCmosRegisterCallback(XnGeneralProperty* pSender, const XnGeneralBuffer& gbValue, void* pCookie);
-	static XnStatus XN_CALLBACK_TYPE GetDepthCmosRegisterCallback(const XnGeneralProperty* pSender, const XnGeneralBuffer& gbValue, void* pCookie);
-	static XnStatus XN_CALLBACK_TYPE GetImageCmosRegisterCallback(const XnGeneralProperty* pSender, const XnGeneralBuffer& gbValue, void* pCookie);
-	static XnStatus XN_CALLBACK_TYPE ReadAHBCallback(const XnGeneralProperty* pSender, const XnGeneralBuffer& gbValue, void* pCookie);
-	static XnStatus XN_CALLBACK_TYPE WriteAHBCallback(XnGeneralProperty* pSender, const XnGeneralBuffer& gbValue, void* pCookie);
 
 
 	//---------------------------------------------------------------------------
@@ -192,15 +176,14 @@ private:
 	//---------------------------------------------------------------------------
 	XnActualIntProperty m_ErrorState;
 	XnActualIntProperty m_ResetSensorOnStartup;
-	XnActualIntProperty m_LeanInit;
 	XnActualIntProperty m_Interface;
+	XnActualIntProperty m_NumberOfBuffers;
 	XnActualIntProperty m_ReadFromEP1;
 	XnActualIntProperty m_ReadFromEP2;
 	XnActualIntProperty m_ReadFromEP3;
 	XnActualIntProperty m_ReadData;
 	XnActualIntProperty m_FrameSync;
 	XnActualIntProperty m_CloseStreamsOnShutdown;
-	XnActualIntProperty m_HostTimestamps;
 	XnGeneralProperty m_FirmwareParam;
 	XnGeneralProperty m_CmosBlankingUnits;
 	XnGeneralProperty m_CmosBlankingTime;
@@ -214,16 +197,12 @@ private:
 	XnActualStringProperty m_USBPath;
 	XnActualStringProperty m_DeviceName;
 	XnActualStringProperty m_VendorSpecificData;
-	XnActualStringProperty m_PlatformString;
+	XnActualIntProperty m_AllowOtherUsers;
 	XnIntProperty m_AudioSupported;
-	XnIntProperty m_ImageSupported;
-	XnGeneralProperty m_ImageControl;
-	XnGeneralProperty m_DepthControl;
-	XnGeneralProperty m_AHB;
-
 
 	XnSensorFirmware m_Firmware;
 	XnDevicePrivateData m_DevicePrivateData;
+	XnSensorFixedParams m_FixedParams;
 	XnSensorFPS m_FPS;
 	XnCmosInfo m_CmosInfo;
 	XnSensorIO m_SensorIO;
diff --git a/Source/XnDeviceSensorV2/XnSensorAudioGenerator.cpp b/Source/XnDeviceSensorV2/XnSensorAudioGenerator.cpp
index 1dd25ac..f7a4670 100644
--- a/Source/XnDeviceSensorV2/XnSensorAudioGenerator.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorAudioGenerator.cpp
@@ -104,7 +104,7 @@ XnStatus XnSensorAudioGenerator::GetSupportedWaveOutputModes(XnWaveOutputMode aS
 	}
 
 	XnUInt32 i = 0;
-	for (XnWaveOutputModeList::Iterator it = m_SupportedModes.Begin(); it != m_SupportedModes.End(); ++it, ++i)
+	for (XnWaveOutputModeList::Iterator it = m_SupportedModes.begin(); it != m_SupportedModes.end(); ++it, ++i)
 	{
 		aSupportedModes[i] = *it;
 	}
@@ -193,35 +193,28 @@ XnStatus XnExportedSensorAudioGenerator::IsSupportedForDevice(xn::Context& conte
 	nRetVal = sensorInfo.GetInstance(sensor);
 	XN_IS_STATUS_OK(nRetVal);
 
-	XnUInt64 nAudioSupported = FALSE;
+	XnBool bShouldBeCreated = (!sensor.IsValid());
 
-	if (sensor.IsValid())
-	{
-		nRetVal = sensor.GetIntProperty(XN_MODULE_PROPERTY_AUDIO_SUPPORTED, nAudioSupported);
-		XN_IS_STATUS_OK(nRetVal);
-	}
-	else
+	if (bShouldBeCreated)
 	{
-		// Don't create sensor through OpenNI. This will cause it to soft-reset.
-		// instead, "talk" directly to the sensor class
-		XnSensor lowLevelSensor(FALSE);
-		XnDeviceConfig config;
-		config.DeviceMode = XN_DEVICE_MODE_READ;
-		config.cpConnectionString = sensorInfo.GetCreationInfo();
-		config.SharingMode = XN_DEVICE_EXCLUSIVE;
-		config.pInitialValues = NULL;
-		nRetVal = lowLevelSensor.Init(&config);
-		XN_IS_STATUS_OK(nRetVal);
-
-		nRetVal = lowLevelSensor.GetProperty(XN_MODULE_NAME_DEVICE, XN_MODULE_PROPERTY_AUDIO_SUPPORTED, &nAudioSupported);
+		nRetVal = context.CreateProductionTree(sensorInfo, sensor);
 		XN_IS_STATUS_OK(nRetVal);
 	}
 
+	// check if firmware supports audio
+	XnUInt64 nAudioSupported = FALSE;
+	nRetVal = sensor.GetIntProperty(XN_MODULE_PROPERTY_AUDIO_SUPPORTED, nAudioSupported);
+	XN_IS_STATUS_OK(nRetVal);
 	if (nAudioSupported != TRUE)
 	{
 		*pbSupported = FALSE;
 	}
 
+	if (bShouldBeCreated)
+	{
+		sensor.Release();
+	}
+
 	return (XN_STATUS_OK);
 }
 
diff --git a/Source/XnDeviceSensorV2/XnSensorAudioGenerator.h b/Source/XnDeviceSensorV2/XnSensorAudioGenerator.h
index 8fcb083..06dc935 100644
--- a/Source/XnDeviceSensorV2/XnSensorAudioGenerator.h
+++ b/Source/XnDeviceSensorV2/XnSensorAudioGenerator.h
@@ -27,7 +27,7 @@
 //---------------------------------------------------------------------------
 #include "XnSensorGenerator.h"
 #include "XnExportedSensorGenerator.h"
-#include <XnListT.h>
+#include <XnList.h>
 
 //---------------------------------------------------------------------------
 // Types
@@ -60,7 +60,7 @@ protected:
 	virtual void FilterProperties(XnActualPropertiesHash* pHash);
 
 private:
-	typedef XnListT<XnWaveOutputMode> XnWaveOutputModeList;
+	XN_DECLARE_LIST(XnWaveOutputMode, XnWaveOutputModeList);
 
 	XnWaveOutputModeList m_SupportedModes;
 };
diff --git a/Source/XnDeviceSensorV2/XnSensorAudioStream.cpp b/Source/XnDeviceSensorV2/XnSensorAudioStream.cpp
index 049944a..983325c 100644
--- a/Source/XnDeviceSensorV2/XnSensorAudioStream.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorAudioStream.cpp
@@ -70,9 +70,6 @@ XnStatus XnSensorAudioStream::Init()
 	nRetVal = m_Helper.Init(this, this);
 	XN_IS_STATUS_OK(nRetVal);
 
-	nRetVal = xnOSCreateCriticalSection(&m_buffer.hLock);
-	XN_IS_STATUS_OK(nRetVal);
-
 	nRetVal = SetReadChunkSize(XN_AUDIO_STREAM_DEFAULT_CHUNK_SIZE);
 	XN_IS_STATUS_OK(nRetVal);
 
@@ -89,8 +86,8 @@ XnStatus XnSensorAudioStream::Init()
 	nRetVal = ReallocBuffer();
 	XN_IS_STATUS_OK(nRetVal);
 
-	m_buffer.pAudioCallback = NewDataCallback;
-	m_buffer.pAudioCallbackCookie = this;
+	m_Helper.GetPrivateData()->pAudioCallback = NewDataCallback;
+	m_Helper.GetPrivateData()->pAudioCallbackCookie = this;
 
 	// data processor
 	nRetVal = m_Helper.RegisterDataProcessorProperty(NumberOfChannelsProperty());
@@ -108,14 +105,6 @@ XnStatus XnSensorAudioStream::Free()
 		xnOSCloseSharedMemory(m_hSharedMemory);
 		m_hSharedMemory = NULL;
 	}
-
-	// close critical sections
-	if (m_buffer.hLock != NULL)
-	{
-		xnOSCloseCriticalSection(&m_buffer.hLock);
-		m_buffer.hLock = NULL;
-	}
-
 	return (XN_STATUS_OK);
 }
 
@@ -214,7 +203,7 @@ XnStatus XnSensorAudioStream::CloseStreamImpl()
 XnStatus XnSensorAudioStream::CreateDataProcessor(XnDataProcessor** ppProcessor)
 {
 	XnDataProcessor* pAudioProcessor;
-	XN_VALIDATE_NEW_AND_INIT(pAudioProcessor, XnAudioProcessor, this, &m_Helper, &m_buffer, m_nOrigAudioPacketSize);
+	XN_VALIDATE_NEW_AND_INIT(pAudioProcessor, XnAudioProcessor, this, &m_Helper, m_nOrigAudioPacketSize);
 
 	*ppProcessor = pAudioProcessor;
 
@@ -276,17 +265,19 @@ XnStatus XnSensorAudioStream::SetNumberOfChannels(XnUInt32 nNumberOfChannels)
 
 XnStatus XnSensorAudioStream::NewData()
 {
+	XnDevicePrivateData* pDevicePrivateData = m_Helper.GetPrivateData();
+
 	// check how many buffers we have
-	XnInt32 nAvailbalePackets = m_buffer.nAudioWriteIndex - m_buffer.nAudioReadIndex;
+	XnInt32 nAvailbalePackets = pDevicePrivateData->nAudioWriteIndex - pDevicePrivateData->nAudioReadIndex;
 	if (nAvailbalePackets < 0)
-		nAvailbalePackets += m_buffer.nAudioBufferNumOfPackets;
+		nAvailbalePackets += pDevicePrivateData->nAudioBufferNumOfPackets;
 
-	if ((XnUInt32)nAvailbalePackets * m_buffer.nAudioPacketSize >= GetReadChunkSize())
+	if ((XnUInt32)nAvailbalePackets * pDevicePrivateData->nAudioPacketSize >= GetReadChunkSize())
 	{
 		// update last write index (the last written byte)
-		m_pSharedHeader->nWritePacketIndex = m_buffer.nAudioWriteIndex;
+		m_pSharedHeader->nWritePacketIndex = pDevicePrivateData->nAudioWriteIndex;
 		// take first packet timestamp
-		NewDataAvailable(m_buffer.pAudioPacketsTimestamps[m_buffer.nAudioReadIndex], 0);
+		NewDataAvailable(pDevicePrivateData->pAudioPacketsTimestamps[pDevicePrivateData->nAudioReadIndex], 0);
 	}
 
 	return XN_STATUS_OK;
@@ -294,45 +285,47 @@ XnStatus XnSensorAudioStream::NewData()
 
 XnStatus XnSensorAudioStream::ReadImpl(XnStreamData *pStreamOutput)
 {
+	XnDevicePrivateData* pDevicePrivateData = m_Helper.GetPrivateData();
+
 	pStreamOutput->nDataSize = 0;
 
 	XN_AUDIO_TYPE* pAudioBuf = (XN_AUDIO_TYPE*)pStreamOutput->pData;
 
-	xnOSEnterCriticalSection(&m_buffer.hLock);
+	xnOSEnterCriticalSection(&pDevicePrivateData->hAudioBufferCriticalSection);
 
 	// check how many buffers we have
-	XnInt32 nAvailbalePackets = m_buffer.nAudioWriteIndex - m_buffer.nAudioReadIndex;
+	XnInt32 nAvailbalePackets = pDevicePrivateData->nAudioWriteIndex - pDevicePrivateData->nAudioReadIndex;
 	if (nAvailbalePackets < 0)
-		nAvailbalePackets += m_buffer.nAudioBufferNumOfPackets;
+		nAvailbalePackets += pDevicePrivateData->nAudioBufferNumOfPackets;
 
 	// now check if stream frame buffer has enough space
-	if (GetRequiredDataSize() < (XnUInt32)nAvailbalePackets * m_buffer.nAudioPacketSize)
+	if (GetRequiredDataSize() < (XnUInt32)nAvailbalePackets * pDevicePrivateData->nAudioPacketSize)
 	{
-		xnOSLeaveCriticalSection(&m_buffer.hLock);
+		xnOSLeaveCriticalSection(&pDevicePrivateData->hAudioBufferCriticalSection);
 		return (XN_STATUS_IO_INVALID_STREAM_AUDIO_BUFFER_SIZE);
 	}
 
 	// take first packet timestamp
-	pStreamOutput->nTimestamp = m_buffer.pAudioPacketsTimestamps[m_buffer.nAudioReadIndex];
-	XnUChar* pPacketData = m_buffer.pAudioBuffer + (m_buffer.nAudioReadIndex * m_buffer.nAudioPacketSize);
+	pStreamOutput->nTimestamp = pDevicePrivateData->pAudioPacketsTimestamps[pDevicePrivateData->nAudioReadIndex];
+	XnUChar* pPacketData = pDevicePrivateData->pAudioBuffer + (pDevicePrivateData->nAudioReadIndex * pDevicePrivateData->nAudioPacketSize);
 
 	// copy
-	while (m_buffer.nAudioReadIndex != m_buffer.nAudioWriteIndex)
+	while (pDevicePrivateData->nAudioReadIndex != pDevicePrivateData->nAudioWriteIndex)
 	{
-		xnOSMemCopy(pAudioBuf, pPacketData, m_buffer.nAudioPacketSize);
-		pAudioBuf += m_buffer.nAudioPacketSize;
-		pStreamOutput->nDataSize += m_buffer.nAudioPacketSize;
+		xnOSMemCopy(pAudioBuf, pPacketData, pDevicePrivateData->nAudioPacketSize);
+		pAudioBuf += pDevicePrivateData->nAudioPacketSize;
+		pStreamOutput->nDataSize += pDevicePrivateData->nAudioPacketSize;
 
-		m_buffer.nAudioReadIndex++;
-		pPacketData += m_buffer.nAudioPacketSize;
-		if (m_buffer.nAudioReadIndex == m_buffer.nAudioBufferNumOfPackets)
+		pDevicePrivateData->nAudioReadIndex++;
+		pPacketData += pDevicePrivateData->nAudioPacketSize;
+		if (pDevicePrivateData->nAudioReadIndex == pDevicePrivateData->nAudioBufferNumOfPackets)
 		{
-			m_buffer.nAudioReadIndex = 0;
-			pPacketData = m_buffer.pAudioBuffer;
+			pDevicePrivateData->nAudioReadIndex = 0;
+			pPacketData = pDevicePrivateData->pAudioBuffer;
 		}
 	}
 
-	xnOSLeaveCriticalSection(&m_buffer.hLock);
+	xnOSLeaveCriticalSection(&pDevicePrivateData->hAudioBufferCriticalSection);
 
 	++m_nFrameID;
 	pStreamOutput->nFrameID = m_nFrameID;
@@ -493,31 +486,31 @@ XnStatus XnSensorAudioStream::ReallocBuffer()
 		XN_IS_STATUS_OK(nRetVal);
 
 		m_pSharedHeader = (XnAudioSharedBuffer*)pAddress;
-		m_buffer.pAudioPacketsTimestamps = (XnUInt64*)(pAddress + sizeof(XnAudioSharedBuffer));
-		m_buffer.pAudioBuffer = (XN_AUDIO_TYPE*)(pAddress + sizeof(XnAudioSharedBuffer) + sizeof(XnUInt64) * nMaxPacketCount);
-		m_buffer.nAudioBufferSize = nMaxBufferSize;
+		pDevicePrivateData->pAudioPacketsTimestamps = (XnUInt64*)(pAddress + sizeof(XnAudioSharedBuffer));
+		pDevicePrivateData->pAudioBuffer = (XN_AUDIO_TYPE*)(pAddress + sizeof(XnAudioSharedBuffer) + sizeof(XnUInt64) * nMaxPacketCount);
+		pDevicePrivateData->nAudioBufferSize = nMaxBufferSize;
 
 		m_pSharedHeader->nTimestampsListOffset = sizeof(XnAudioSharedBuffer);
-		m_pSharedHeader->nBufferOffset = (XnUInt32)(m_buffer.pAudioBuffer - pAddress);
+		m_pSharedHeader->nBufferOffset = (XnUInt32)(pDevicePrivateData->pAudioBuffer - pAddress);
 	}
 
 	// calculate current packet size
-	m_buffer.nAudioPacketSize = m_nOrigAudioPacketSize;
+	pDevicePrivateData->nAudioPacketSize = m_nOrigAudioPacketSize;
 
 	if (m_Helper.GetFirmwareVersion() >= XN_SENSOR_FW_VER_5_2 && GetNumberOfChannels() == 1)
 	{
-		m_buffer.nAudioPacketSize /= 2;
+		pDevicePrivateData->nAudioPacketSize /= 2;
 	}
 
-	m_buffer.nAudioBufferNumOfPackets = m_buffer.nAudioBufferSize / m_buffer.nAudioPacketSize;
-	m_buffer.nAudioBufferSize = m_buffer.nAudioBufferNumOfPackets * m_buffer.nAudioPacketSize;
+	pDevicePrivateData->nAudioBufferNumOfPackets = pDevicePrivateData->nAudioBufferSize / pDevicePrivateData->nAudioPacketSize;
+	pDevicePrivateData->nAudioBufferSize = pDevicePrivateData->nAudioBufferNumOfPackets * pDevicePrivateData->nAudioPacketSize;
 
-	m_pSharedHeader->nPacketCount = m_buffer.nAudioBufferNumOfPackets;
-	m_pSharedHeader->nPacketSize = m_buffer.nAudioPacketSize;
+	m_pSharedHeader->nPacketCount = pDevicePrivateData->nAudioBufferNumOfPackets;
+	m_pSharedHeader->nPacketSize = pDevicePrivateData->nAudioPacketSize;
 
 	// set read and write indices
-	m_buffer.nAudioReadIndex = 0;
-	m_buffer.nAudioWriteIndex = 0;
+	pDevicePrivateData->nAudioReadIndex = 0;
+	pDevicePrivateData->nAudioWriteIndex = 0;
 
 	return (XN_STATUS_OK);
 }
diff --git a/Source/XnDeviceSensorV2/XnSensorAudioStream.h b/Source/XnDeviceSensorV2/XnSensorAudioStream.h
index e3ec37e..38def0d 100644
--- a/Source/XnDeviceSensorV2/XnSensorAudioStream.h
+++ b/Source/XnDeviceSensorV2/XnSensorAudioStream.h
@@ -27,6 +27,7 @@
 //---------------------------------------------------------------------------
 #include <XnDDK/XnAudioStream.h>
 #include "XnSensorStreamHelper.h"
+#include "XnSharedMemoryBufferPool.h"
 
 //---------------------------------------------------------------------------
 // Defines
@@ -68,6 +69,7 @@ protected:
 	XnStatus CreateDataProcessor(XnDataProcessor** ppProcessor);
 	XnStatus MapPropertiesToFirmware();
 	void GetFirmwareStreamConfig(XnResolutions* pnRes, XnUInt32* pnFPS) { *pnRes = XN_RESOLUTION_CUSTOM; *pnFPS = 0; }
+	XnSharedMemoryBufferPool* GetSharedMemoryBuffer() { return NULL; }
 
 	XnStatus WriteImpl(XnStreamData* /*pStreamData*/) { return XN_STATUS_DEVICE_UNSUPPORTED_MODE; }
 	XnStatus ReadImpl(XnStreamData* pStreamOutput);
@@ -104,8 +106,6 @@ private:
 	//---------------------------------------------------------------------------
 	XnSensorStreamHelper m_Helper;
 
-	XnDeviceAudioBuffer m_buffer;
-
 	const XnChar* m_strDeviceName;
 	XnBool m_bAllowOtherUsers;
 	XnActualStringProperty m_SharedBufferName;
diff --git a/Source/XnDeviceSensorV2/XnSensorClient.cpp b/Source/XnDeviceSensorV2/XnSensorClient.cpp
index 269ddda..7907999 100644
--- a/Source/XnDeviceSensorV2/XnSensorClient.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorClient.cpp
@@ -783,10 +783,6 @@ XnStatus XnSensorClient::CreateStreamModule(const XnChar* StreamType, const XnCh
 	{
 		XN_VALIDATE_NEW(pStream, XnSensorClientAudioStream, this, StreamType, StreamName);
 	}
-	else if (strcmp(StreamType, XN_STREAM_TYPE_DEPTH) == 0)
-	{
-		XN_VALIDATE_NEW(pStream, XnSensorClientDepthStream, this, StreamType, StreamName);
-	}
 	else
 	{
 		XN_VALIDATE_NEW(pStream, XnSensorClientFrameStream, this, StreamType, StreamName);
diff --git a/Source/XnDeviceSensorV2/XnSensorClientStream.cpp b/Source/XnDeviceSensorV2/XnSensorClientStream.cpp
index 72b640d..cdecb02 100644
--- a/Source/XnDeviceSensorV2/XnSensorClientStream.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorClientStream.cpp
@@ -166,53 +166,6 @@ XnStatus XnSensorClientFrameStream::CreateStreamData(XnStreamData** ppStreamData
 }
 
 //---------------------------------------------------------------------------
-// Client Depth Stream
-//---------------------------------------------------------------------------
-XnSensorClientDepthStream::XnSensorClientDepthStream(XnSensorClient* pClient, const XnChar* strType, const XnChar* strName) :
-	XnSensorClientFrameStream(pClient, strType, strName)
-{}
-
-XnSensorClientDepthStream::~XnSensorClientDepthStream()
-{}
-
-
-XnStatus XnSensorClientDepthStream::ReadImpl(XnStreamData* pStreamOutput)
-{
-	XnStatus nRetVal = XN_STATUS_OK;
-	
-	nRetVal = XnSensorClientFrameStream::ReadImpl(pStreamOutput);
-	XN_IS_STATUS_OK(nRetVal);
-
-	m_pLastFrameShiftsMapOffset = (XnUInt16*)(((XnUInt8*)pStreamOutput->pData) + pStreamOutput->nDataSize);
-
-	return (XN_STATUS_OK);
-}
-
-XnStatus XnSensorClientDepthStream::GetProperty(const XnChar* strName, const XnGeneralBuffer& gbValue) const
-{
-	XnStatus nRetVal = XN_STATUS_OK;
-	
-	if (strcmp(strName, XN_STREAM_PROPERTY_SHIFTS_MAP) == 0)
-	{
-		// shifts-map is at the end of the depth map
-		if (gbValue.nDataSize != sizeof(m_pLastFrameShiftsMapOffset))	
-		{
-			return XN_STATUS_DEVICE_PROPERTY_SIZE_DONT_MATCH;
-		}
-
-		const XnUInt16** ppShiftsMap = (const XnUInt16**)gbValue.pData;
-		*ppShiftsMap = m_pLastFrameShiftsMapOffset;
-	}
-	else
-	{
-		nRetVal = XnSensorClientFrameStream::GetProperty(strName, gbValue);
-		XN_IS_STATUS_OK(nRetVal);
-	}
-
-	return (XN_STATUS_OK);
-}
-
-//---------------------------------------------------------------------------
 // Client Audio Stream
 //---------------------------------------------------------------------------
 XnSensorClientAudioStream::XnSensorClientAudioStream(XnSensorClient* pClient, const XnChar* strType, const XnChar* strName) :
@@ -328,4 +281,3 @@ XnStatus XnSensorClientAudioStream::ReadImpl(XnStreamData* pStreamOutput)
 
 	return (XN_STATUS_OK);
 }
-
diff --git a/Source/XnDeviceSensorV2/XnSensorClientStream.h b/Source/XnDeviceSensorV2/XnSensorClientStream.h
index 3029848..26cd2f6 100644
--- a/Source/XnDeviceSensorV2/XnSensorClientStream.h
+++ b/Source/XnDeviceSensorV2/XnSensorClientStream.h
@@ -69,23 +69,6 @@ private:
 };
 
 //---------------------------------------------------------------------------
-// Client Depth Stream
-//---------------------------------------------------------------------------
-class XnSensorClientDepthStream : public XnSensorClientFrameStream
-{
-public:
-	XnSensorClientDepthStream(XnSensorClient* pClient, const XnChar* strType, const XnChar* strName);
-	~XnSensorClientDepthStream();
-
-protected:
-	XnStatus ReadImpl(XnStreamData* pStreamOutput);
-	virtual XnStatus GetProperty(const XnChar* strName, const XnGeneralBuffer& gbValue) const;
-
-private:
-	XnUInt16* m_pLastFrameShiftsMapOffset;
-};
-
-//---------------------------------------------------------------------------
 // Client Audio Stream
 //---------------------------------------------------------------------------
 class XnSensorClientAudioStream : public XnSensorClientStream
diff --git a/Source/XnDeviceSensorV2/XnSensorDepthGenerator.cpp b/Source/XnDeviceSensorV2/XnSensorDepthGenerator.cpp
index 546b3f7..eaff6f1 100644
--- a/Source/XnDeviceSensorV2/XnSensorDepthGenerator.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorDepthGenerator.cpp
@@ -26,7 +26,7 @@
 #include <XnOpenNI.h>
 #include <XnOS.h>
 #include <XnPsVersion.h>
-#include <XnCommon.h>
+#include <XnCommon/XnCommon.h>
 #include <math.h>
 
 //---------------------------------------------------------------------------
@@ -103,7 +103,7 @@ void XnSensorDepthGenerator::GetFieldOfView(XnFieldOfView& FOV)
 
 XnStatus XnSensorDepthGenerator::RegisterToFieldOfViewChange(XnModuleStateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback)
 {
-	return m_fovChangedEvent.Register(handler, pCookie, hCallback);
+	return m_fovChangedEvent.Register(handler, pCookie, &hCallback);
 }
 
 void XnSensorDepthGenerator::UnregisterFromFieldOfViewChange(XnCallbackHandle hCallback)
diff --git a/Source/XnDeviceSensorV2/XnSensorDepthGenerator.h b/Source/XnDeviceSensorV2/XnSensorDepthGenerator.h
index 66b6f50..2e7aaf0 100644
--- a/Source/XnDeviceSensorV2/XnSensorDepthGenerator.h
+++ b/Source/XnDeviceSensorV2/XnSensorDepthGenerator.h
@@ -27,7 +27,6 @@
 //---------------------------------------------------------------------------
 #include "XnSensorMapGenerator.h"
 #include "XnExportedSensorGenerator.h"
-#include <XnEventT.h>
 
 //---------------------------------------------------------------------------
 // Types
@@ -90,7 +89,8 @@ private:
 
 	static void XN_CALLBACK_TYPE RealWorldTranslationPropChanged(void* pCookie);
 
-	XnEventNoArgs m_fovChangedEvent;
+	XN_DECLARE_EVENT_0ARG(PropChangeEvent, PropChangeEventInterface);
+	PropChangeEvent m_fovChangedEvent;
 
 	XnCallbackHandle m_hRWPropCallback;
 
diff --git a/Source/XnDeviceSensorV2/XnSensorDepthStream.cpp b/Source/XnDeviceSensorV2/XnSensorDepthStream.cpp
index a94979b..5c2ed2e 100644
--- a/Source/XnDeviceSensorV2/XnSensorDepthStream.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorDepthStream.cpp
@@ -27,7 +27,6 @@
 #include "XnUncompressedDepthProcessor.h"
 #include "XnPSCompressedDepthProcessor.h"
 #include "XnPacked11DepthProcessor.h"
-#include "XnPacked12DepthProcessor.h"
 #include "Registration.h"
 #include "XnCmosInfo.h"
 #include <XnOS.h>
@@ -46,12 +45,16 @@
 
 #define XN_DEPTH_STREAM_AGC_NUMBER_OF_BINS					4
 
+#define XN_DEPTH_MAX_BUFFER_SIZE							(XN_VGA_X_RES * XN_VGA_Y_RES * sizeof(XnDepthPixel))
+
 //---------------------------------------------------------------------------
 // XnSensorDepthStream class
 //---------------------------------------------------------------------------
-XnSensorDepthStream::XnSensorDepthStream(const XnChar* strName, XnSensorObjects* pObjects) : 
+XnSensorDepthStream::XnSensorDepthStream(const XnChar* strDeviceName, const XnChar* strName, XnSensorObjects* pObjects, XnUInt32 nBufferCount, XnBool bAllowOtherUsers) : 
 	XnDepthStream(strName, FALSE, XN_DEVICE_SENSOR_MAX_DEPTH, XN_SHIFTS_MAX_SHIFT),
 	m_Helper(pObjects),
+	m_BufferPool(nBufferCount, strDeviceName, strName, XN_DEPTH_MAX_BUFFER_SIZE, bAllowOtherUsers),
+	m_SharedBufferName(XN_STREAM_PROPERTY_SHARED_BUFFER_NAME, m_BufferPool.GetSharedMemoryName()),
 	m_InputFormat(XN_STREAM_PROPERTY_INPUT_FORMAT, XN_DEPTH_STREAM_DEFAULT_INPUT_FORMAT),
 	m_DepthRegistration(XN_STREAM_PROPERTY_REGISTRATION, XN_DEPTH_STREAM_DEFAULT_REGISTRATION),
 	m_HoleFilter(XN_STREAM_PROPERTY_HOLE_FILTER, XN_DEPTH_STREAM_DEFAULT_HOLE_FILLER),
@@ -60,9 +63,6 @@ XnSensorDepthStream::XnSensorDepthStream(const XnChar* strName, XnSensorObjects*
 	m_RegistrationType(XN_STREAM_PROPERTY_REGISTRATION_TYPE, XN_DEPTH_STREAM_DEFAULT_REGISTRATION_TYPE),
 	m_AGCBin(XN_STREAM_PROPERTY_AGC_BIN, NULL, ReadAGCBinsFromFile),
 	m_GMCMode(XN_STREAM_PROPERTY_GMC_MODE, XN_DEPTH_STREAM_DEFAULT_GMC_MODE),
-	m_CloseRange(XN_STREAM_PROPERTY_CLOSE_RANGE, XN_DEPTH_STREAM_DEFAULT_CLOSE_RANGE),
-	m_ShiftsMap(XN_STREAM_PROPERTY_SHIFTS_MAP),
-	m_pLastFrameShiftsMap(NULL),
 	m_FirmwareMirror("FirmwareMirror", FALSE, strName),
 	m_FirmwareRegistration("FirmwareRegistration", FALSE, strName),
 	m_FirmwareCropSizeX("FirmwareCropSizeX", 0, strName),
@@ -80,8 +80,8 @@ XnStatus XnSensorDepthStream::Init()
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 
-//	nRetVal = SetBufferPool(&m_BufferPool);
-//	XN_IS_STATUS_OK(nRetVal);
+	nRetVal = SetBufferPool(&m_BufferPool);
+	XN_IS_STATUS_OK(nRetVal);
 
 	// init base
 	nRetVal = XnDepthStream::Init();
@@ -96,13 +96,11 @@ XnStatus XnSensorDepthStream::Init()
 	m_AGCBin.UpdateSetCallback(SetAGCBinCallback, this);
 	m_AGCBin.UpdateGetCallback(GetAGCBinCallback, this);
 	m_GMCMode.UpdateSetCallback(SetGMCModeCallback, this);
-	m_CloseRange.UpdateSetCallback(SetCloseRangeCallback, this);
-	m_ShiftsMap.UpdateGetCallback(GetShiftsMapCallback, this);
 
 
 	XN_VALIDATE_ADD_PROPERTIES(this, &m_InputFormat, &m_DepthRegistration, &m_HoleFilter, 
-		&m_WhiteBalance, &m_Gain, &m_AGCBin, &m_ActualRead, &m_GMCMode, 
-		&m_CloseRange, &m_RegistrationType, &m_ShiftsMap);
+		&m_WhiteBalance, &m_Gain, &m_AGCBin, &m_SharedBufferName, &m_ActualRead, &m_GMCMode, 
+		&m_RegistrationType);
 
 
 	if (m_Helper.GetPrivateData()->pSensor->IsLowBandwidth())
@@ -173,7 +171,7 @@ XnStatus XnSensorDepthStream::Init()
 
 	// registration
 	XnCallbackHandle hCallbackDummy;	
-	nRetVal = ResolutionProperty().OnChangeEvent().Register(DecideFirmwareRegistrationCallback, this, hCallbackDummy);
+	nRetVal = ResolutionProperty().OnChangeEvent().Register(DecideFirmwareRegistrationCallback, this, &hCallbackDummy);
 	XN_IS_STATUS_OK(nRetVal);
 
 	nRetVal = DecideFirmwareRegistration((XnBool)m_DepthRegistration.GetValue(), (XnProcessingType)m_RegistrationType.GetValue(), GetResolution());
@@ -187,7 +185,7 @@ XnStatus XnSensorDepthStream::Init()
 	XN_IS_STATUS_OK(nRetVal);
 
 	// pixel size factor
-	nRetVal = GetFirmwareParams()->m_ReferenceResolution.OnChangeEvent().Register(DecidePixelSizeFactorCallback, this, m_hReferenceSizeChangedCallback);
+	nRetVal = GetFirmwareParams()->m_ReferenceResolution.OnChangeEvent().Register(DecidePixelSizeFactorCallback, this, &m_hReferenceSizeChangedCallback);
 	XN_IS_STATUS_OK(nRetVal);
 
 	nRetVal = DecidePixelSizeFactor();
@@ -195,10 +193,35 @@ XnStatus XnSensorDepthStream::Init()
 
 
 	// register supported modes
-	XnCmosPreset* pSupportedModes = m_Helper.GetPrivateData()->FWInfo.depthModes.GetData();
-	XnUInt8 nSupportedModes = m_Helper.GetPrivateData()->FWInfo.depthModes.GetSize();
-	nRetVal = AddSupportedModes(pSupportedModes, nSupportedModes);
-	XN_IS_STATUS_OK(nRetVal);
+	XnCmosPreset aSupportedModes[] = 
+	{
+		{ XN_IO_DEPTH_FORMAT_COMPRESSED_PS, XN_RESOLUTION_QVGA, 30 },
+		{ XN_IO_DEPTH_FORMAT_COMPRESSED_PS, XN_RESOLUTION_QVGA, 60 },
+		{ XN_IO_DEPTH_FORMAT_COMPRESSED_PS, XN_RESOLUTION_VGA, 30 },
+		{ XN_IO_DEPTH_FORMAT_UNCOMPRESSED_11_BIT, XN_RESOLUTION_QVGA, 30 },
+		{ XN_IO_DEPTH_FORMAT_UNCOMPRESSED_11_BIT, XN_RESOLUTION_QVGA, 60 },
+		{ XN_IO_DEPTH_FORMAT_UNCOMPRESSED_11_BIT, XN_RESOLUTION_VGA, 30 },
+		{ XN_IO_DEPTH_FORMAT_UNCOMPRESSED_16_BIT, XN_RESOLUTION_QVGA, 30 },
+		{ XN_IO_DEPTH_FORMAT_UNCOMPRESSED_16_BIT, XN_RESOLUTION_QVGA, 60 },
+		{ XN_IO_DEPTH_FORMAT_UNCOMPRESSED_16_BIT, XN_RESOLUTION_VGA, 30 },
+	};
+	nRetVal = AddSupportedModes(aSupportedModes, sizeof(aSupportedModes)/sizeof(aSupportedModes[0]));
+	XN_IS_STATUS_OK(nRetVal);
+
+	if (m_Helper.GetFirmwareVersion() >= XN_SENSOR_FW_VER_5_2)
+	{
+		XnCmosPreset aSupportedModes25[] = 
+		{
+			{ XN_IO_DEPTH_FORMAT_COMPRESSED_PS, XN_RESOLUTION_QVGA, 25 },
+			{ XN_IO_DEPTH_FORMAT_COMPRESSED_PS, XN_RESOLUTION_VGA, 25 },
+			{ XN_IO_DEPTH_FORMAT_UNCOMPRESSED_11_BIT, XN_RESOLUTION_QVGA, 25 },
+			{ XN_IO_DEPTH_FORMAT_UNCOMPRESSED_11_BIT, XN_RESOLUTION_VGA, 25 },
+			{ XN_IO_DEPTH_FORMAT_UNCOMPRESSED_16_BIT, XN_RESOLUTION_QVGA, 25 },
+			{ XN_IO_DEPTH_FORMAT_UNCOMPRESSED_16_BIT, XN_RESOLUTION_VGA, 25 },
+		};
+		nRetVal = AddSupportedModes(aSupportedModes25, sizeof(aSupportedModes25)/sizeof(aSupportedModes25[0]));
+		XN_IS_STATUS_OK(nRetVal);
+	}
 
 	return (XN_STATUS_OK);
 }
@@ -254,8 +277,6 @@ XnStatus XnSensorDepthStream::MapPropertiesToFirmware()
 	XN_IS_STATUS_OK(nRetVal);;
 	nRetVal = m_Helper.MapFirmwareProperty(m_GMCMode, GetFirmwareParams()->m_GMCMode, TRUE);
 	XN_IS_STATUS_OK(nRetVal);;
-	nRetVal = m_Helper.MapFirmwareProperty(m_CloseRange, GetFirmwareParams()->m_DepthCloseRange, TRUE);
-	XN_IS_STATUS_OK(nRetVal);;
 	
 	return (XN_STATUS_OK);
 }
@@ -334,10 +355,6 @@ XnStatus XnSensorDepthStream::OpenStreamImpl()
 	nRetVal = GetFirmwareParams()->m_Stream1Mode.SetValue(XN_VIDEO_STREAM_DEPTH);
 	XN_IS_STATUS_OK(nRetVal);
 
-	// CloseRange
-	nRetVal = m_Helper.ConfigureFirmware(m_CloseRange);
-	XN_IS_STATUS_OK(nRetVal);
-
 	// Cropping
 	if (m_FirmwareCropEnabled.GetValue() == TRUE)
 	{
@@ -471,12 +488,6 @@ XnStatus XnSensorDepthStream::SetInputFormat(XnIODepthFormats nInputFormat)
 			XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_UNSUPPORTED_MODE, XN_MASK_DEVICE_SENSOR, "11-bit depth is not supported on this sensor!");
 		}
 		break;
-	case XN_IO_DEPTH_FORMAT_UNCOMPRESSED_12_BIT:
-		if (m_Helper.GetFirmwareVersion() < XN_SENSOR_FW_VER_4_0)
-		{
-			XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_UNSUPPORTED_MODE, XN_MASK_DEVICE_SENSOR, "12-bit depth is not supported on this sensor!");
-		}
-		break;
 	default:
 		XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "Unknown depth input format: %d", nInputFormat);
 	}
@@ -560,16 +571,6 @@ XnStatus XnSensorDepthStream::SetGMCMode(XnBool bGMCMode)
 	return (XN_STATUS_OK);
 }
 
-XnStatus XnSensorDepthStream::SetCloseRange(XnBool bCloseRange)
-{
-	XnStatus nRetVal = XN_STATUS_OK;
-
-	nRetVal = m_Helper.SimpleSetFirmwareParam(m_CloseRange, (XnUInt16)bCloseRange);
-	XN_IS_STATUS_OK(nRetVal);
-
-	return (XN_STATUS_OK);
-}
-
 
 XnStatus XnSensorDepthStream::SetAGCBin(const XnDepthAGCBin* pBin)
 {
@@ -697,27 +698,9 @@ XnStatus XnSensorDepthStream::PostProcessFrame(XnStreamData* pFrameData)
 
 	m_Helper.GetFPS()->MarkOutputDepth(pFrameData->nFrameID, pFrameData->nTimestamp);
 
-	// data size is only half (second half is the shifts map)
-	pFrameData->nDataSize /= 2;
-
-	m_pLastFrameShiftsMap = (XnUInt16*)((XnUInt8*)pFrameData->pData + pFrameData->nDataSize);
-
 	return (XN_STATUS_OK);
 }
 
-XnStatus XnSensorDepthStream::CalcRequiredSize(XnUInt32* pnRequiredSize) const
-{
-	XnStatus nRetVal = XN_STATUS_OK;
-	
-	nRetVal = XnDepthStream::CalcRequiredSize(pnRequiredSize);
-	XN_IS_STATUS_OK(nRetVal);
-
-	// we also store shifts
-	*pnRequiredSize *= 2;
-
-	return XN_STATUS_OK;
-}
-
 XnStatus XnSensorDepthStream::ReallocTripleFrameBuffer()
 {
 	XnStatus nRetVal = XN_STATUS_OK;
@@ -776,27 +759,18 @@ XnStatus XnSensorDepthStream::Mirror(XnStreamData* pStreamOutput) const
 
 XnStatus XnSensorDepthStream::CreateDataProcessor(XnDataProcessor** ppProcessor)
 {
-	XnStatus nRetVal = XN_STATUS_OK;
-
-	XnFrameBufferManager* pBufferManager;
-	nRetVal = GetTripleBuffer(&pBufferManager);
-	XN_IS_STATUS_OK(nRetVal);
-
 	XnStreamProcessor* pNew;
 
 	switch (m_InputFormat.GetValue())
 	{
 	case XN_IO_DEPTH_FORMAT_UNCOMPRESSED_16_BIT:
-		XN_VALIDATE_NEW_AND_INIT(pNew, XnUncompressedDepthProcessor, this, &m_Helper, pBufferManager);
+		XN_VALIDATE_NEW_AND_INIT(pNew, XnUncompressedDepthProcessor, this, &m_Helper);
 		break;
 	case XN_IO_DEPTH_FORMAT_COMPRESSED_PS:
-		XN_VALIDATE_NEW_AND_INIT(pNew, XnPSCompressedDepthProcessor, this, &m_Helper, pBufferManager);
+		XN_VALIDATE_NEW_AND_INIT(pNew, XnPSCompressedDepthProcessor, this, &m_Helper);
 		break;
 	case XN_IO_DEPTH_FORMAT_UNCOMPRESSED_11_BIT:
-		XN_VALIDATE_NEW_AND_INIT(pNew, XnPacked11DepthProcessor, this, &m_Helper, pBufferManager);
-		break;
-	case XN_IO_DEPTH_FORMAT_UNCOMPRESSED_12_BIT:
-		XN_VALIDATE_NEW_AND_INIT(pNew, XnPacked12DepthProcessor, this, &m_Helper, pBufferManager);
+		XN_VALIDATE_NEW_AND_INIT(pNew, XnPacked11DepthProcessor, this, &m_Helper);
 		break;
 	default:
 		return XN_STATUS_IO_INVALID_STREAM_DEPTH_FORMAT;
@@ -829,9 +803,9 @@ XnStatus XnSensorDepthStream::DecideFirmwareRegistration(XnBool bRegistration, X
 			}
 			break;
 		case XN_PROCESSING_SOFTWARE:
-			if (GetFPS() == 60)
+			if (GetResolution() != XN_RESOLUTION_VGA)
 			{
-				XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "Software registration is not supported in 60 FPS mode!");
+				XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "Software registration is only supported for VGA resolution!");
 			}
 			bFirmwareRegistration = FALSE;
 			break;
@@ -935,12 +909,6 @@ XnStatus XN_CALLBACK_TYPE XnSensorDepthStream::SetGMCModeCallback(XnActualIntPro
 	return pStream->SetGMCMode((XnBool)nValue);
 }
 
-XnStatus XN_CALLBACK_TYPE XnSensorDepthStream::SetCloseRangeCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
-{
-	XnSensorDepthStream* pStream = (XnSensorDepthStream*)pCookie;
-	return pStream->SetCloseRange((XnBool)nValue);
-}
-
 
 XnStatus XN_CALLBACK_TYPE XnSensorDepthStream::SetAGCBinCallback(XnGeneralProperty* /*pSender*/, const XnGeneralBuffer& gbValue, void* pCookie)
 {
@@ -1028,20 +996,3 @@ XnStatus XN_CALLBACK_TYPE XnSensorDepthStream::ReadAGCBinsFromFile(XnGeneralProp
 
 	return XN_STATUS_OK;
 }
-
-XnStatus XN_CALLBACK_TYPE XnSensorDepthStream::GetShiftsMapCallback(const XnGeneralProperty* /*pSender*/, const XnGeneralBuffer& gbValue, void* pCookie)
-{
-	XnStatus nRetVal = XN_STATUS_OK;
-
-	XnSensorDepthStream* pThis = (XnSensorDepthStream*)pCookie;
-
-	if (gbValue.nDataSize != sizeof(XnSizeT))
-	{
-		return XN_STATUS_DEVICE_PROPERTY_SIZE_DONT_MATCH;
-	}
-
-	const XnUInt16** ppShiftsMap = (const XnUInt16**)gbValue.pData;
-	*ppShiftsMap = pThis->m_pLastFrameShiftsMap;
-	
-	return (XN_STATUS_OK);
-}
diff --git a/Source/XnDeviceSensorV2/XnSensorDepthStream.h b/Source/XnDeviceSensorV2/XnSensorDepthStream.h
index 29e0fbe..7ac329a 100644
--- a/Source/XnDeviceSensorV2/XnSensorDepthStream.h
+++ b/Source/XnDeviceSensorV2/XnSensorDepthStream.h
@@ -29,19 +29,14 @@
 #include "XnDeviceSensorProtocol.h"
 #include "Registration.h"
 #include "XnSensorStreamHelper.h"
+#include "XnSharedMemoryBufferPool.h"
 
 
 //---------------------------------------------------------------------------
 // Defines
 //---------------------------------------------------------------------------
-#if (XN_PLATFORM == XN_PLATFORM_LINUX_ARM)
-	#define XN_DEPTH_STREAM_DEFAULT_INPUT_FORMAT				XN_IO_DEPTH_FORMAT_UNCOMPRESSED_12_BIT
-	#define XN_DEPTH_STREAM_DEFAULT_RESOLUTION					XN_RESOLUTION_QQVGA
-#else
-	#define XN_DEPTH_STREAM_DEFAULT_INPUT_FORMAT				XN_IO_DEPTH_FORMAT_UNCOMPRESSED_11_BIT
-	#define XN_DEPTH_STREAM_DEFAULT_RESOLUTION					XN_RESOLUTION_QVGA
-#endif
-
+#define XN_DEPTH_STREAM_DEFAULT_INPUT_FORMAT				XN_IO_DEPTH_FORMAT_UNCOMPRESSED_11_BIT
+#define XN_DEPTH_STREAM_DEFAULT_RESOLUTION					XN_RESOLUTION_QVGA
 #define XN_DEPTH_STREAM_DEFAULT_FPS							30
 #define XN_DEPTH_STREAM_DEFAULT_OUTPUT_FORMAT				XN_OUTPUT_FORMAT_DEPTH_VALUES
 #define XN_DEPTH_STREAM_DEFAULT_REGISTRATION				FALSE
@@ -50,8 +45,6 @@
 #define XN_DEPTH_STREAM_DEFAULT_WHITE_BALANCE				TRUE
 #define XN_DEPTH_STREAM_DEFAULT_GAIN_OLD					50
 #define XN_DEPTH_STREAM_DEFAULT_GMC_MODE					TRUE
-#define XN_DEPTH_STREAM_DEFAULT_CLOSE_RANGE					FALSE
-#define XN_DEPTH_STREAM_DEFAULT_SHIFT_MAP_APPENDED			TRUE
 
 
 //---------------------------------------------------------------------------
@@ -60,7 +53,7 @@
 class XnSensorDepthStream : public XnDepthStream, public IXnSensorStream
 {
 public:
-	XnSensorDepthStream(const XnChar* strName, XnSensorObjects* pObjects);
+	XnSensorDepthStream(const XnChar* strDeviceName, const XnChar* strName, XnSensorObjects* pObjects, XnUInt32 nBufferCount, XnBool bAllowOtherUsers);
 	~XnSensorDepthStream() { Free(); }
 
 	//---------------------------------------------------------------------------
@@ -83,7 +76,6 @@ protected:
 	XnStatus Open() { return m_Helper.Open(); }
 	XnStatus Close() { return m_Helper.Close(); }
 	XnStatus PostProcessFrame(XnStreamData* pFrameData);
-	XnStatus CalcRequiredSize(XnUInt32* pnRequiredSize) const;
 	XnStatus ReallocTripleFrameBuffer();
 	XnStatus CropImpl(XnStreamData* pStreamOutput, const XnCropping* pCropping);
 	XnStatus Mirror(XnStreamData* pStreamOutput) const;
@@ -94,6 +86,7 @@ protected:
 	XnStatus MapPropertiesToFirmware();
 	void GetFirmwareStreamConfig(XnResolutions* pnRes, XnUInt32* pnFPS) { *pnRes = GetResolution(); *pnFPS = GetFPS(); }
 	XnStatus WriteImpl(XnStreamData* /*pStreamData*/) { return XN_STATUS_DEVICE_UNSUPPORTED_MODE; }
+	XnSharedMemoryBufferPool* GetSharedMemoryBuffer() { return &m_BufferPool; }
 
 
 protected:
@@ -115,7 +108,6 @@ protected:
 	XnStatus SetCropping(const XnCropping* pCropping);
 	XnStatus SetActualRead(XnBool bRead);
 	virtual XnStatus SetGMCMode(XnBool bGMCMode);
-	virtual XnStatus SetCloseRange(XnBool bCloseRange);
 
 
 private:
@@ -136,14 +128,15 @@ private:
 	static XnStatus XN_CALLBACK_TYPE DecidePixelSizeFactorCallback(const XnProperty* pSender, void* pCookie);
 	static XnStatus XN_CALLBACK_TYPE ReadAGCBinsFromFile(XnGeneralProperty* pSender, const XnChar* csINIFile, const XnChar* csSection);
 	static XnStatus XN_CALLBACK_TYPE SetGMCModeCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie);
-	static XnStatus XN_CALLBACK_TYPE SetCloseRangeCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie);
-	static XnStatus XN_CALLBACK_TYPE GetShiftsMapCallback(const XnGeneralProperty* pSender, const XnGeneralBuffer& gbValue, void* pCookie);
 
 
 	//---------------------------------------------------------------------------
 	// Members
 	//---------------------------------------------------------------------------
 	XnSensorStreamHelper m_Helper;
+	XnSharedMemoryBufferPool m_BufferPool;
+
+	XnActualStringProperty m_SharedBufferName;
 	XnActualIntProperty m_InputFormat;
 	XnActualIntProperty m_DepthRegistration;
 	XnActualIntProperty m_HoleFilter;
@@ -163,9 +156,6 @@ private:
 
 	XnActualIntProperty m_ActualRead;
 	XnActualIntProperty m_GMCMode;
-	XnActualIntProperty m_CloseRange;
-	XnGeneralProperty m_ShiftsMap;
-	const XnUInt16* m_pLastFrameShiftsMap;
 
 
 	XnRegistration m_Registration;
diff --git a/Source/XnDeviceSensorV2/XnSensorFirmware.cpp b/Source/XnDeviceSensorV2/XnSensorFirmware.cpp
index e48c1af..681fac7 100644
--- a/Source/XnDeviceSensorV2/XnSensorFirmware.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorFirmware.cpp
@@ -32,12 +32,11 @@ XnSensorFirmware::XnSensorFirmware(XnDevicePrivateData* pDevicePrivateData) :
 	m_Commands(pDevicePrivateData),
 	m_Params(m_pInfo, &m_Commands),
 	m_Streams(pDevicePrivateData),
-	m_FixedParams(pDevicePrivateData),
 	m_pDevicePrivateData(pDevicePrivateData)
 {
 }
 
-XnStatus XnSensorFirmware::Init(XnBool bReset, XnBool bLeanInit)
+XnStatus XnSensorFirmware::Init(XnBool bReset)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 
@@ -112,38 +111,18 @@ XnStatus XnSensorFirmware::Init(XnBool bReset, XnBool bLeanInit)
 		}
 	}
 
-	if (!bLeanInit)
-	{
-		nRetVal = m_FixedParams.Init();
-		XN_IS_STATUS_OK(nRetVal);
-
-		nRetVal = m_Params.Init();
-		XN_IS_STATUS_OK(nRetVal);
-
-		if (nMode == XN_HOST_PROTOCOL_MODE_PS)
-		{
-			nRetVal = m_Params.UpdateAllProperties();
-			XN_IS_STATUS_OK(nRetVal);
-		}
-
-		// Check if image is supported
-		if (m_pInfo->bGetImageCmosTypeSupported)
-		{
-			m_pInfo->bImageSupported = (m_FixedParams.GetImageCmosType() != 0);
-		}
-		else
-		{
-			// This is an ugly patch to find out if this sensor has an image CMOS. It will be fixed
-			// in future firmwares so we can just ask.
-			XnUInt16 nLines;
-			nRetVal = XnHostProtocolGetCmosBlanking(m_pDevicePrivateData, XN_CMOS_TYPE_IMAGE, &nLines);
-			m_pInfo->bImageSupported = (nRetVal == XN_STATUS_OK && nLines > 0);
-		}
+	nRetVal = m_Params.Init();
+	XN_IS_STATUS_OK(nRetVal);
 
-		nRetVal = m_Streams.Init();
+	if (nMode == XN_HOST_PROTOCOL_MODE_PS)
+	{
+		nRetVal = m_Params.UpdateAllProperties();
 		XN_IS_STATUS_OK(nRetVal);
 	}
 
+	nRetVal = m_Streams.Init();
+	XN_IS_STATUS_OK(nRetVal);
+
 	return (XN_STATUS_OK);
 }
 
diff --git a/Source/XnDeviceSensorV2/XnSensorFirmware.h b/Source/XnDeviceSensorV2/XnSensorFirmware.h
index 6faee3a..3ae7f9a 100644
--- a/Source/XnDeviceSensorV2/XnSensorFirmware.h
+++ b/Source/XnDeviceSensorV2/XnSensorFirmware.h
@@ -29,7 +29,6 @@
 #include "XnFirmwareCommands.h"
 #include "XnSensorFirmwareParams.h"
 #include "XnFirmwareStreams.h"
-#include "XnSensorFixedParams.h"
 
 //---------------------------------------------------------------------------
 // Types
@@ -38,21 +37,19 @@ class XnSensorFirmware
 {
 public:
 	XnSensorFirmware(XnDevicePrivateData* pDevicePrivateData);
-	XnStatus Init(XnBool bReset, XnBool bLeanInit);
+	XnStatus Init(XnBool bReset);
 	void Free();
 
 	inline XnFirmwareInfo* GetInfo() { return m_pInfo; }
 	inline XnFirmwareCommands* GetCommands() { return &m_Commands; }
 	inline XnSensorFirmwareParams* GetParams() { return &m_Params; }
 	inline XnFirmwareStreams* GetStreams() { return &m_Streams; }
-	inline XnSensorFixedParams* GetFixedParams() { return &m_FixedParams; }
 
 private:
 	XnFirmwareInfo* m_pInfo;
 	XnFirmwareCommands m_Commands;
 	XnSensorFirmwareParams m_Params;
 	XnFirmwareStreams m_Streams;
-	XnSensorFixedParams m_FixedParams;
 	XnDevicePrivateData* m_pDevicePrivateData;
 };
 
diff --git a/Source/XnDeviceSensorV2/XnSensorFirmwareParams.cpp b/Source/XnDeviceSensorV2/XnSensorFirmwareParams.cpp
index a661dc6..913fb6a 100644
--- a/Source/XnDeviceSensorV2/XnSensorFirmwareParams.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorFirmwareParams.cpp
@@ -83,7 +83,6 @@ XnSensorFirmwareParams::XnSensorFirmwareParams(XnFirmwareInfo* pInfo, XnFirmware
 	m_ImageExposureBar("ImageExposureBar"),
 	m_ImageLowLightCompensation("ImageLowLightCompensation"),
 	m_ImageGain("ImageGain"),
-	m_DepthCloseRange("CloseRange"),
 	m_pInfo(pInfo),
 	m_pCommands(pCommands),
 	m_bInTransaction(FALSE)
@@ -197,30 +196,29 @@ XnStatus XnSensorFirmwareParams::Init()
 	XN_IS_STATUS_OK(nRetVal);
 	nRetVal = AddFirmwareParam(		m_ImageAutoExposure,		PARAM_IMAGE_AUTO_EXPOSURE_MODE,				XN_SENSOR_FW_VER_5_4,	XN_SENSOR_FW_VER_UNKNOWN,	FALSE);
 	XN_IS_STATUS_OK(nRetVal);
-	nRetVal = AddFirmwareParam(		m_ImageExposureBar,			PARAM_IMAGE_EXPOSURE_BAR,					XN_SENSOR_FW_VER_5_4,	XN_SENSOR_FW_VER_UNKNOWN,	0);
+	nRetVal = AddFirmwareParam(		m_ImageExposureBar,			PARAM_IMAGE_EXPOSURE_BAR,				XN_SENSOR_FW_VER_5_4,	XN_SENSOR_FW_VER_UNKNOWN,	0);
 	XN_IS_STATUS_OK(nRetVal);
 	nRetVal = AddFirmwareParam(		m_ImageLowLightCompensation,PARAM_IMAGE_LOW_LIGHT_COMPENSATION_MODE,	XN_SENSOR_FW_VER_5_4,	XN_SENSOR_FW_VER_UNKNOWN,	FALSE);
 	XN_IS_STATUS_OK(nRetVal);
 	nRetVal = AddFirmwareParam(		m_ImageGain,				PARAM_IMAGE_AGC,							XN_SENSOR_FW_VER_5_4,	XN_SENSOR_FW_VER_UNKNOWN,	0);
 	XN_IS_STATUS_OK(nRetVal);
-	nRetVal = AddFirmwareParam(		m_DepthCloseRange,			PARAM_DEPTH_CLOSE_RANGE,					XN_SENSOR_FW_VER_5_6,	XN_SENSOR_FW_VER_UNKNOWN,	FALSE);
-	XN_IS_STATUS_OK(nRetVal);
 
 	// override some props
+	m_ImageResolution.UpdateSetCallback(SetImageResolutionCallback, this);
 	m_ImageFormat.UpdateSetCallback(SetImageFormatCallback, this);
 
 	// register for some interesting changes
 	XnCallbackHandle hCallbackDummy;
-	nRetVal = m_Stream0Mode.OnChangeEvent().Register(ReferenceResolutionPropertyValueChanged, this, hCallbackDummy);
+	nRetVal = m_Stream0Mode.OnChangeEvent().Register(ReferenceResolutionPropertyValueChanged, this, &hCallbackDummy);
 	XN_IS_STATUS_OK(nRetVal);
 
-	nRetVal = m_Stream1Mode.OnChangeEvent().Register(ReferenceResolutionPropertyValueChanged, this, hCallbackDummy);
+	nRetVal = m_Stream1Mode.OnChangeEvent().Register(ReferenceResolutionPropertyValueChanged, this, &hCallbackDummy);
 	XN_IS_STATUS_OK(nRetVal);
 
-	nRetVal = m_IRResolution.OnChangeEvent().Register(ReferenceResolutionPropertyValueChanged, this, hCallbackDummy);
+	nRetVal = m_IRResolution.OnChangeEvent().Register(ReferenceResolutionPropertyValueChanged, this, &hCallbackDummy);
 	XN_IS_STATUS_OK(nRetVal);
 
-	nRetVal = m_DepthFPS.OnChangeEvent().Register(ReferenceResolutionPropertyValueChanged, this, hCallbackDummy);
+	nRetVal = m_DepthFPS.OnChangeEvent().Register(ReferenceResolutionPropertyValueChanged, this, &hCallbackDummy);
 	XN_IS_STATUS_OK(nRetVal);
 
 	nRetVal = RecalculateReferenceResolution();
@@ -277,9 +275,9 @@ XnStatus XnSensorFirmwareParams::UpdateAllProperties()
 
 	xnLogVerbose(XN_MASK_DEVICE_SENSOR, "Reading all params from firmware...");
 
-	for (XnFirmwareParamsHash::Iterator it = m_AllFirmwareParams.Begin(); it != m_AllFirmwareParams.End(); ++it)
+	for (XnFirmwareParamsHash::Iterator it = m_AllFirmwareParams.begin(); it != m_AllFirmwareParams.end(); ++it)
 	{
-		XnFirmwareParam& param = it->Value();
+		XnFirmwareParam& param = it.Value();
 		nRetVal = UpdateProperty(&param);
 		XN_IS_STATUS_OK(nRetVal);
 	}
@@ -315,7 +313,7 @@ XnStatus XnSensorFirmwareParams::CommitTransaction()
 	// we are no longer in transaction, even if we fail to commit.
 	m_bInTransaction = FALSE;
 
-	for (XnActualIntPropertyList::Iterator it = m_TransactionOrder.Begin(); it != m_TransactionOrder.End(); ++it)
+	for (XnActualIntPropertyList::Iterator it = m_TransactionOrder.begin(); it != m_TransactionOrder.end(); ++it)
 	{
 		XnActualIntProperty* pProp = *it;
 
@@ -360,7 +358,7 @@ XnStatus XnSensorFirmwareParams::CommitTransactionAsBatch()
 
 		XnUInt32 nCount = 0;
 
-		for (XnActualIntPropertyList::Iterator it = m_TransactionOrder.Begin(); it != m_TransactionOrder.End(); ++it)
+		for (XnActualIntPropertyList::Iterator it = m_TransactionOrder.begin(); it != m_TransactionOrder.end(); ++it)
 		{
 			XnActualIntProperty* pProp = *it;
 
@@ -399,7 +397,7 @@ XnStatus XnSensorFirmwareParams::CommitTransactionAsBatch()
 		XN_IS_STATUS_OK(nRetVal);
 
 		// and update their props
-		for (XnActualIntPropertyList::Iterator it = m_TransactionOrder.Begin(); it != m_TransactionOrder.End(); ++it)
+		for (XnActualIntPropertyList::Iterator it = m_TransactionOrder.begin(); it != m_TransactionOrder.end(); ++it)
 		{
 			XnActualIntProperty* pProp = *it;
 
@@ -500,16 +498,48 @@ XnStatus XnSensorFirmwareParams::SetFirmwareAudioParam(XnActualIntProperty* pPro
 	return (XN_STATUS_OK);
 }
 
-XnStatus XnSensorFirmwareParams::SetImageFormat(XnUInt64 nValue)
+XnStatus XnSensorFirmwareParams::SetImageResolution(XnUInt64 nValue)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 
-/*	
+	if (m_pInfo->nFWVer < XN_SENSOR_FW_VER_5_4)
+	{
+		switch (nValue)
+		{
+		case XN_RESOLUTION_QVGA:
+		case XN_RESOLUTION_VGA:
+			break;
+		case XN_RESOLUTION_SXGA:
+			if (m_pInfo->nFWVer < XN_SENSOR_FW_VER_5_3)
+			{
+				XN_LOG_WARNING_RETURN(XN_STATUS_IO_INVALID_STREAM_IMAGE_RESOLUTION, XN_MASK_DEVICE_SENSOR, "Image resolution is not supported by this firmware!");
+			}
+			break;
+		case XN_RESOLUTION_UXGA:
+			if (m_pInfo->nFWVer < XN_SENSOR_FW_VER_5_1)
+			{
+				XN_LOG_WARNING_RETURN(XN_STATUS_IO_INVALID_STREAM_IMAGE_RESOLUTION, XN_MASK_DEVICE_SENSOR, "Image resolution is not supported by this firmware!");
+			}
+			break;
+		default:
+			XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "Unsupported image resolution: %d", nValue);
+		}
+	}
+
+	nRetVal = SetFirmwareParam(&m_ImageResolution, nValue);
+	XN_IS_STATUS_OK(nRetVal);
+	
+	return (XN_STATUS_OK);
+}
+
+XnStatus XnSensorFirmwareParams::SetImageFormat(XnUInt64 nValue)
+{
+	XnStatus nRetVal = XN_STATUS_OK;
+	
 	if (nValue == XN_IO_IMAGE_FORMAT_UNCOMPRESSED_BAYER)
 	{
 		nValue = XN_IO_IMAGE_FORMAT_BAYER;
 	}
-*/
 
 	nRetVal = SetFirmwareParam(&m_ImageFormat, nValue);
 	XN_IS_STATUS_OK(nRetVal);
@@ -622,6 +652,12 @@ XnStatus XN_CALLBACK_TYPE XnSensorFirmwareParams::SetFirmwareAudioParamCallback(
 	return pThis->SetFirmwareAudioParam(pSender, nValue);
 }
 
+XnStatus XN_CALLBACK_TYPE XnSensorFirmwareParams::SetImageResolutionCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
+{
+	XnSensorFirmwareParams* pThis = (XnSensorFirmwareParams*)pCookie;
+	return pThis->SetImageResolution(nValue);
+}
+
 XnStatus XN_CALLBACK_TYPE XnSensorFirmwareParams::SetImageFormatCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
 {
 	XnSensorFirmwareParams* pThis = (XnSensorFirmwareParams*)pCookie;
diff --git a/Source/XnDeviceSensorV2/XnSensorFirmwareParams.h b/Source/XnDeviceSensorV2/XnSensorFirmwareParams.h
index c3642e8..b3d58ca 100644
--- a/Source/XnDeviceSensorV2/XnSensorFirmwareParams.h
+++ b/Source/XnDeviceSensorV2/XnSensorFirmwareParams.h
@@ -27,10 +27,9 @@
 //---------------------------------------------------------------------------
 #include <XnDDK/XnActualIntProperty.h>
 #include "XnParams.h"
-#include <XnHashT.h>
+#include <XnHash.h>
 #include "XnFirmwareInfo.h"
 #include "XnFirmwareCommands.h"
-#include <XnListT.h>
 
 //---------------------------------------------------------------------------
 // Types
@@ -108,7 +107,6 @@ public:
 	XnActualIntProperty m_ImageExposureBar;
 	XnActualIntProperty m_ImageLowLightCompensation;
 	XnActualIntProperty m_ImageGain;
-	XnActualIntProperty m_DepthCloseRange;
 
 private:
 	typedef struct XnFirmwareParam
@@ -120,9 +118,9 @@ private:
 		XnUInt16 nValueIfNotSupported;
 	} XnFirmwareParam;
 
-	typedef XnHashT<XnActualIntProperty*, XnFirmwareParam> XnFirmwareParamsHash;
-	typedef XnListT<XnActualIntProperty*> XnActualIntPropertyList;
-	typedef XnHashT<XnActualIntProperty*, XnUInt32> XnPropertyToValueHash;
+	XN_DECLARE_DEFAULT_HASH(XnActualIntProperty*, XnFirmwareParam, XnFirmwareParamsHash)
+	XN_DECLARE_LIST(XnActualIntProperty*, XnActualIntPropertyList)
+	XN_DECLARE_DEFAULT_HASH(XnActualIntProperty*, XnUInt32, XnPropertyToValueHash)
 
 	XnStatus AddFirmwareParam(XnActualIntProperty& Property, XnUInt16 nFirmwareParam, XnFWVer nMinVer = XN_SENSOR_FW_VER_UNKNOWN, XnFWVer nMaxVer = XN_SENSOR_FW_VER_UNKNOWN, XnUInt16 nValueIfNotSupported = 0);
 	XnStatus AddFirmwareAudioParam(XnActualIntProperty& Property, XnUInt16 nFirmwareParam, XnFWVer nMinVer = XN_SENSOR_FW_VER_3_0, XnFWVer nMaxVer = XN_SENSOR_FW_VER_UNKNOWN, XnUInt16 nValueIfNotSupported = 0);
@@ -131,6 +129,7 @@ private:
 
 	XnStatus SetFirmwareParam(XnActualIntProperty* pProperty, XnUInt64 nValue);
 	XnStatus SetFirmwareAudioParam(XnActualIntProperty* pProperty, XnUInt64 nValue);
+	XnStatus SetImageResolution(XnUInt64 nValue);
 	XnStatus SetImageFormat(XnUInt64 nValue);
 	XnStatus SetStreamMode(XnActualIntProperty* pProperty, XnUInt64 nValue);
 	XnStatus RecalculateReferenceResolution();
@@ -141,6 +140,7 @@ private:
 
 	static XnStatus XN_CALLBACK_TYPE SetFirmwareParamCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie);
 	static XnStatus XN_CALLBACK_TYPE SetFirmwareAudioParamCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie);
+	static XnStatus XN_CALLBACK_TYPE SetImageResolutionCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie);
 	static XnStatus XN_CALLBACK_TYPE SetImageFormatCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie);
 	static XnStatus XN_CALLBACK_TYPE SetStreamModeCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie);
 	static XnStatus XN_CALLBACK_TYPE ReferenceResolutionPropertyValueChanged(const XnProperty* pSender, void* pCookie);
diff --git a/Source/XnDeviceSensorV2/XnSensorFixedParams.cpp b/Source/XnDeviceSensorV2/XnSensorFixedParams.cpp
index e6c1d97..d8e48de 100644
--- a/Source/XnDeviceSensorV2/XnSensorFixedParams.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorFixedParams.cpp
@@ -28,22 +28,10 @@
 //---------------------------------------------------------------------------
 // Code
 //---------------------------------------------------------------------------
-XnSensorFixedParams::XnSensorFixedParams(XnDevicePrivateData* pDevicePrivateData) :
-	m_pDevicePrivateData(pDevicePrivateData),
-	m_nSensorDepthCMOSI2CBus(0),
-	m_nSensorDepthCMOSI2CSlaveAddress(0),
-	m_nSensorImageCMOSI2CBus(0),
-	m_nSensorImageCMOSI2CSlaveAddress(0),
-	m_nZeroPlaneDistance(0),
-	m_dZeroPlanePixelSize(0),
-	m_dEmitterDCmosDistance(0),
-	m_dDCmosRCmosDistance(0),
-	m_nImageCmosType(0)
+XnSensorFixedParams::XnSensorFixedParams(XnSensorFirmware* pFirmware, XnDevicePrivateData* pDevicePrivateData) :
+	m_pFirmware(pFirmware),
+	m_pDevicePrivateData(pDevicePrivateData)
 {
-	m_strSensorSerial[0] = '\0';
-	m_deviceInfo.strDeviceName[0] = '\0';
-	m_deviceInfo.strVendorData[0] = '\0';
-	m_strPlatformString[0] = '\0';
 }
 
 XnStatus XnSensorFixedParams::Init()
@@ -78,20 +66,8 @@ XnStatus XnSensorFixedParams::Init()
 	m_dZeroPlanePixelSize = FixedParams.fReferencePixelSize;
 	m_dEmitterDCmosDistance = FixedParams.fDCmosEmitterDistance;
 	m_dDCmosRCmosDistance = FixedParams.fDCmosRCmosDistance;
-
-	m_nSensorDepthCMOSI2CBus = (XnUInt16)FixedParams.nDepthCmosI2CBus;
-	m_nSensorDepthCMOSI2CSlaveAddress = (XnUInt16)FixedParams.nDepthCmosI2CAddress;
-	m_nSensorImageCMOSI2CBus = (XnUInt16)FixedParams.nImageCmosI2CBus;
-	m_nSensorImageCMOSI2CSlaveAddress = (XnUInt16)FixedParams.nImageCmosI2CAddress;
 	
-	m_nImageCmosType = (XnUInt32)FixedParams.nImageCmosType;
-
-	nRetVal = XnHostProtocolAlgorithmParams(m_pDevicePrivateData, XN_HOST_PROTOCOL_ALGORITHM_DEVICE_INFO, 
-		&m_deviceInfo, sizeof(m_deviceInfo), (XnResolutions)0, 0);
-	XN_IS_STATUS_OK(nRetVal);
 
-	nRetVal = XnHostProtocolGetPlatformString(m_pDevicePrivateData, m_strPlatformString);
-	XN_IS_STATUS_OK(nRetVal);
 
 	return (XN_STATUS_OK);
 }
\ No newline at end of file
diff --git a/Source/XnDeviceSensorV2/XnSensorFixedParams.h b/Source/XnDeviceSensorV2/XnSensorFixedParams.h
index 692bbab..faa4dad 100644
--- a/Source/XnDeviceSensorV2/XnSensorFixedParams.h
+++ b/Source/XnDeviceSensorV2/XnSensorFixedParams.h
@@ -25,15 +25,7 @@
 //---------------------------------------------------------------------------
 // Includes
 //---------------------------------------------------------------------------
-#include <XnStreamParams.h>
-#include "XnDeviceSensor.h"
-
-//---------------------------------------------------------------------------
-// Forward Declarations
-//---------------------------------------------------------------------------
-class XnSensorFirmware;
-struct XnDevicePrivateData;
-typedef struct XnDevicePrivateData XnDevicePrivateData;
+#include "XnSensorFirmware.h"
 
 //---------------------------------------------------------------------------
 // XnSensorFixedParams class
@@ -41,14 +33,10 @@ typedef struct XnDevicePrivateData XnDevicePrivateData;
 class XnSensorFixedParams
 {
 public:
-	XnSensorFixedParams(XnDevicePrivateData* pDevicePrivateData);
+	XnSensorFixedParams(XnSensorFirmware* pFirmware, XnDevicePrivateData* pDevicePrivateData);
 
 	XnStatus Init();
 
-	inline XnUInt16 GetDepthCmosI2CBus() const { return m_nSensorDepthCMOSI2CBus; }
-	inline XnUInt16 GetDepthCmosI2CSlaveAddress() const { return m_nSensorDepthCMOSI2CSlaveAddress; }
-	inline XnUInt16 GetImageCmosI2CBus() const { return m_nSensorImageCMOSI2CBus; }
-	inline XnUInt16 GetImageCmosI2CSlaveAddress() const { return m_nSensorImageCMOSI2CSlaveAddress; }
 
 	inline XnDepthPixel GetZeroPlaneDistance() const { return m_nZeroPlaneDistance; }
 	inline XnDouble GetZeroPlanePixelSize() const { return m_dZeroPlanePixelSize; }
@@ -57,30 +45,17 @@ public:
 
 	inline const XnChar* GetSensorSerial() const { return m_strSensorSerial; }
 
-	inline XnUInt32 GetImageCmosType() const { return m_nImageCmosType; }
-
-	inline const XnChar* GetDeviceName() const { return m_deviceInfo.strDeviceName; }
-	inline const XnChar* GetVendorData() const { return m_deviceInfo.strVendorData; }
-	inline const XnChar* GetPlatformString() const { return m_strPlatformString; }
-
 private:
+	XnSensorFirmware* m_pFirmware;
 	XnDevicePrivateData* m_pDevicePrivateData;
 
-	XnUInt16 m_nSensorDepthCMOSI2CBus;
-	XnUInt16 m_nSensorDepthCMOSI2CSlaveAddress;
-	XnUInt16 m_nSensorImageCMOSI2CBus;
-	XnUInt16 m_nSensorImageCMOSI2CSlaveAddress;
 
 	XnDepthPixel m_nZeroPlaneDistance;
 	XnDouble m_dZeroPlanePixelSize;
 	XnDouble m_dEmitterDCmosDistance;
 	XnDouble m_dDCmosRCmosDistance;
 
-	XnUInt32 m_nImageCmosType;
-
 	XnChar m_strSensorSerial[XN_DEVICE_MAX_STRING_LENGTH];
-	XnDeviceInformation m_deviceInfo;
-	XnChar m_strPlatformString[XN_DEVICE_MAX_STRING_LENGTH];
 };
 
 #endif //__XN_SENSOR_FIXED_PARAMS_H__
\ No newline at end of file
diff --git a/Source/XnDeviceSensorV2/XnSensorGenerator.cpp b/Source/XnDeviceSensorV2/XnSensorGenerator.cpp
index 0d31bf9..86e8f8f 100644
--- a/Source/XnDeviceSensorV2/XnSensorGenerator.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorGenerator.cpp
@@ -101,7 +101,7 @@ XnStatus XnSensorGenerator::RegisterToNewDataAvailable(XnModuleStateChangedHandl
 	NewDataCallback* pNewDataCallback;
 	XN_VALIDATE_NEW(pNewDataCallback, NewDataCallback, this, handler, pCookie);
 	hCallback = pNewDataCallback;
-	nRetVal = m_pSensor->RegisterToNewStreamData(&OnDeviceNewStreamData, pNewDataCallback, pNewDataCallback->m_hCallback);
+	nRetVal = m_pSensor->RegisterToNewStreamData(&OnDeviceNewStreamData, pNewDataCallback, &(pNewDataCallback->m_hCallback));
 	if (nRetVal != XN_STATUS_OK)
 	{
 		XN_DELETE(pNewDataCallback);
@@ -187,10 +187,10 @@ void XnSensorGenerator::FilterProperties(XnActualPropertiesHash* pHash)
 	pHash->Remove(XN_STREAM_PROPERTY_STATE);
 }
 
-void XN_CALLBACK_TYPE XnSensorGenerator::OnDeviceNewStreamData(const XnNewStreamDataEventArgs& args, void* pCookie)
+void XN_CALLBACK_TYPE XnSensorGenerator::OnDeviceNewStreamData(XnDeviceHandle /*pDeviceHandle*/, const XnChar* StreamName, void* pCookie)
 {
 	NewDataCallback *pNewDataCBParams = (NewDataCallback*)pCookie;
-	if (strcmp(pNewDataCBParams->m_pGenerator->m_strInstanceName, args.strStreamName) == 0)
+	if (strcmp(pNewDataCBParams->m_pGenerator->m_strInstanceName, StreamName) == 0)
 	{
 		pNewDataCBParams->m_handler(pNewDataCBParams->m_pCookie);
 	}
diff --git a/Source/XnDeviceSensorV2/XnSensorGenerator.h b/Source/XnDeviceSensorV2/XnSensorGenerator.h
index 882f714..97cbc5a 100644
--- a/Source/XnDeviceSensorV2/XnSensorGenerator.h
+++ b/Source/XnDeviceSensorV2/XnSensorGenerator.h
@@ -86,7 +86,7 @@ private:
 		XnCallbackHandle m_hCallback;
 	};
 
-	static void XN_CALLBACK_TYPE OnDeviceNewStreamData(const XnNewStreamDataEventArgs& args, void* pCookie);
+	static void XN_CALLBACK_TYPE OnDeviceNewStreamData(XnDeviceHandle pDeviceHandle, const XnChar* StreamName, void* pCookie);
 };
 
 #pragma warning (pop)
diff --git a/Source/XnDeviceSensorV2/XnSensorIRStream.cpp b/Source/XnDeviceSensorV2/XnSensorIRStream.cpp
index f30ee1b..ebf162a 100644
--- a/Source/XnDeviceSensorV2/XnSensorIRStream.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorIRStream.cpp
@@ -36,10 +36,12 @@
 //---------------------------------------------------------------------------
 // XnSensorIRStream class
 //---------------------------------------------------------------------------
-XnSensorIRStream::XnSensorIRStream(const XnChar* StreamName, XnSensorObjects* pObjects) : 
+XnSensorIRStream::XnSensorIRStream(const XnChar* strDeviceName, const XnChar* StreamName, XnSensorObjects* pObjects, XnUInt32 nBufferCount, XnBool bAllowOtherUsers) : 
 	XnIRStream(StreamName, FALSE),
 	m_Helper(pObjects),
 	m_InputFormat(XN_STREAM_PROPERTY_INPUT_FORMAT, 0),
+	m_BufferPool(nBufferCount, strDeviceName, StreamName, XN_IR_MAX_BUFFER_SIZE, bAllowOtherUsers),
+	m_SharedBufferName(XN_STREAM_PROPERTY_SHARED_BUFFER_NAME, m_BufferPool.GetSharedMemoryName()),
 	m_FirmwareCropSizeX("FirmwareCropSizeX", 0, StreamName),
 	m_FirmwareCropSizeY("FirmwareCropSizeY", 0, StreamName),
 	m_FirmwareCropOffsetX("FirmwareCropOffsetX", 0, StreamName),
@@ -54,15 +56,15 @@ XnStatus XnSensorIRStream::Init()
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 
-// 	nRetVal = SetBufferPool(&m_BufferPool);
-// 	XN_IS_STATUS_OK(nRetVal);
+	nRetVal = SetBufferPool(&m_BufferPool);
+	XN_IS_STATUS_OK(nRetVal);
 
 	// init base
 	nRetVal = XnIRStream::Init();
 	XN_IS_STATUS_OK(nRetVal);
 
 	// add properties
-	XN_VALIDATE_ADD_PROPERTIES(this, &m_InputFormat, &m_ActualRead);
+	XN_VALIDATE_ADD_PROPERTIES(this, &m_InputFormat, &m_SharedBufferName, &m_ActualRead);
 
 	// set base properties default values
 	nRetVal = ResolutionProperty().UnsafeUpdateValue(XN_IR_STREAM_DEFAULT_RESOLUTION);
@@ -79,18 +81,44 @@ XnStatus XnSensorIRStream::Init()
 	XN_IS_STATUS_OK(nRetVal);
 
 	// register supported modes
-	XnCmosPreset* pSupportedModes = m_Helper.GetPrivateData()->FWInfo.irModes.GetData();
-	XnUInt8 nSupportedModes = m_Helper.GetPrivateData()->FWInfo.irModes.GetSize();
-	nRetVal = AddSupportedModes(pSupportedModes, nSupportedModes);
+	XnCmosPreset aSupportedModes[] = 
+	{
+		{ 0, XN_RESOLUTION_QVGA, 30 },
+		{ 0, XN_RESOLUTION_QVGA, 60 },
+		{ 0, XN_RESOLUTION_VGA, 30 },
+		{ 0, XN_RESOLUTION_SXGA, 30 },
+	};
+	nRetVal = AddSupportedModes(aSupportedModes, sizeof(aSupportedModes)/sizeof(aSupportedModes[0]));
 	XN_IS_STATUS_OK(nRetVal);
 
+	if (m_Helper.GetFirmwareVersion() >= XN_SENSOR_FW_VER_5_1)
+	{
+		XnCmosPreset aSupportedModesSXGA[] = 
+		{
+			{ 0, XN_RESOLUTION_SXGA, 30 },
+		};
+		nRetVal = AddSupportedModes(aSupportedModesSXGA, sizeof(aSupportedModesSXGA)/sizeof(aSupportedModesSXGA[0]));
+		XN_IS_STATUS_OK(nRetVal);
+	}
+
+	if (m_Helper.GetFirmwareVersion() >= XN_SENSOR_FW_VER_5_2)
+	{
+		XnCmosPreset aSupportedModes25[] = 
+		{
+			{ 0, XN_RESOLUTION_QVGA, 25 },
+			{ 0, XN_RESOLUTION_VGA, 25 },
+		};
+		nRetVal = AddSupportedModes(aSupportedModes25, sizeof(aSupportedModes25)/sizeof(aSupportedModes25[0]));
+		XN_IS_STATUS_OK(nRetVal);
+	}
+
 	// data processor
 	nRetVal = m_Helper.RegisterDataProcessorProperty(ResolutionProperty());
 	XN_IS_STATUS_OK(nRetVal);
 
 	// register for mirror
 	XnCallbackHandle hCallbackDummy;
-	nRetVal = IsMirroredProperty().OnChangeEvent().Register(IsMirroredChangedCallback, this, hCallbackDummy);
+	nRetVal = IsMirroredProperty().OnChangeEvent().Register(IsMirroredChangedCallback, this, &hCallbackDummy);
 	XN_IS_STATUS_OK(nRetVal);
 
 	return (XN_STATUS_OK);
@@ -418,14 +446,8 @@ XnStatus XnSensorIRStream::CropImpl(XnStreamData* pStreamOutput, const XnCroppin
 
 XnStatus XnSensorIRStream::CreateDataProcessor(XnDataProcessor** ppProcessor)
 {
-	XnStatus nRetVal = XN_STATUS_OK;
-
-	XnFrameBufferManager* pBufferManager;
-	nRetVal = GetTripleBuffer(&pBufferManager);
-	XN_IS_STATUS_OK(nRetVal);
-
 	XnDataProcessor* pNew;
-	XN_VALIDATE_NEW_AND_INIT(pNew, XnIRProcessor, this, &m_Helper, pBufferManager);
+	XN_VALIDATE_NEW_AND_INIT(pNew, XnIRProcessor, this, &m_Helper);
 
 	*ppProcessor = pNew;
 
diff --git a/Source/XnDeviceSensorV2/XnSensorIRStream.h b/Source/XnDeviceSensorV2/XnSensorIRStream.h
index 61b92c9..f7ad01f 100644
--- a/Source/XnDeviceSensorV2/XnSensorIRStream.h
+++ b/Source/XnDeviceSensorV2/XnSensorIRStream.h
@@ -27,6 +27,7 @@
 //---------------------------------------------------------------------------
 #include <XnDDK/XnIRStream.h>
 #include "XnSensorStreamHelper.h"
+#include "XnSharedMemoryBufferPool.h"
 
 //---------------------------------------------------------------------------
 // Defines
@@ -42,7 +43,7 @@
 class XnSensorIRStream : public XnIRStream, public IXnSensorStream
 {
 public:
-	XnSensorIRStream(const XnChar* StreamName, XnSensorObjects* pObjects);
+	XnSensorIRStream(const XnChar* strDeviceName, const XnChar* StreamName, XnSensorObjects* pObjects, XnUInt32 nBufferCount, XnBool bAllowOtherUsers);
 	~XnSensorIRStream() { Free(); }
 
 	//---------------------------------------------------------------------------
@@ -74,6 +75,7 @@ protected:
 	XnStatus MapPropertiesToFirmware();
 	void GetFirmwareStreamConfig(XnResolutions* pnRes, XnUInt32* pnFPS) { *pnRes = GetResolution(); *pnFPS = GetFPS(); }
 	XnStatus WriteImpl(XnStreamData* /*pStreamData*/) { return XN_STATUS_DEVICE_UNSUPPORTED_MODE; }
+	XnSharedMemoryBufferPool* GetSharedMemoryBuffer() { return &m_BufferPool; }
 
 	//---------------------------------------------------------------------------
 	// Setters
@@ -94,6 +96,9 @@ private:
 	XnActualIntProperty m_InputFormat;
 
 	XnSensorStreamHelper m_Helper;
+	XnSharedMemoryBufferPool m_BufferPool;
+
+	XnActualStringProperty m_SharedBufferName;
 	XnActualIntProperty m_FirmwareCropSizeX;
 	XnActualIntProperty m_FirmwareCropSizeY;
 	XnActualIntProperty m_FirmwareCropOffsetX;
diff --git a/Source/XnDeviceSensorV2/XnSensorImageGenerator.cpp b/Source/XnDeviceSensorV2/XnSensorImageGenerator.cpp
index 42a93ba..b961e91 100644
--- a/Source/XnDeviceSensorV2/XnSensorImageGenerator.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorImageGenerator.cpp
@@ -441,33 +441,28 @@ XnStatus XnExportedSensorImageGenerator::IsSupportedForDevice(xn::Context& conte
 	nRetVal = sensorInfo.GetInstance(sensor);
 	XN_IS_STATUS_OK(nRetVal);
 
-	XnUInt64 nImageSupported = FALSE;
+	XnBool bShouldBeCreated = (!sensor.IsValid());
 
-	if (sensor.IsValid())
+	if (bShouldBeCreated)
 	{
-		nRetVal = sensor.GetIntProperty(XN_MODULE_PROPERTY_IMAGE_SUPPORTED, nImageSupported);
+		nRetVal = context.CreateProductionTree(sensorInfo, sensor);
 		XN_IS_STATUS_OK(nRetVal);
 	}
-	else
-	{
-		// Don't create sensor through OpenNI. This will cause it to soft-reset.
-		// instead, "talk" directly to the sensor class
-		XnSensor lowLevelSensor(FALSE);
-		XnDeviceConfig config;
-		config.DeviceMode = XN_DEVICE_MODE_READ;
-		config.cpConnectionString = sensorInfo.GetCreationInfo();
-		config.SharingMode = XN_DEVICE_EXCLUSIVE;
-		config.pInitialValues = NULL;
-		nRetVal = lowLevelSensor.Init(&config);
-		XN_IS_STATUS_OK(nRetVal);
 
-		nRetVal = lowLevelSensor.GetProperty(XN_MODULE_NAME_DEVICE, XN_MODULE_PROPERTY_IMAGE_SUPPORTED, &nImageSupported);
-		XN_IS_STATUS_OK(nRetVal);
+	// This is an ugly patch to find out if this sensor has an image CMOS. It will be fixed
+	// in future firmwares so we can just ask.
+	XnCmosBlankingUnits units;
+	units.nCmosID = XN_CMOS_TYPE_IMAGE;
+	nRetVal = sensor.GetGeneralProperty(XN_MODULE_PROPERTY_CMOS_BLANKING_UNITS, sizeof(units), &units);
+	if (nRetVal != XN_STATUS_OK || units.nUnits == 0)
+	{
+		// Failed. this means no image CMOS
+		*pbSupported = FALSE;
 	}
 
-	if (nImageSupported != TRUE)
+	if (bShouldBeCreated)
 	{
-		*pbSupported = FALSE;
+		sensor.Release();
 	}
 
 	return (XN_STATUS_OK);
diff --git a/Source/XnDeviceSensorV2/XnSensorImageStream.cpp b/Source/XnDeviceSensorV2/XnSensorImageStream.cpp
index defb72a..be42cc7 100644
--- a/Source/XnDeviceSensorV2/XnSensorImageStream.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorImageStream.cpp
@@ -39,9 +39,11 @@
 //---------------------------------------------------------------------------
 // XnSensorImageStream class
 //---------------------------------------------------------------------------
-XnSensorImageStream::XnSensorImageStream(const XnChar* StreamName, XnSensorObjects* pObjects) : 
+XnSensorImageStream::XnSensorImageStream(const XnChar* strDeviceName, const XnChar* StreamName, XnSensorObjects* pObjects, XnUInt32 nBufferCount, XnBool bAllowOtherUsers) : 
 	XnImageStream(StreamName, FALSE),
 	m_Helper(pObjects),
+	m_BufferPool(nBufferCount, strDeviceName, StreamName, GetMaxBufferSize(m_Helper.GetFirmwareVersion()), bAllowOtherUsers),
+	m_SharedBufferName(XN_STREAM_PROPERTY_SHARED_BUFFER_NAME, m_BufferPool.GetSharedMemoryName()),
 	m_InputFormat(XN_STREAM_PROPERTY_INPUT_FORMAT, XN_IMAGE_STREAM_DEFAULT_INPUT_FORMAT),
 	m_AntiFlicker(XN_STREAM_PROPERTY_FLICKER, XN_IMAGE_STREAM_DEFAULT_FLICKER),
 	m_ImageQuality(XN_STREAM_PROPERTY_QUALITY, XN_IMAGE_STREAM_DEFAULT_QUALITY),
@@ -82,8 +84,8 @@ XnStatus XnSensorImageStream::Init()
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 
-// 	nRetVal = SetBufferPool(&m_BufferPool);
-// 	XN_IS_STATUS_OK(nRetVal);
+	nRetVal = SetBufferPool(&m_BufferPool);
+	XN_IS_STATUS_OK(nRetVal);
 
 	// init base
 	nRetVal = XnImageStream::Init();
@@ -109,7 +111,8 @@ XnStatus XnSensorImageStream::Init()
 	XN_VALIDATE_ADD_PROPERTIES(this, &m_InputFormat, &m_AntiFlicker, &m_ImageQuality, 
 		&m_Brightness, &m_Contrast, &m_Saturation, &m_Sharpness,  
 		&m_ColorTemperature, &m_BackLightCompensation, &m_Gain, &m_Zoom, 
-		&m_Exposure, &m_Pan, &m_Tilt, &m_LowLightCompensation, &m_ActualRead);
+		&m_Exposure, &m_Pan, &m_Tilt, &m_LowLightCompensation,
+		&m_SharedBufferName, &m_ActualRead);
 
 	// set base properties default values
 	nRetVal = ResolutionProperty().UnsafeUpdateValue(XN_IMAGE_STREAM_DEFAULT_RESOLUTION);
@@ -136,7 +139,7 @@ XnStatus XnSensorImageStream::Init()
 	XN_IS_STATUS_OK(nRetVal);
 
 	// register supported modes
-	if (m_Helper.GetFirmware()->GetInfo()->bGetPresetsSupported)
+	if (m_Helper.GetFirmwareVersion() >= XN_SENSOR_FW_VER_5_4)
 	{
 		// ask the firmware
 		const XnUInt32 nAllocSize = 100;
@@ -151,74 +154,132 @@ XnStatus XnSensorImageStream::Init()
 			return XN_STATUS_DEVICE_UNSUPPORTED_PARAMETER;
 		}
 
-		nRetVal = AddSupportedModes(aSupportedModes, nCount);
-		XN_IS_STATUS_OK(nRetVal);
-	}
-	else
-	{
-		// Firmware doesn't support getting presets. Instead, we'll need to register presets
-		// we know according to firmware version
-		XnCmosPreset* pSupportedModes; 
-		XnUInt8 nSupportedModes;
-		XnUInt64 nDefaultInputFormat;
+		// check if our current (default) configuration is valid
+		XnUInt16 nValidInputFormat = XN_IMAGE_STREAM_DEFAULT_INPUT_FORMAT;
+		XnBool bModeFound = FALSE;
 
-		if (m_Helper.GetPrivateData()->pSpecificImageUsb->pUsbConnection->bIsISO)
+		for (XnUInt32 i = 0; i < nCount; ++i)
 		{
-			pSupportedModes = m_Helper.GetPrivateData()->FWInfo.imageIsoModes.GetData();
-			nSupportedModes = m_Helper.GetPrivateData()->FWInfo.imageIsoModes.GetSize();
+			if (aSupportedModes[i].nResolution == XN_IMAGE_STREAM_DEFAULT_RESOLUTION &&
+				aSupportedModes[i].nFPS == XN_IMAGE_STREAM_DEFAULT_FPS)
+			{
+				// found
+				if (!bModeFound)
+				{
+					bModeFound = TRUE;
+					nValidInputFormat = aSupportedModes[i].nFormat;
+				}
+
+				if (aSupportedModes[i].nFormat == XN_IMAGE_STREAM_DEFAULT_INPUT_FORMAT)
+				{
+					nValidInputFormat = XN_IMAGE_STREAM_DEFAULT_INPUT_FORMAT;
+					break;					
+				}
+			}
+		}
+
+		if (!bModeFound)
+		{
+			xnLogWarning(XN_MASK_DEVICE_SENSOR, "Default mode (res + FPS) is not supported by device. Changing defaults...");
+
+			nRetVal = ResolutionProperty().UnsafeUpdateValue(aSupportedModes[0].nResolution);
+			XN_IS_STATUS_OK(nRetVal);
+			nRetVal = FPSProperty().UnsafeUpdateValue(aSupportedModes[0].nFPS);
+			XN_IS_STATUS_OK(nRetVal);
+			nRetVal = m_InputFormat.UnsafeUpdateValue(aSupportedModes[0].nFormat);
+			XN_IS_STATUS_OK(nRetVal);
 		}
 		else
 		{
-			pSupportedModes = m_Helper.GetPrivateData()->FWInfo.imageBulkModes.GetData();
-			nSupportedModes = m_Helper.GetPrivateData()->FWInfo.imageBulkModes.GetSize();
+			// just update input format
+			nRetVal = m_InputFormat.UnsafeUpdateValue(nValidInputFormat);
+			XN_IS_STATUS_OK(nRetVal);
 		}
 
-		nRetVal = AddSupportedModes(pSupportedModes, nSupportedModes);
+		nRetVal = AddSupportedModes(aSupportedModes, nCount);
 		XN_IS_STATUS_OK(nRetVal);
 	}
+	else
+	{
+		XnArray<XnCmosPreset> supportedModes(30);
 
-	// check if our current (default) configuration is valid
-	XnUInt16 nValidInputFormat = XN_IMAGE_STREAM_DEFAULT_INPUT_FORMAT;
-	XnBool bModeFound = FALSE;
+		// Uncompressed modes are only supported in ISO (not BULK)
+		XnBool bUncompressedAllowed = m_Helper.GetPrivateData()->pSpecificImageUsb->pUsbConnection->bIsISO;
 
-	const XnArray<XnCmosPreset>& aSupportedModes = GetSupportedModes();
+		// start with common modes supported by all
+		nRetVal = AddSupportedMode(supportedModes, XN_IO_IMAGE_FORMAT_YUV422, XN_RESOLUTION_QVGA, 30);
+		XN_IS_STATUS_OK(nRetVal);
+		nRetVal = AddSupportedMode(supportedModes, XN_IO_IMAGE_FORMAT_YUV422, XN_RESOLUTION_QVGA, 60);
+		XN_IS_STATUS_OK(nRetVal);
+		nRetVal = AddSupportedMode(supportedModes, XN_IO_IMAGE_FORMAT_YUV422, XN_RESOLUTION_VGA, 30);
+		XN_IS_STATUS_OK(nRetVal);
 
-	for (XnUInt32 i = 0; i < aSupportedModes.GetSize(); ++i)
-	{
-		if (aSupportedModes[i].nResolution == XN_IMAGE_STREAM_DEFAULT_RESOLUTION &&
-			aSupportedModes[i].nFPS == XN_IMAGE_STREAM_DEFAULT_FPS)
+		// add uncompressed ones
+		if (bUncompressedAllowed)
 		{
-			// found
-			if (!bModeFound)
+			nRetVal = AddSupportedMode(supportedModes, XN_IO_IMAGE_FORMAT_UNCOMPRESSED_YUV422, XN_RESOLUTION_QVGA, 30);
+			XN_IS_STATUS_OK(nRetVal);
+			nRetVal = AddSupportedMode(supportedModes, XN_IO_IMAGE_FORMAT_UNCOMPRESSED_YUV422, XN_RESOLUTION_QVGA, 60);
+			XN_IS_STATUS_OK(nRetVal);
+			nRetVal = AddSupportedMode(supportedModes, XN_IO_IMAGE_FORMAT_UNCOMPRESSED_YUV422, XN_RESOLUTION_VGA, 30);
+			XN_IS_STATUS_OK(nRetVal);
+		}
+
+		// starting with FW 5.2, 25 FPS is also supported
+		if (m_Helper.GetFirmwareVersion() >= XN_SENSOR_FW_VER_5_2)
+		{
+			nRetVal = AddSupportedMode(supportedModes, XN_IO_IMAGE_FORMAT_YUV422, XN_RESOLUTION_QVGA, 25);
+			XN_IS_STATUS_OK(nRetVal);
+			nRetVal = AddSupportedMode(supportedModes, XN_IO_IMAGE_FORMAT_YUV422, XN_RESOLUTION_VGA, 25);
+			XN_IS_STATUS_OK(nRetVal);
+
+			if (bUncompressedAllowed)
 			{
-				bModeFound = TRUE;
-				nValidInputFormat = aSupportedModes[i].nFormat;
+				nRetVal = AddSupportedMode(supportedModes, XN_IO_IMAGE_FORMAT_UNCOMPRESSED_YUV422, XN_RESOLUTION_QVGA, 25);
+				XN_IS_STATUS_OK(nRetVal);
+				nRetVal = AddSupportedMode(supportedModes, XN_IO_IMAGE_FORMAT_UNCOMPRESSED_YUV422, XN_RESOLUTION_VGA, 25);
+				XN_IS_STATUS_OK(nRetVal);
 			}
+		}
 
-			if (aSupportedModes[i].nFormat == XN_IMAGE_STREAM_DEFAULT_INPUT_FORMAT)
+		// high-res
+		if (m_Helper.GetFirmwareVersion() >= XN_SENSOR_FW_VER_5_3)
+		{
+			nRetVal = AddSupportedMode(supportedModes, XN_IO_IMAGE_FORMAT_BAYER, XN_RESOLUTION_SXGA, 30);
+			XN_IS_STATUS_OK(nRetVal);
+
+			// starting with 5.3.28, YUV is also supported in high-res
+			if (m_Helper.GetPrivateData()->Version.nMajor > 5 ||
+				(m_Helper.GetPrivateData()->Version.nMajor == 5 && m_Helper.GetPrivateData()->Version.nMinor > 3) ||
+				(m_Helper.GetPrivateData()->Version.nMajor == 5 && m_Helper.GetPrivateData()->Version.nMinor == 3 && m_Helper.GetPrivateData()->Version.nBuild >= 28))
 			{
-				nValidInputFormat = XN_IMAGE_STREAM_DEFAULT_INPUT_FORMAT;
-				break;					
+				nRetVal = AddSupportedMode(supportedModes, XN_IO_IMAGE_FORMAT_YUV422, XN_RESOLUTION_SXGA, 30);
+				XN_IS_STATUS_OK(nRetVal);
+
+				if (bUncompressedAllowed)
+				{
+					nRetVal = AddSupportedMode(supportedModes, XN_IO_IMAGE_FORMAT_UNCOMPRESSED_YUV422, XN_RESOLUTION_SXGA, 30);
+					XN_IS_STATUS_OK(nRetVal);
+				}
 			}
 		}
-	}
-
-	if (!bModeFound)
-	{
-		xnLogWarning(XN_MASK_DEVICE_SENSOR, "Default mode (res + FPS) is not supported by device. Changing defaults...");
+		else if (m_Helper.GetFirmwareVersion() >= XN_SENSOR_FW_VER_5_2)
+		{
+			// on 5.2, high-res was UXGA
+			nRetVal = AddSupportedMode(supportedModes, XN_IO_IMAGE_FORMAT_BAYER, XN_RESOLUTION_UXGA, 30);
+			XN_IS_STATUS_OK(nRetVal);
+		}
 
-		nRetVal = ResolutionProperty().UnsafeUpdateValue(aSupportedModes[0].nResolution);
-		XN_IS_STATUS_OK(nRetVal);
-		nRetVal = FPSProperty().UnsafeUpdateValue(aSupportedModes[0].nFPS);
-		XN_IS_STATUS_OK(nRetVal);
-		nRetVal = m_InputFormat.UnsafeUpdateValue(aSupportedModes[0].nFormat);
-		XN_IS_STATUS_OK(nRetVal);
-	}
-	else
-	{
-		// just update input format
-		nRetVal = m_InputFormat.UnsafeUpdateValue(nValidInputFormat);
+		// Add all supported modes to the stream
+		nRetVal = AddSupportedModes(supportedModes.GetData(), supportedModes.GetSize());
 		XN_IS_STATUS_OK(nRetVal);
+
+		if (!bUncompressedAllowed)
+		{
+			// update default input format
+			nRetVal = m_InputFormat.UnsafeUpdateValue(XN_IO_IMAGE_FORMAT_YUV422);
+			XN_IS_STATUS_OK(nRetVal);
+		}
 	}
 
 	return (XN_STATUS_OK);
@@ -231,6 +292,20 @@ XnStatus XnSensorImageStream::Free()
 	return (XN_STATUS_OK);
 }
 
+XnUInt32 XnSensorImageStream::GetMaxBufferSize(XnFWVer version)
+{
+	if (version >= XN_SENSOR_FW_VER_5_3)
+	{
+		// max resolution is only SXGA
+		return (XN_SXGA_X_RES * XN_SXGA_Y_RES * sizeof(XnRGB24Pixel));
+	}
+	else
+	{
+		// max resolution is UXGA
+		return (XN_UXGA_X_RES * XN_UXGA_Y_RES * sizeof(XnRGB24Pixel));
+	}
+}
+
 XnStatus XnSensorImageStream::MapPropertiesToFirmware()
 {
 	XnStatus nRetVal = XN_STATUS_OK;
@@ -293,8 +368,7 @@ XnStatus XnSensorImageStream::ValidateMode()
 	case XN_OUTPUT_FORMAT_RGB24:
 		if (nInputFormat != XN_IO_IMAGE_FORMAT_YUV422 &&
 			nInputFormat != XN_IO_IMAGE_FORMAT_UNCOMPRESSED_YUV422 &&
-			nInputFormat != XN_IO_IMAGE_FORMAT_BAYER &&
-			nInputFormat != XN_IO_IMAGE_FORMAT_UNCOMPRESSED_BAYER)
+			nInputFormat != XN_IO_IMAGE_FORMAT_BAYER)
 		{
 			XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "Input format %d cannot be converted to RGB24!", nInputFormat);
 		}
@@ -836,30 +910,24 @@ XnUInt32 XnSensorImageStream::CalculateExpectedSize()
 
 XnStatus XnSensorImageStream::CreateDataProcessor(XnDataProcessor** ppProcessor)
 {
-	XnStatus nRetVal = XN_STATUS_OK;
-
-	XnFrameBufferManager* pBufferManager;
-	nRetVal = GetTripleBuffer(&pBufferManager);
-	XN_IS_STATUS_OK(nRetVal);
-
 	XnStreamProcessor* pNew;
 
 	switch (m_InputFormat.GetValue())
 	{
 	case XN_IO_IMAGE_FORMAT_BAYER:
-		XN_VALIDATE_NEW_AND_INIT(pNew, XnBayerImageProcessor, this, &m_Helper, pBufferManager);
+		XN_VALIDATE_NEW_AND_INIT(pNew, XnBayerImageProcessor, this, &m_Helper);
 		break;
 	case XN_IO_IMAGE_FORMAT_YUV422:
-		XN_VALIDATE_NEW_AND_INIT(pNew, XnPSCompressedImageProcessor, this, &m_Helper, pBufferManager);
+		XN_VALIDATE_NEW_AND_INIT(pNew, XnPSCompressedImageProcessor, this, &m_Helper);
 		break;
 	case XN_IO_IMAGE_FORMAT_JPEG:
 		if (GetOutputFormat() == XN_OUTPUT_FORMAT_JPEG)
 		{
-			XN_VALIDATE_NEW_AND_INIT(pNew, XnJpegImageProcessor, this, &m_Helper, pBufferManager);
+			XN_VALIDATE_NEW_AND_INIT(pNew, XnJpegImageProcessor, this, &m_Helper);
 		}
 		else if (GetOutputFormat() == XN_OUTPUT_FORMAT_RGB24)
 		{
-			XN_VALIDATE_NEW_AND_INIT(pNew, XnJpegToRGBImageProcessor, this, &m_Helper, pBufferManager);
+			XN_VALIDATE_NEW_AND_INIT(pNew, XnJpegToRGBImageProcessor, this, &m_Helper);
 		}
 		else
 		{
@@ -869,19 +937,19 @@ XnStatus XnSensorImageStream::CreateDataProcessor(XnDataProcessor** ppProcessor)
 	case XN_IO_IMAGE_FORMAT_UNCOMPRESSED_YUV422:
 		if (GetOutputFormat() == XN_OUTPUT_FORMAT_YUV422)
 		{
-			XN_VALIDATE_NEW_AND_INIT(pNew, XnUncompressedYUVImageProcessor, this, &m_Helper, pBufferManager);
+			XN_VALIDATE_NEW_AND_INIT(pNew, XnUncompressedYUVImageProcessor, this, &m_Helper);
 		}
 		else if (GetOutputFormat() == XN_OUTPUT_FORMAT_RGB24)
 		{
-			XN_VALIDATE_NEW_AND_INIT(pNew, XnUncompressedYUVtoRGBImageProcessor, this, &m_Helper, pBufferManager);
+			XN_VALIDATE_NEW_AND_INIT(pNew, XnUncompressedYUVtoRGBImageProcessor, this, &m_Helper);
 		}
 		else
 		{
-			XN_LOG_WARNING_RETURN(XN_STATUS_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "invalid output format %d!", pBufferManager);
+			XN_LOG_WARNING_RETURN(XN_STATUS_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "invalid output format %d!", GetOutputFormat());
 		}
 		break;
 	case XN_IO_IMAGE_FORMAT_UNCOMPRESSED_BAYER:
-		XN_VALIDATE_NEW_AND_INIT(pNew, XnUncompressedBayerProcessor, this, &m_Helper, pBufferManager);
+		XN_VALIDATE_NEW_AND_INIT(pNew, XnUncompressedBayerProcessor, this, &m_Helper);
 		break;
 	default:
 		return XN_STATUS_IO_INVALID_STREAM_IMAGE_FORMAT;
diff --git a/Source/XnDeviceSensorV2/XnSensorImageStream.h b/Source/XnDeviceSensorV2/XnSensorImageStream.h
index 6ec9e56..94bc3a5 100644
--- a/Source/XnDeviceSensorV2/XnSensorImageStream.h
+++ b/Source/XnDeviceSensorV2/XnSensorImageStream.h
@@ -27,6 +27,7 @@
 //---------------------------------------------------------------------------
 #include <XnDDK/XnImageStream.h>
 #include "XnSensorStreamHelper.h"
+#include "XnSharedMemoryBufferPool.h"
 
 //---------------------------------------------------------------------------
 // Defines
@@ -58,7 +59,7 @@
 class XnSensorImageStream : public XnImageStream, public IXnSensorStream
 {
 public:
-	XnSensorImageStream(const XnChar* StreamName, XnSensorObjects* pObjects);
+	XnSensorImageStream(const XnChar* strDeviceName, const XnChar* StreamName, XnSensorObjects* pObjects, XnUInt32 nBufferCount, XnBool bAllowOtherUsers);
 	~XnSensorImageStream() { Free(); }
 
 	//---------------------------------------------------------------------------
@@ -93,6 +94,7 @@ protected:
 	XnStatus MapPropertiesToFirmware();
 	void GetFirmwareStreamConfig(XnResolutions* pnRes, XnUInt32* pnFPS) { *pnRes = GetResolution(); *pnFPS = GetFPS(); }
 	XnStatus WriteImpl(XnStreamData* /*pStreamData*/) { return XN_STATUS_DEVICE_UNSUPPORTED_MODE; }
+	XnSharedMemoryBufferPool* GetSharedMemoryBuffer() { return &m_BufferPool; }
 
 	//---------------------------------------------------------------------------
 	// Setters
@@ -115,6 +117,7 @@ protected:
 
 private:
 	XnStatus ValidateMode();
+	static XnUInt32 GetMaxBufferSize(XnFWVer version);
 
 	static XnStatus XN_CALLBACK_TYPE SetInputFormatCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie);
 	static XnStatus XN_CALLBACK_TYPE SetAntiFlickerCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie);
@@ -131,6 +134,9 @@ private:
 	// Members
 	//---------------------------------------------------------------------------
 	XnSensorStreamHelper m_Helper;
+	XnSharedMemoryBufferPool m_BufferPool;
+
+	XnActualStringProperty m_SharedBufferName;
 	XnActualIntProperty m_InputFormat;
 	XnActualIntProperty m_AntiFlicker;
 	XnActualIntProperty m_ImageQuality;
diff --git a/Source/XnDeviceSensorV2/XnSensorMapGenerator.cpp b/Source/XnDeviceSensorV2/XnSensorMapGenerator.cpp
index 8cdf868..51cef14 100644
--- a/Source/XnDeviceSensorV2/XnSensorMapGenerator.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorMapGenerator.cpp
@@ -155,7 +155,6 @@ XnStatus XnSensorMapGenerator::SetMapOutputMode(const XnMapOutputMode& Mode)
 
 	if (nChosenInputFormat == XN_MAX_UINT32) // not found
 	{
-		xnLogWarning(XN_MASK_DEVICE_SENSOR, "Mode %ux%u@%u is not supported!", Mode.nXRes, Mode.nYRes, Mode.nFPS);
 		return XN_STATUS_BAD_PARAM;
 	}
 
diff --git a/Source/XnDeviceSensorV2/XnSensorMapGenerator.h b/Source/XnDeviceSensorV2/XnSensorMapGenerator.h
index 733c9c2..d3be5a4 100644
--- a/Source/XnDeviceSensorV2/XnSensorMapGenerator.h
+++ b/Source/XnDeviceSensorV2/XnSensorMapGenerator.h
@@ -26,6 +26,7 @@
 // Includes
 //---------------------------------------------------------------------------
 #include "XnSensorGenerator.h"
+#include <XnList.h>
 
 //---------------------------------------------------------------------------
 // Types
diff --git a/Source/XnDeviceSensorV2/XnSensorProductionNode.cpp b/Source/XnDeviceSensorV2/XnSensorProductionNode.cpp
index 8420ab7..946cd40 100644
--- a/Source/XnDeviceSensorV2/XnSensorProductionNode.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorProductionNode.cpp
@@ -41,9 +41,9 @@ XnSensorProductionNode::XnSensorProductionNode(xn::Context& context, const XnCha
 XnSensorProductionNode::~XnSensorProductionNode()
 {
 	// free all memory allocated for registration, even if client did not unregister from it
-	for (XnMultiPropChangedHandlerHash::Iterator it = m_AllHandlers.Begin(); it != m_AllHandlers.End(); ++it)
+	for (XnMultiPropChangedHandlerHash::Iterator it = m_AllHandlers.begin(); it != m_AllHandlers.end(); ++it)
 	{
-		XN_DELETE(it->Key());
+		XN_DELETE(it.Key());
 	}
 }
 
@@ -140,7 +140,7 @@ XnStatus XnSensorProductionNode::NotifyExState(XnNodeNotifications* pNotificatio
 	nRetVal = m_pSensor->GetAllProperties(&props, FALSE, GetModuleName());
 	XN_IS_STATUS_OK(nRetVal);
 
-	XnActualPropertiesHash* pPropsHash = props.pData->Begin()->Value();
+	XnActualPropertiesHash* pPropsHash = props.pData->begin().Value();
 
 	// filter properties (remove the ones already exposed as OpenNI interfaces)
 	FilterProperties(pPropsHash);
@@ -156,9 +156,9 @@ XnStatus XnSensorProductionNode::NotifyExState(XnNodeNotifications* pNotificatio
 	XnUInt32 nGeneralProps = 0;
 
 	// enumerate over properties
-	for (XnActualPropertiesHash::Iterator it = pPropsHash->Begin(); it != pPropsHash->End(); ++it)
+	for (XnActualPropertiesHash::Iterator it = pPropsHash->begin(); it != pPropsHash->end(); ++it)
 	{
-		XnProperty* pProp = it->Value();
+		XnProperty* pProp = it.Value();
 
 		switch (pProp->GetType())
 		{
diff --git a/Source/XnDeviceSensorV2/XnSensorProductionNode.h b/Source/XnDeviceSensorV2/XnSensorProductionNode.h
index 2dd50b4..1eece78 100644
--- a/Source/XnDeviceSensorV2/XnSensorProductionNode.h
+++ b/Source/XnDeviceSensorV2/XnSensorProductionNode.h
@@ -27,7 +27,7 @@
 //---------------------------------------------------------------------------
 #include <XnModuleCppInterface.h>
 #include "XnSensor.h"
-#include <XnHashT.h>
+#include <XnHash.h>
 #include "XnSensorClient.h"
 
 class XnMultiPropChangedHandler; // forward declaration
@@ -94,7 +94,7 @@ protected:
 	static void XN_CALLBACK_TYPE StringPropertyChangedCallback(XnDeviceHandle pDeviceHandle, const XnChar* ModuleName, const XnChar* PropertyName, void* pCookie);
 	static void XN_CALLBACK_TYPE GeneralPropertyChangedCallback(XnDeviceHandle pDeviceHandle, const XnChar* ModuleName, const XnChar* PropertyName, void* pCookie);
 
-	typedef XnHashT<XnMultiPropChangedHandler*, XnMultiPropChangedHandler*> XnMultiPropChangedHandlerHash;
+	XN_DECLARE_DEFAULT_HASH(XnMultiPropChangedHandler*, XnMultiPropChangedHandler*, XnMultiPropChangedHandlerHash);
 
 	xn::Context m_Context;
 	XnDeviceBase* m_pSensor;
diff --git a/Source/XnDeviceSensorV2/XnSensorServer.cpp b/Source/XnDeviceSensorV2/XnSensorServer.cpp
index 6e36ad1..0747d84 100644
--- a/Source/XnDeviceSensorV2/XnSensorServer.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorServer.cpp
@@ -26,6 +26,7 @@
 #include "XnSensorClientServer.h"
 #include <XnLog.h>
 #include <XnIONetworkStream.h>
+#include <XnStringsHash.h>
 
 //---------------------------------------------------------------------------
 // Defines
@@ -219,8 +220,8 @@ void XnSensorServer::CleanUpSessions()
 	XnAutoCSLocker locker(m_hSessionsLock);
 	if (!m_sessions.IsEmpty())
 	{
-		XnSessionsList::Iterator it = m_sessions.Begin();
-		while (it != m_sessions.End())
+		XnSessionsList::Iterator it = m_sessions.begin();
+		while (it != m_sessions.end())
 		{
 			XnSessionsList::Iterator curr = it;
 			++it;
diff --git a/Source/XnDeviceSensorV2/XnSensorServer.h b/Source/XnDeviceSensorV2/XnSensorServer.h
index 6b7da06..797e1b1 100644
--- a/Source/XnDeviceSensorV2/XnSensorServer.h
+++ b/Source/XnDeviceSensorV2/XnSensorServer.h
@@ -32,7 +32,6 @@
 #include "XnServerLogger.h"
 #include "XnSensorsManager.h"
 #include "XnServerSession.h"
-#include <XnListT.h>
 
 //---------------------------------------------------------------------------
 // XnSensorServer class
@@ -49,7 +48,7 @@ public:
 	XnBool IsServerRunning();
 
 private:
-	typedef XnListT<XnServerSession*> XnSessionsList;
+	XN_DECLARE_LIST(XnServerSession*, XnSessionsList);
 
 	XnStatus InitServer();
 	XnStatus ServerMainLoop();
diff --git a/Source/XnDeviceSensorV2/XnSensorStreamHelper.cpp b/Source/XnDeviceSensorV2/XnSensorStreamHelper.cpp
index 09fcef0..d5385ba 100644
--- a/Source/XnDeviceSensorV2/XnSensorStreamHelper.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorStreamHelper.cpp
@@ -27,6 +27,29 @@
 #include <XnLog.h>
 
 //---------------------------------------------------------------------------
+// Types
+//---------------------------------------------------------------------------
+class XnSensorStreamHelperCookie
+{
+public:
+	XnSensorStreamHelperCookie(XnActualIntProperty* pStreamProp, XnActualIntProperty* pFirmwareProp, XnBool bAllowWhileOpen, XnSensorStreamHelper::ConvertCallback pStreamToFirmwareFunc) :
+		pStreamProp(pStreamProp), pFirmwareProp(pFirmwareProp), bAllowWhileOpen(bAllowWhileOpen), pStreamToFirmwareFunc(pStreamToFirmwareFunc), bProcessorProp(FALSE)
+	{}
+
+	XnActualIntProperty* pStreamProp;
+	XnActualIntProperty* pFirmwareProp;
+	XnBool bAllowWhileOpen;
+	XnSensorStreamHelper::ConvertCallback pStreamToFirmwareFunc;
+	XnBool bProcessorProp;
+
+	struct
+	{
+		XnBool bShouldOpen;
+		XnBool bChooseProcessor;
+	} CurrentTransaction;
+};
+
+//---------------------------------------------------------------------------
 // Code
 //---------------------------------------------------------------------------
 
@@ -62,6 +85,12 @@ XnStatus XnSensorStreamHelper::Free()
 		GetFirmware()->GetStreams()->ReleaseStream(m_pStream->GetType(), m_pStream);
 	}
 
+	for (XnHash::Iterator it = m_FirmwareProperties.begin(); it != m_FirmwareProperties.end(); ++it)
+	{
+		XnSensorStreamHelperCookie* pCookie = (XnSensorStreamHelperCookie*)it.Value();
+		XN_DELETE(pCookie);
+	}
+
 	m_FirmwareProperties.Clear();
 
 	return XN_STATUS_OK;
@@ -129,13 +158,6 @@ XnStatus XnSensorStreamHelper::Open()
 	nRetVal = Configure();
 	XN_IS_STATUS_OK(nRetVal);
 
-	// Update frequency (it might change on specific stream configuration)
-	XnFrequencyInformation FrequencyInformation;
-	nRetVal = XnHostProtocolAlgorithmParams(m_pObjects->pDevicePrivateData, XN_HOST_PROTOCOL_ALGORITHM_FREQUENCY, &FrequencyInformation, sizeof(XnFrequencyInformation), (XnResolutions)0, 0);
-	XN_IS_STATUS_OK(nRetVal);
-
-	m_pObjects->pDevicePrivateData->fDeviceFrequency = XN_PREPARE_VAR_FLOAT_IN_BUFFER(FrequencyInformation.fDeviceFrequency);
-
 	// and now turn it on
 	nRetVal = FinalOpen();
 	XN_IS_STATUS_OK(nRetVal);
@@ -163,10 +185,11 @@ XnStatus XnSensorStreamHelper::RegisterDataProcessorProperty(XnActualIntProperty
 	XnStatus nRetVal = XN_STATUS_OK;
 
 	// mark it so
-	XnSensorStreamHelperCookie* pCookie;
-	nRetVal = m_FirmwareProperties.Get(&Property, pCookie);
+	XnValue val;
+	nRetVal = m_FirmwareProperties.Get(&Property, val);
 	XN_IS_STATUS_OK(nRetVal);
 
+	XnSensorStreamHelperCookie* pCookie = (XnSensorStreamHelperCookie*)val;
 	pCookie->bProcessorProp = TRUE;
 
 	return (XN_STATUS_OK);
@@ -177,11 +200,16 @@ XnStatus XnSensorStreamHelper::MapFirmwareProperty(XnActualIntProperty& Property
 	XnStatus nRetVal = XN_STATUS_OK;
 	
 	// init data
-	XnSensorStreamHelperCookie cookie(&Property, &FirmwareProperty, bAllowChangeWhileOpen, pStreamToFirmwareFunc);
+	XnSensorStreamHelperCookie* pCookie;
+	XN_VALIDATE_NEW(pCookie, XnSensorStreamHelperCookie, &Property, &FirmwareProperty, bAllowChangeWhileOpen, pStreamToFirmwareFunc);
 
 	// add it to the list
-	nRetVal = m_FirmwareProperties.Set(&Property, cookie);
-	XN_IS_STATUS_OK(nRetVal);
+	nRetVal = m_FirmwareProperties.Set(&Property, pCookie);
+	if (nRetVal != XN_STATUS_OK)
+	{
+		XN_DELETE(pCookie);
+		return (nRetVal);
+	}
 
 	return (XN_STATUS_OK);
 }
@@ -190,10 +218,12 @@ XnStatus XnSensorStreamHelper::ConfigureFirmware(XnActualIntProperty& Property)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 	
-	XnSensorStreamHelperCookie* pPropData = NULL;
-	nRetVal = m_FirmwareProperties.Get(&Property, pPropData);
+	XnHash::Iterator it = m_FirmwareProperties.end();
+	nRetVal = m_FirmwareProperties.Find(&Property, it);
 	XN_IS_STATUS_OK(nRetVal);
 
+	XnSensorStreamHelperCookie* pPropData = (XnSensorStreamHelperCookie*)it.Value();
+	
 	XnUInt64 nFirmwareValue = Property.GetValue();
 
 	if (pPropData->pStreamToFirmwareFunc != NULL)
@@ -212,10 +242,12 @@ XnStatus XnSensorStreamHelper::BeforeSettingFirmwareParam(XnActualIntProperty& P
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 	
-	XnSensorStreamHelperCookie* pPropData = NULL;
-	nRetVal = m_FirmwareProperties.Get(&Property, pPropData);
+	XnHash::Iterator it = m_FirmwareProperties.end();
+	nRetVal = m_FirmwareProperties.Find(&Property, it);
 	XN_IS_STATUS_OK(nRetVal);
 
+	XnSensorStreamHelperCookie* pPropData = (XnSensorStreamHelperCookie*)it.Value();
+
 	pPropData->CurrentTransaction.bShouldOpen = FALSE;
 	pPropData->CurrentTransaction.bChooseProcessor = FALSE;
 
@@ -268,9 +300,11 @@ XnStatus XnSensorStreamHelper::AfterSettingFirmwareParam(XnActualIntProperty& Pr
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 	
-	XnSensorStreamHelperCookie* pPropData = NULL;
-	nRetVal = m_FirmwareProperties.Get(&Property, pPropData);
+	XnHash::Iterator it = m_FirmwareProperties.end();
+	nRetVal = m_FirmwareProperties.Find(&Property, it);
 	XN_IS_STATUS_OK(nRetVal);
+
+	XnSensorStreamHelperCookie* pPropData = (XnSensorStreamHelperCookie*)it.Value();
 	
 	if (pPropData->CurrentTransaction.bShouldOpen)
 	{
@@ -348,10 +382,11 @@ XnStatus XnSensorStreamHelper::UpdateFromFirmware(XnActualIntProperty& Property)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 	
-	XnSensorStreamHelperCookie* pPropData = NULL;
-	nRetVal = m_FirmwareProperties.Get(&Property, pPropData);
+	XnHash::Iterator it = m_FirmwareProperties.end();
+	nRetVal = m_FirmwareProperties.Find(&Property, it);
 	XN_IS_STATUS_OK(nRetVal);
 
+	XnSensorStreamHelperCookie* pPropData = (XnSensorStreamHelperCookie*)it.Value();
 	nRetVal = pPropData->pStreamProp->UnsafeUpdateValue(pPropData->pFirmwareProp->GetValue());
 	XN_IS_STATUS_OK(nRetVal);
 	
@@ -367,12 +402,13 @@ XnStatus XnSensorStreamHelper::BatchConfig(const XnActualPropertiesHash& props)
 	if (m_pStream->IsOpen())
 	{
 		// check if one of the properties requires to close the stream
-		for (FirmareProperties::Iterator it = m_FirmwareProperties.Begin(); it != m_FirmwareProperties.End(); ++it)
+		for (XnHash::Iterator it = m_FirmwareProperties.begin(); it != m_FirmwareProperties.end(); ++it)
 		{
-			if (!it->Value().bAllowWhileOpen)
+			XnSensorStreamHelperCookie* pPropData = (XnSensorStreamHelperCookie*)it.Value();
+			if (!pPropData->bAllowWhileOpen)
 			{
 				XnProperty* pProp;
-				if (XN_STATUS_OK == props.Get(it->Value().pStreamProp->GetName(), pProp))
+				if (XN_STATUS_OK == props.Get(pPropData->pStreamProp->GetName(), pProp))
 				{
 					bShouldClose = TRUE;
 					break;
diff --git a/Source/XnDeviceSensorV2/XnSensorStreamHelper.h b/Source/XnDeviceSensorV2/XnSensorStreamHelper.h
index 6c80fae..ebc0a3e 100644
--- a/Source/XnDeviceSensorV2/XnSensorStreamHelper.h
+++ b/Source/XnDeviceSensorV2/XnSensorStreamHelper.h
@@ -30,6 +30,7 @@
 #include "XnSensorFixedParams.h"
 #include <XnDDK/XnDeviceStream.h>
 #include <XnDDK/XnDeviceModuleHolder.h>
+#include "XnSharedMemoryBufferPool.h"
 
 //---------------------------------------------------------------------------
 // Types
@@ -80,7 +81,7 @@ public:
 
 	inline XnSensorFirmware* GetFirmware() const { return m_pObjects->pFirmware; }
 	inline XnFWVer GetFirmwareVersion() const { return GetFirmware()->GetInfo()->nFWVer; }
-	inline XnSensorFixedParams* GetFixedParams() const { return m_pObjects->pFirmware->GetFixedParams(); }
+	inline XnSensorFixedParams* GetFixedParams() const { return m_pObjects->pFixedParams; }
 	inline XnDevicePrivateData* GetPrivateData() const { return m_pObjects->pDevicePrivateData; }
 	inline XnSensorFPS* GetFPS() const { return m_pObjects->pFPS; }
 	inline XnCmosInfo* GetCmosInfo() const { return m_pObjects->pCmosInfo; }
@@ -98,29 +99,7 @@ private:
 	XnDeviceStream* m_pStream;
 	XnSensorObjects* m_pObjects;
 
-	class XnSensorStreamHelperCookie
-	{
-	public:
-		XnSensorStreamHelperCookie() {}
-		XnSensorStreamHelperCookie(XnActualIntProperty* pStreamProp, XnActualIntProperty* pFirmwareProp, XnBool bAllowWhileOpen, XnSensorStreamHelper::ConvertCallback pStreamToFirmwareFunc) :
-			pStreamProp(pStreamProp), pFirmwareProp(pFirmwareProp), bAllowWhileOpen(bAllowWhileOpen), pStreamToFirmwareFunc(pStreamToFirmwareFunc), bProcessorProp(FALSE)
-		{}
-
-		XnActualIntProperty* pStreamProp;
-		XnActualIntProperty* pFirmwareProp;
-		XnBool bAllowWhileOpen;
-		XnSensorStreamHelper::ConvertCallback pStreamToFirmwareFunc;
-		XnBool bProcessorProp;
-
-		struct
-		{
-			XnBool bShouldOpen;
-			XnBool bChooseProcessor;
-		} CurrentTransaction;
-	};
-
-	typedef XnHashT<XnActualIntProperty*, XnSensorStreamHelperCookie> FirmareProperties;
-	FirmareProperties m_FirmwareProperties;
+	XnHash m_FirmwareProperties;
 };
 
 class XnSensorStreamHolder : public XnDeviceModuleHolder
@@ -131,6 +110,7 @@ public:
 	{}
 
 	inline XnDeviceStream* GetStream() { return (XnDeviceStream*)GetModule(); }
+	inline XnSharedMemoryBufferPool* GetSharedBufferPool() { return m_pHelper->GetSensorStream()->GetSharedMemoryBuffer(); }
 
 	XnStatus Configure() { return m_pHelper->Configure(); }
 	XnStatus FinalOpen() { return m_pHelper->FinalOpen(); }
diff --git a/Source/XnDeviceSensorV2/XnSensorsManager.cpp b/Source/XnDeviceSensorV2/XnSensorsManager.cpp
index 8493d24..fe50abe 100644
--- a/Source/XnDeviceSensorV2/XnSensorsManager.cpp
+++ b/Source/XnDeviceSensorV2/XnSensorsManager.cpp
@@ -36,12 +36,11 @@
 XnSensorsManager::XnSensorsManager(const XnChar* strGlobalConfigFile) :
 	m_noClientTimeout(XN_MODULE_PROPERTY_SERVER_NO_CLIENTS_TIMEOUT, XN_SENSOR_DEFAULT_SERVER_WAIT_FOR_CLIENT_TIME),
 	m_startNewLog(XN_MODULE_PROPERTY_SERVER_START_NEW_LOG_FILE),
-	m_logFile(XN_MODULE_PROPERTY_SERVER_LOG_FILE, NULL),
 	m_hLock(NULL)
 {
 	m_noClientTimeout.UpdateSetCallbackToDefault();
 	m_startNewLog.UpdateSetCallback(StartNewLogCallback, this);
-	m_logFile.UpdateGetCallback(GetLogCallback, this);
+
 	strcpy(m_strGlobalConfigFile, strGlobalConfigFile);
 }
 
@@ -67,9 +66,9 @@ XnStatus XnSensorsManager::Init()
 void XnSensorsManager::Free()
 {
 	// close all sensors
-	while (m_sensors.Begin() != m_sensors.End())
+	while (m_sensors.begin() != m_sensors.end())
 	{
-		ReferencedSensor& sensor = m_sensors.Begin()->Value();
+		ReferencedSensor& sensor = m_sensors.begin().Value();
 		XN_DELETE(sensor.pInvoker);
 	}
 
@@ -97,7 +96,7 @@ XnStatus XnSensorsManager::GetSensor(const XnChar* strDevicePath, XnServerSensor
 		sensor.nRefCount = 0;
 		XN_VALIDATE_NEW(sensor.pInvoker, XnServerSensorInvoker);
 
-		XnProperty* aAdditionalProps[] = { &m_noClientTimeout, &m_startNewLog, &m_logFile };
+		XnProperty* aAdditionalProps[] = { &m_noClientTimeout, &m_startNewLog };
 		nRetVal = sensor.pInvoker->Init(strDevicePath, m_strGlobalConfigFile, sizeof(aAdditionalProps)/sizeof(XnProperty*), aAdditionalProps);
 		XN_IS_STATUS_OK(nRetVal);
 
@@ -163,16 +162,16 @@ void XnSensorsManager::CleanUp()
 
 	XnUInt64 nNow;
 	xnOSGetTimeStamp(&nNow);
-	XnSensorsHash::Iterator it = m_sensors.Begin();
-	while (it != m_sensors.End())
+	XnSensorsHash::Iterator it = m_sensors.begin();
+	while (it != m_sensors.end())
 	{
 		XnSensorsHash::Iterator curr = it;
 		++it;
 
-		ReferencedSensor& sensor = curr->Value();
+		ReferencedSensor& sensor = curr.Value();
 		if (sensor.nRefCount == 0 && (nNow - sensor.nNoClientsTime) > m_noClientTimeout.GetValue())
 		{
-			xnLogInfo(XN_MASK_SENSOR_SERVER, "No session holding sensor '%s' for %u ms. Shutting down...", curr->Key(), m_noClientTimeout.GetValue());
+			xnLogInfo(XN_MASK_SENSOR_SERVER, "No session holding sensor '%s' for %u ms. Shutting down...", curr.Key(), m_noClientTimeout.GetValue());
 			XN_DELETE(sensor.pInvoker);
 			m_sensors.Remove(curr);
 		}
@@ -185,8 +184,3 @@ XnStatus XN_CALLBACK_TYPE XnSensorsManager::StartNewLogCallback(XnIntProperty* /
 	return xnLogStartNewFile();
 }
 
-XnStatus XN_CALLBACK_TYPE XnSensorsManager::GetLogCallback(const XnStringProperty* /*pSender*/, XnChar* csValue, void* /*pCookie*/)
-{
-	return xnLogGetFileName(csValue, XN_DEVICE_MAX_STRING_LENGTH);
-}
-
diff --git a/Source/XnDeviceSensorV2/XnSensorsManager.h b/Source/XnDeviceSensorV2/XnSensorsManager.h
index ea249a6..b31e2f2 100644
--- a/Source/XnDeviceSensorV2/XnSensorsManager.h
+++ b/Source/XnDeviceSensorV2/XnSensorsManager.h
@@ -26,7 +26,7 @@
 // Includes
 //---------------------------------------------------------------------------
 #include "XnServerSensorInvoker.h"
-#include <XnStringsHashT.h>
+#include <XnStringsHash.h>
 
 //---------------------------------------------------------------------------
 // Types
@@ -46,7 +46,7 @@ public:
 	void ReleaseSensor(XnServerSensorInvoker* pInvoker);
 
 	void CleanUp();
-	inline XnBool HasOpenSensors() { return m_sensors.Begin() != m_sensors.End(); }
+	inline XnBool HasOpenSensors() { return m_sensors.begin() != m_sensors.end(); }
 
 private:
 	typedef struct
@@ -56,16 +56,14 @@ private:
 		XnUInt32 nRefCount;
 	} ReferencedSensor;
 
-	typedef XnStringsHashT<ReferencedSensor> XnSensorsHash;
+	XN_DECLARE_STRINGS_HASH(ReferencedSensor, XnSensorsHash);
 
 	static XnStatus XN_CALLBACK_TYPE StartNewLogCallback(XnIntProperty* pSender, XnUInt64 nValue, void* pCookie);
-	static XnStatus XN_CALLBACK_TYPE GetLogCallback(const XnStringProperty* pSender, XnChar* csValue, void* pCookie);
 
 	XnChar m_strGlobalConfigFile[XN_FILE_MAX_PATH];
 	XN_CRITICAL_SECTION_HANDLE m_hLock;
 	XnSensorsHash m_sensors;
 	XnActualIntProperty m_noClientTimeout;
-	XnStringProperty m_logFile;
 	XnIntProperty m_startNewLog;
 	XnUInt64 nNoClientsTime;
 };
diff --git a/Source/XnDeviceSensorV2/XnServerSensorInvoker.cpp b/Source/XnDeviceSensorV2/XnServerSensorInvoker.cpp
index 8c1c949..8b2925d 100644
--- a/Source/XnDeviceSensorV2/XnServerSensorInvoker.cpp
+++ b/Source/XnDeviceSensorV2/XnServerSensorInvoker.cpp
@@ -30,8 +30,6 @@
 // Defines
 //---------------------------------------------------------------------------
 #define XN_SENSOR_TERMINATE_READER_THREAD_TIMEOUT		5000
-#define XN_SENSOR_DEFAULT_ENABLE_MULTI_USERS			FALSE
-#define XN_SENSOR_DEFAULT_NUMBER_OF_BUFFERS				6
 
 //---------------------------------------------------------------------------
 // Code
@@ -41,12 +39,8 @@ XnServerSensorInvoker::XnServerSensorInvoker() :
 	m_hReaderThread(NULL),
 	m_hNewDataEvent(NULL),
 	m_bShouldRun(TRUE),
-	m_errorState(XN_STATUS_OK),
-	m_numberOfBuffers(XN_MODULE_PROPERTY_NUMBER_OF_BUFFERS, XN_SENSOR_DEFAULT_NUMBER_OF_BUFFERS),
-	m_allowOtherUsers(XN_MODULE_PROPERTY_ENABLE_MULTI_USERS, XN_SENSOR_DEFAULT_ENABLE_MULTI_USERS)
+	m_errorState(XN_STATUS_OK)
 {
-	m_numberOfBuffers.UpdateSetCallback(SetNumberOfBuffersCallback, this);
-	m_allowOtherUsers.UpdateSetCallback(SetAllowOtherUsersCallback, this);
 }
 
 XnServerSensorInvoker::~XnServerSensorInvoker()
@@ -76,20 +70,15 @@ XnStatus XnServerSensorInvoker::Init(const XnChar* strDevicePath, const XnChar*
 	nRetVal = m_sensor.DeviceModule()->AddProperties(aAdditionalProps, nAdditionalProps);
 	XN_IS_STATUS_OK(nRetVal);
 
-	XnProperty* aInvokerAdditionalProps[] = { &m_numberOfBuffers, &m_allowOtherUsers };
-	nRetVal = m_sensor.DeviceModule()->AddProperties(aInvokerAdditionalProps, sizeof(aInvokerAdditionalProps) / sizeof(aInvokerAdditionalProps[0]));
-	XN_IS_STATUS_OK(nRetVal);
-
 	// configure from global file
 	nRetVal = m_sensor.ConfigureModuleFromGlobalFile(XN_MODULE_NAME_DEVICE, XN_SENSOR_SERVER_CONFIG_FILE_SECTION);
 	XN_IS_STATUS_OK(nRetVal);
 
 	// register to events
-	XnCallbackHandle hDummy = NULL;
-	nRetVal = m_sensor.OnStreamCollectionChangedEvent().Register(StreamCollectionChangedCallback, this, hDummy);
+	nRetVal = m_sensor.OnStreamCollectionChangedEvent().Register(StreamCollectionChangedCallback, this);
 	XN_IS_STATUS_OK(nRetVal);
 
-	nRetVal = m_sensor.OnNewStreamDataEvent().Register(NewStreamDataCallback, this, hDummy);
+	nRetVal = m_sensor.OnNewStreamDataEvent().Register(NewStreamDataCallback, this);
 	XN_IS_STATUS_OK(nRetVal);
 
 	// register to all properties
@@ -148,25 +137,24 @@ const XnChar* XnServerSensorInvoker::GetDevicePath()
 XnStatus XnServerSensorInvoker::RegisterToProps(XnPropertySet* pProps)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
-	XnCallbackHandle hDummy = NULL;
 
-	for (XnPropertySetData::Iterator itMod = pProps->pData->Begin(); itMod != pProps->pData->End(); ++itMod)
+	for (XnPropertySetData::Iterator itMod = pProps->pData->begin(); itMod != pProps->pData->end(); ++itMod)
 	{
-		XnActualPropertiesHash* pHash = itMod->Value();
+		XnActualPropertiesHash* pHash = itMod.Value();
 
 		XnDeviceModule* pModule;
-		nRetVal = m_sensor.FindModule(itMod->Key(), &pModule);
+		nRetVal = m_sensor.FindModule(itMod.Key(), &pModule);
 		XN_IS_STATUS_OK(nRetVal);
 
-		for (XnActualPropertiesHash::Iterator itProp = pHash->Begin(); itProp != pHash->End(); ++itProp)
+		for (XnActualPropertiesHash::Iterator itProp = pHash->begin(); itProp != pHash->end(); ++itProp)
 		{
 			XnProperty* pProp;
-			nRetVal = pModule->GetProperty(itProp->Key(), &pProp);
+			nRetVal = pModule->GetProperty(itProp.Key(), &pProp);
 			XN_IS_STATUS_OK(nRetVal);
 
 			// no need to keep the handle. We only want to unregister when the stream is destroyed, and then
 			// it happens anyway.
-			nRetVal = pProp->OnChangeEvent().Register(PropertyChangedCallback, this, hDummy);
+			nRetVal = pProp->OnChangeEvent().Register(PropertyChangedCallback, this);
 			XN_IS_STATUS_OK(nRetVal);
 		}
 	}
@@ -258,7 +246,7 @@ XnStatus XnServerSensorInvoker::GetStream(const XnChar* strType, const XnPropert
 	
 	// check if stream already exists
 	XnAutoCSLocker locker(m_hSensorLock);
-	SensorInvokerStream* pStream = NULL;
+	SensorInvokerStream* pStream;
 	nRetVal = m_streams.Get(strType, pStream);
 	if (nRetVal == XN_STATUS_OK)
 	{
@@ -293,120 +281,12 @@ XnStatus XnServerSensorInvoker::GetStream(const XnChar* strType, const XnPropert
 	return (XN_STATUS_OK);
 }
 
-XnStatus XnServerSensorInvoker::SetStreamSharedMemory(SensorInvokerStream* pStream)
-{
-	XnStatus nRetVal = XN_STATUS_OK;
-	
-	// give shared memory a name (to make the name unique, we'll add process ID)
-	XN_PROCESS_ID procID;
-	xnOSGetCurrentProcessID(&procID);
-	XnChar strSharedMemoryName[XN_FILE_MAX_PATH];
-	sprintf(strSharedMemoryName, "%u_%s_%s", (XnUInt32)procID, m_sensor.GetUSBPath(), pStream->strType);
-	nRetVal = pStream->pSharedMemoryName->UnsafeUpdateValue(strSharedMemoryName);
-	XN_IS_STATUS_OK(nRetVal);
-
-	XnUInt32 nBufferSize = 0;
-	XnUInt32 nPixelSize = 0;
-
-	if (strcmp(pStream->strType, XN_STREAM_TYPE_DEPTH) == 0)
-	{
-		// have space for depth and shift values
-		nPixelSize = sizeof(XnDepthPixel) + sizeof(XnUInt16);
-	}
-	else if (strcmp(pStream->strType, XN_STREAM_TYPE_IMAGE) == 0)
-	{
-		// biggest pixel size is the RGB24
-		nPixelSize = sizeof(XnRGB24Pixel);
-	}
-	else if (strcmp(pStream->strType, XN_STREAM_TYPE_IR) == 0)
-	{
-		// biggest pixel size is the RGB24
-		nPixelSize = sizeof(XnIRPixel);
-	}
-	else
-	{
-		XN_ASSERT(FALSE);
-		return XN_STATUS_ERROR;
-	}
-
-	// find out max resolution
-	XnUInt32 nMaxNumPixels = 0;
-	nRetVal = GetStreamMaxResolution(pStream, nMaxNumPixels);
-	XN_IS_STATUS_OK(nRetVal);
-
-	nBufferSize = (XnUInt32)(nMaxNumPixels * nPixelSize * m_numberOfBuffers.GetValue());
-
-	// allocate shared memory
-	nRetVal = xnOSCreateSharedMemoryEx(strSharedMemoryName, nBufferSize, XN_OS_FILE_READ | XN_OS_FILE_WRITE, m_allowOtherUsers.GetValue() == TRUE, &pStream->hSharedMemory);
-	XN_IS_STATUS_OK(nRetVal);
-
-	nRetVal = xnOSSharedMemoryGetAddress(pStream->hSharedMemory, (void**)&pStream->pSharedMemoryAddress);
-	XN_IS_STATUS_OK(nRetVal);
-
-	// Set buffer pool for this stream
-	XnGeneralBuffer* aBuffers = XN_NEW_ARR(XnGeneralBuffer, m_numberOfBuffers.GetValue());
-	XnUInt32 nSingleBufferSize = nBufferSize / m_numberOfBuffers.GetValue();
-	for (XnUInt32 i = 0; i < m_numberOfBuffers.GetValue(); ++i)
-	{
-		aBuffers[i].pData = pStream->pSharedMemoryAddress + (i * nSingleBufferSize);
-		aBuffers[i].nDataSize = nSingleBufferSize;
-	}
-
-	nRetVal = m_sensor.SetProperty(pStream->strType, XN_STREAM_PROPERTY_EXTERNAL_BUFFER_POOL, XnGeneralBufferPack(aBuffers, m_numberOfBuffers.GetValue() * sizeof(XnGeneralBuffer)));
-	XN_DELETE_ARR(aBuffers);
-
-	XN_IS_STATUS_OK(nRetVal);
-	
-	return (XN_STATUS_OK);
-}
-
-XnStatus XnServerSensorInvoker::GetStreamMaxResolution(SensorInvokerStream* pStream, XnUInt32& nMaxNumPixels)
-{
-	XnStatus nRetVal = XN_STATUS_OK;
-	
-	XnUInt64 nCount = 0;
-	nRetVal = m_sensor.GetProperty(pStream->strType, XN_STREAM_PROPERTY_SUPPORT_MODES_COUNT, &nCount);
-	XN_IS_STATUS_OK(nRetVal);
-
-	XnCmosPreset* aPresets = XN_NEW_ARR(XnCmosPreset, nCount);
-	nRetVal = m_sensor.GetProperty(pStream->strType, XN_STREAM_PROPERTY_SUPPORT_MODES, XnGeneralBufferPack(aPresets, nCount * sizeof(XnCmosPreset)));
-	if (nRetVal != XN_STATUS_OK)
-	{
-		XN_DELETE_ARR(aPresets);
-		return nRetVal;
-	}
-
-	XnUInt32 nMaxPixels = 0;
-	for (XnUInt32 i = 0; i < nCount; ++i)
-	{
-		XnUInt32 nXRes;
-		XnUInt32 nYRes;
-		if (!XnDDKGetXYFromResolution((XnResolutions)aPresets[i].nResolution, &nXRes, &nYRes))
-		{
-			continue;
-		}
-
-		if (nXRes * nYRes > nMaxPixels)
-		{
-			nMaxPixels = nXRes * nYRes;
-		}
-	}
-
-	XN_ASSERT(nMaxPixels > 0);
-
-	XN_DELETE_ARR(aPresets);
-
-	nMaxNumPixels = nMaxPixels;
-	
-	return (XN_STATUS_OK);
-}
-
 XnStatus XnServerSensorInvoker::ReleaseStream(const XnChar* strType)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 	
 	XnAutoCSLocker locker(m_hSensorLock);
-	SensorInvokerStream* pStream = NULL;
+	SensorInvokerStream* pStream;
 	nRetVal = m_streams.Get(strType, pStream);
 	XN_IS_STATUS_OK(nRetVal);
 
@@ -424,18 +304,18 @@ XnStatus XnServerSensorInvoker::ReleaseStream(const XnChar* strType)
 	return (XN_STATUS_OK);
 }
 
-XnStatus XnServerSensorInvoker::OpenStream(const XnChar* strName, NewStreamDataHandler pNewDataHandler, void* pCookie, XnCallbackHandle& hCallback)
+XnStatus XnServerSensorInvoker::OpenStream(const XnChar* strName, NewStreamDataHandler pNewDataHandler, void* pCookie, XnCallbackHandle* phCallback)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 	
 	XnAutoCSLocker locker(m_hSensorLock);
 
-	SensorInvokerStream* pStream = NULL;
+	SensorInvokerStream* pStream;
 	nRetVal = m_streams.Get(strName, pStream);
 	XN_IS_STATUS_OK(nRetVal);
 
 	// register for new data event
-	nRetVal = pStream->pNewDataEvent->Register(pNewDataHandler, pCookie, hCallback);
+	nRetVal = pStream->pNewDataEvent->Register(pNewDataHandler, pCookie, phCallback);
 	XN_IS_STATUS_OK(nRetVal);
 
 	// increase open ref count
@@ -449,7 +329,7 @@ XnStatus XnServerSensorInvoker::OpenStream(const XnChar* strName, NewStreamDataH
 		{
 			xnLogError(XN_MASK_SENSOR_SERVER, "Failed to open stream: %s", xnGetStatusString(nRetVal));
 			--pStream->nOpenRefCount;
-			pStream->pNewDataEvent->Unregister(hCallback);
+			pStream->pNewDataEvent->Unregister(*phCallback);
 			return (nRetVal);
 		}
 	}
@@ -465,7 +345,7 @@ XnStatus XnServerSensorInvoker::CloseStream(const XnChar* strName, XnCallbackHan
 	
 	XnAutoCSLocker locker(m_hSensorLock);
 
-	SensorInvokerStream* pStream = NULL;
+	SensorInvokerStream* pStream;
 	nRetVal = m_streams.Get(strName, pStream);
 	XN_IS_STATUS_OK(nRetVal);
 
@@ -496,8 +376,8 @@ XnStatus XnServerSensorInvoker::AddRefFrameBuffer(const XnChar* strStreamName, X
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 
-	XnBufferPool* pBufferPool = NULL;
-	nRetVal = m_sensor.GetBufferPool(strStreamName, &pBufferPool);
+	XnSharedMemoryBufferPool* pBufferPool = NULL;
+	nRetVal = m_sensor.GetSharedBufferPool(strStreamName, &pBufferPool);
 	XN_IS_STATUS_OK(nRetVal);
 
 	pBufferPool->AddRef(pBuffer);
@@ -509,8 +389,8 @@ XnStatus XnServerSensorInvoker::ReleaseFrameBuffer(const XnChar* strStreamName,
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 	
-	XnBufferPool* pBufferPool = NULL;
-	nRetVal = m_sensor.GetBufferPool(strStreamName, &pBufferPool);
+	XnSharedMemoryBufferPool* pBufferPool = NULL;
+	nRetVal = m_sensor.GetSharedBufferPool(strStreamName, &pBufferPool);
 	XN_IS_STATUS_OK(nRetVal);
 
 	pBufferPool->DecRef(pBuffer);
@@ -523,12 +403,12 @@ XnStatus XnServerSensorInvoker::ReadStream(XnStreamData* pStreamData, XnUInt32*
 	XnStatus nRetVal = XN_STATUS_OK;
 	
 	XnAutoCSLocker locker(m_hSensorLock);
-	SensorInvokerStream* pStream = NULL;
+	SensorInvokerStream* pStream;
 	nRetVal = m_streams.Get(pStreamData->StreamName, pStream);
 	XN_IS_STATUS_OK(nRetVal);
 
-	XnBufferPool* pBufferPool = NULL;
-	nRetVal = m_sensor.GetBufferPool(pStreamData->StreamName, &pBufferPool);
+	XnSharedMemoryBufferPool* pBufferPool = NULL;
+	nRetVal = m_sensor.GetSharedBufferPool(pStreamData->StreamName, &pBufferPool);
 	XN_IS_STATUS_OK(nRetVal);
 
 	// dec ref old data
@@ -550,44 +430,7 @@ XnStatus XnServerSensorInvoker::ReadStream(XnStreamData* pStreamData, XnUInt32*
 		pBufferPool->AddRef(pStreamData->pInternal->pLockedBuffer);
 	}
 
-	*pnOffset = pStreamData->pInternal->pLockedBuffer->GetData() - pStream->pSharedMemoryAddress;
-
-	return (XN_STATUS_OK);
-}
-
-XnStatus XnServerSensorInvoker::SetNumberOfBuffers(XnUInt32 nCount)
-{
-	XnStatus nRetVal = XN_STATUS_OK;
-
-	// This is a special property. It can only be changed BEFORE reading starts
-	if (m_sensor.HasReadingStarted() && nCount != m_numberOfBuffers.GetValue())
-	{
-		return (XN_STATUS_DEVICE_PROPERTY_READ_ONLY);
-	}
-
-	if (nCount < 3)
-	{
-		return XN_STATUS_BAD_PARAM;
-	}
-
-	nRetVal = m_numberOfBuffers.UnsafeUpdateValue(nCount);
-	XN_IS_STATUS_OK(nRetVal);
-
-	return (XN_STATUS_OK);
-}
-
-XnStatus XnServerSensorInvoker::SetAllowOtherUsers(XnBool bAllowOtherUsers)
-{
-	XnStatus nRetVal = XN_STATUS_OK;
-
-	// This is a special property. It can only be changed BEFORE reading starts
-	if (m_sensor.HasReadingStarted() && m_allowOtherUsers.GetValue() != bAllowOtherUsers)
-	{
-		return (XN_STATUS_DEVICE_PROPERTY_READ_ONLY);
-	}
-
-	nRetVal = m_allowOtherUsers.UnsafeUpdateValue(bAllowOtherUsers);
-	XN_IS_STATUS_OK(nRetVal);
+	*pnOffset = pBufferPool->GetBufferOffset(pStreamData->pInternal->pLockedBuffer);
 
 	return (XN_STATUS_OK);
 }
@@ -621,7 +464,7 @@ XnStatus XnServerSensorInvoker::OnPropertyChanged(const XnProperty* pProp)
 
 	// raise event
 	m_propChangedEvent.Raise(pProp);
-
+	
 	return (XN_STATUS_OK);
 }
 
@@ -638,7 +481,12 @@ XnStatus XnServerSensorInvoker::OnStreamAdded(const XnChar* StreamName)
 	nRetVal = RegisterToProps(&props);
 	XN_IS_STATUS_OK(nRetVal);
 
-	XnActualPropertiesHash* pStreamProps = props.pData->Begin()->Value();
+	XnActualPropertiesHash* pStreamProps = props.pData->begin().Value();
+
+	// take type
+	XnProperty* pProp = NULL;
+	nRetVal = pStreamProps->Get(XN_STREAM_PROPERTY_TYPE, pProp);
+	XN_IS_STATUS_OK(nRetVal);
 
 	// create stream data
 	SensorInvokerStream serverStream;
@@ -647,65 +495,15 @@ XnStatus XnServerSensorInvoker::OnStreamAdded(const XnChar* StreamName)
 
 	XN_VALIDATE_NEW(serverStream.pNewDataEvent, NewStreamDataEvent);
 
-	// check if this is a frame stream
-	XnProperty* pIsFrameBased;
-	nRetVal = pStreamProps->Get(XN_STREAM_PROPERTY_IS_FRAME_BASED, pIsFrameBased);
-	if (nRetVal == XN_STATUS_OK)
-	{
-		XnActualIntProperty* pIntProp = (XnActualIntProperty*)pIsFrameBased;
-		serverStream.bFrameStream = (pIntProp->GetValue() == TRUE);
-	}
-
-	if (serverStream.bFrameStream)
-	{
-		// create the "shared memory name" property
-		XN_VALIDATE_NEW(serverStream.pSharedMemoryName, XnActualStringProperty, XN_STREAM_PROPERTY_SHARED_BUFFER_NAME);
-
-		// and add it to the stream
-		XnDeviceStream* pStream;
-		nRetVal = m_sensor.GetStream(StreamName, &pStream);
-		if (nRetVal != XN_STATUS_OK)
-		{
-			XN_DELETE(serverStream.pNewDataEvent);
-			XN_DELETE(serverStream.pSharedMemoryName);
-			return nRetVal;
-		}
-
-		nRetVal = pStream->AddProperty(serverStream.pSharedMemoryName);
-		if (nRetVal != XN_STATUS_OK)
-		{
-			XN_DELETE(serverStream.pNewDataEvent);
-			XN_DELETE(serverStream.pSharedMemoryName);
-			return nRetVal;
-		}
-
-		// create a shared memory buffer pool for it
-		nRetVal = SetStreamSharedMemory(&serverStream);
-		if (nRetVal != XN_STATUS_OK)
-		{
-			XN_DELETE(serverStream.pNewDataEvent);
-			XN_DELETE(serverStream.pSharedMemoryName);
-			return nRetVal;
-		}
-	}
-
-	// create a stream data object for the stream
 	nRetVal = m_sensor.CreateStreamData(StreamName, &serverStream.pStreamData);
 	if (nRetVal != XN_STATUS_OK)
 	{
 		XN_DELETE(serverStream.pNewDataEvent);
-		XN_DELETE(serverStream.pSharedMemoryName);
 		return (nRetVal);
 	}
 
-	// and add it to our list of streams
 	nRetVal = m_streams.Set(StreamName, serverStream);
-	if (nRetVal != XN_STATUS_OK)
-	{
-		XN_DELETE(serverStream.pNewDataEvent);
-		XN_DELETE(serverStream.pSharedMemoryName);
-		return (nRetVal);
-	}
+	XN_IS_STATUS_OK(nRetVal);
 
 	return (XN_STATUS_OK);
 }
@@ -717,7 +515,7 @@ XnStatus XnServerSensorInvoker::OnStreamRemoved(const XnChar* StreamName)
 	// no need to unregister from its props - they do not exist anymore.
 
 	// remove stream data
-	SensorInvokerStream* pServerStream = NULL;
+	SensorInvokerStream* pServerStream;
 	nRetVal = m_streams.Get(StreamName, pServerStream);
 	XN_IS_STATUS_OK(nRetVal);
 
@@ -726,14 +524,6 @@ XnStatus XnServerSensorInvoker::OnStreamRemoved(const XnChar* StreamName)
 
 	XN_DELETE(pServerStream->pNewDataEvent);
 
-	if (pServerStream->pSharedMemoryName != NULL)
-	{
-		XN_DELETE(pServerStream->pSharedMemoryName);
-	}
-
-	// destroy shared memory
-	xnOSCloseSharedMemory(pServerStream->hSharedMemory);
-
 	nRetVal = m_streams.Remove(StreamName);
 	XN_IS_STATUS_OK(nRetVal);
 
@@ -771,7 +561,7 @@ XnStatus XnServerSensorInvoker::OnNewStreamData(const XnChar* StreamName)
 
 	// no need to lock the sensor (this might cause a dead lock).
 	// Instead, only lock the streams collection (so it wouldn't change while we search for the stream)
-	SensorInvokerStream* pStream = NULL;
+	SensorInvokerStream* pStream;
 	nRetVal = m_streams.Get(StreamName, pStream);
 	XN_IS_STATUS_OK(nRetVal);
 
@@ -802,9 +592,9 @@ XnStatus XnServerSensorInvoker::ReadStreams()
 	// lock sensor (we iterate over streams list. make sure no stream is added/removed from the list)
 	{
 		XnLockedServerStreamsHash lockedHash = m_streams.GetLockedHashForIterating();
-		for (XnLockedServerStreamsHash::Iterator it = lockedHash.Begin(); it != lockedHash.End(); ++it)
+		for (XnLockedServerStreamsHash::Iterator it = lockedHash.begin(); it != lockedHash.end(); ++it)
 		{
-			SensorInvokerStream& stream = it->Value();
+			SensorInvokerStream& stream = it.Value();
 
 			if (stream.bNewData)
 			{
@@ -823,11 +613,7 @@ XnStatus XnServerSensorInvoker::ReadStreams()
 
 				stream.bNewData = FALSE;
 
-				NewStreamDataEventArgs eventArgs;
-				eventArgs.strStreamName = stream.strType;
-				eventArgs.nTimestamp = stream.pStreamData->nTimestamp;
-				eventArgs.nFrameID = stream.pStreamData->nFrameID;
-				stream.pNewDataEvent->Raise(eventArgs);
+				stream.pNewDataEvent->Raise(stream.strType, stream.pStreamData->nTimestamp, stream.pStreamData->nFrameID);
 			}
 		} // streams loop
 	} // lock
@@ -835,18 +621,6 @@ XnStatus XnServerSensorInvoker::ReadStreams()
 	return (XN_STATUS_OK);
 }
 
-XnStatus XN_CALLBACK_TYPE XnServerSensorInvoker::SetNumberOfBuffersCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
-{
-	XnServerSensorInvoker* pThis = (XnServerSensorInvoker*)pCookie;
-	return pThis->SetNumberOfBuffers((XnUInt32)nValue);
-}
-
-XnStatus XN_CALLBACK_TYPE XnServerSensorInvoker::SetAllowOtherUsersCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie)
-{
-	XnServerSensorInvoker* pThis = (XnServerSensorInvoker*)pCookie;
-	return pThis->SetAllowOtherUsers(nValue == TRUE);
-}
-
 XnStatus XN_CALLBACK_TYPE XnServerSensorInvoker::PropertyChangedCallback(const XnProperty* pProp, void* pCookie)
 {
 	XnServerSensorInvoker* pThis = (XnServerSensorInvoker*)pCookie;
@@ -854,16 +628,16 @@ XnStatus XN_CALLBACK_TYPE XnServerSensorInvoker::PropertyChangedCallback(const X
 	return XN_STATUS_OK;
 }
 
-void XN_CALLBACK_TYPE XnServerSensorInvoker::StreamCollectionChangedCallback(const XnStreamCollectionChangedEventArgs& args, void* pCookie)
+void XN_CALLBACK_TYPE XnServerSensorInvoker::StreamCollectionChangedCallback(XnDeviceHandle /*DeviceHandle*/, const XnChar* StreamName, XnStreamsChangeEventType EventType, void* pCookie)
 {
 	XnServerSensorInvoker* pThis = (XnServerSensorInvoker*)pCookie;
-	pThis->OnStreamCollectionChanged(args.strStreamName, args.eventType);
+	pThis->OnStreamCollectionChanged(StreamName, EventType);
 }
 
-void XN_CALLBACK_TYPE XnServerSensorInvoker::NewStreamDataCallback(const XnNewStreamDataEventArgs& args, void* pCookie)
+void XN_CALLBACK_TYPE XnServerSensorInvoker::NewStreamDataCallback(XnDeviceHandle /*DeviceHandle*/, const XnChar* StreamName, void* pCookie)
 {
 	XnServerSensorInvoker* pThis = (XnServerSensorInvoker*)pCookie;
-	pThis->OnNewStreamData(args.strStreamName);
+	pThis->OnNewStreamData(StreamName);
 }
 
 XN_THREAD_PROC XnServerSensorInvoker::ReaderThread(XN_THREAD_PARAM pThreadParam)
diff --git a/Source/XnDeviceSensorV2/XnServerSensorInvoker.h b/Source/XnDeviceSensorV2/XnServerSensorInvoker.h
index 63e2c2e..dbeeb29 100644
--- a/Source/XnDeviceSensorV2/XnServerSensorInvoker.h
+++ b/Source/XnDeviceSensorV2/XnServerSensorInvoker.h
@@ -27,23 +27,16 @@
 //---------------------------------------------------------------------------
 #include "XnSensor.h"
 #include <XnGeneralBuffer.h>
-#include <XnEventT.h>
+#include <XnEvent.h>
 
 //---------------------------------------------------------------------------
 // Types
 //---------------------------------------------------------------------------
+
 class XnServerSensorInvoker
 {
-public:
-	typedef struct NewStreamDataEventArgs
-	{
-		const XnChar* strStreamName;
-		XnUInt64 nTimestamp;
-		XnUInt32 nFrameID;
-	} NewStreamDataEventArgs;
-
 private:
-	typedef XnEventT<NewStreamDataEventArgs> NewStreamDataEvent;
+	XN_DECLARE_EVENT_3ARG(NewStreamDataEvent, INewStreamDataEvent, const XnChar*, strStreamName, XnUInt64, nTimestamp, XnUInt32, nFrameID);
 
 public:
 	XnServerSensorInvoker();
@@ -75,8 +68,8 @@ public:
 	XnStatus GetStream(const XnChar* strType, const XnPropertySet* pInitialValues);
 	XnStatus ReleaseStream(const XnChar* strType);
 
-	typedef NewStreamDataEvent::HandlerPtr NewStreamDataHandler;
-	XnStatus OpenStream(const XnChar* strName, NewStreamDataHandler pNewDataHandler, void* pCookie, XnCallbackHandle& hCallback);
+	typedef INewStreamDataEvent::HandlerPtr NewStreamDataHandler;
+	XnStatus OpenStream(const XnChar* strName, NewStreamDataHandler pNewDataHandler, void* pCookie, XnCallbackHandle* phCallback);
 	XnStatus CloseStream(const XnChar* strName, XnCallbackHandle hCallback);
 
 	XnStatus AddRefFrameBuffer(const XnChar* strStreamName, XnBuffer* pBuffer);
@@ -84,8 +77,8 @@ public:
 
 	XnStatus ReadStream(XnStreamData* pStreamData, XnUInt32* pnOffset);
 
-	typedef XnEvent1Arg<const XnProperty*> PropChangeEvent;
-	PropChangeEvent::TInterface& PropChangedEvent() { return m_propChangedEvent; }
+	XN_DECLARE_EVENT_1ARG(PropChangeEvent, IPropChangeEvent, const XnProperty*, pProp);
+	IPropChangeEvent& PropChangedEvent() { return m_propChangedEvent; }
 
 private:
 	// Types
@@ -97,14 +90,9 @@ private:
 		XnStreamData* pStreamData;
 		XnBool bNewData;
 		NewStreamDataEvent* pNewDataEvent;
-		XnBool bFrameStream;
-		XN_SHARED_MEMORY_HANDLE hSharedMemory;
-		XnBool bAllowOtherUsers;
-		XnUChar* pSharedMemoryAddress;
-		XnActualStringProperty* pSharedMemoryName;
 	} SensorInvokerStream;
 
-	typedef XnStringsHashT<SensorInvokerStream> _XnServerStreamsHash;
+	XN_DECLARE_STRINGS_HASH(SensorInvokerStream, _XnServerStreamsHash);
 
 	class XnServerStreamsHash;
 
@@ -123,14 +111,14 @@ private:
 			return *this;
 		}
 
-		inline _XnServerStreamsHash::Iterator Begin()
+		inline _XnServerStreamsHash::Iterator begin()
 		{
-			return m_hash.Begin();
+			return m_hash.begin();
 		}
 
-		inline _XnServerStreamsHash::Iterator End()
+		inline _XnServerStreamsHash::Iterator end()
 		{
-			return m_hash.End();
+			return m_hash.end();
 		}
 
 		typedef _XnServerStreamsHash::Iterator Iterator;
@@ -193,22 +181,16 @@ private:
 	// Functions
 	XnStatus RegisterToProps(XnPropertySet* pProps);
 
-	XnStatus SetNumberOfBuffers(XnUInt32 nCount);
-	XnStatus SetAllowOtherUsers(XnBool bAllowOtherUsers);
 	XnStatus OnPropertyChanged(const XnProperty* pProp);
 	XnStatus OnStreamAdded(const XnChar* StreamName);
 	XnStatus OnStreamRemoved(const XnChar* StreamName);
 	XnStatus OnStreamCollectionChanged(const XnChar* StreamName, XnStreamsChangeEventType EventType);
 	XnStatus OnNewStreamData(const XnChar* StreamName);
 	XnStatus ReadStreams();
-	XnStatus SetStreamSharedMemory(SensorInvokerStream* pStream);
-	XnStatus GetStreamMaxResolution(SensorInvokerStream* pStream, XnUInt32& nMaxNumPixels);
 
-	static XnStatus XN_CALLBACK_TYPE SetNumberOfBuffersCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie);
-	static XnStatus XN_CALLBACK_TYPE SetAllowOtherUsersCallback(XnActualIntProperty* pSender, XnUInt64 nValue, void* pCookie);
 	static XnStatus XN_CALLBACK_TYPE PropertyChangedCallback(const XnProperty* pProp, void* pCookie);
-	static void XN_CALLBACK_TYPE StreamCollectionChangedCallback(const XnStreamCollectionChangedEventArgs& args, void* pCookie);
-	static void XN_CALLBACK_TYPE NewStreamDataCallback(const XnNewStreamDataEventArgs& args, void* pCookie);
+	static void XN_CALLBACK_TYPE StreamCollectionChangedCallback(XnDeviceHandle DeviceHandle, const XnChar* StreamName, XnStreamsChangeEventType EventType, void* pCookie);
+	static void XN_CALLBACK_TYPE NewStreamDataCallback(XnDeviceHandle DeviceHandle, const XnChar* StreamName, void* pCookie);
 	static XN_THREAD_PROC ReaderThread(XN_THREAD_PARAM pThreadParam);
 
 	// Members
@@ -219,9 +201,6 @@ private:
 	volatile XnBool m_bShouldRun;
 	XnStatus m_errorState;
 
-	XnActualIntProperty m_numberOfBuffers;
-	XnActualIntProperty m_allowOtherUsers;
-
 	PropChangeEvent m_propChangedEvent;
 	XnServerStreamsHash m_streams;
 };
diff --git a/Source/XnDeviceSensorV2/XnServerSession.cpp b/Source/XnDeviceSensorV2/XnServerSession.cpp
index 1b858f1..d128fa2 100644
--- a/Source/XnDeviceSensorV2/XnServerSession.cpp
+++ b/Source/XnDeviceSensorV2/XnServerSession.cpp
@@ -169,9 +169,9 @@ XnStatus XnServerSession::SendInitialState()
 
 XnStatus XnServerSession::FindStreamByServerName(const XnChar* strName, SessionStream** ppStream)
 {
-	for (SessionStreamsHash::Iterator it = m_streamsHash.Begin(); it != m_streamsHash.End(); ++it)
+	for (SessionStreamsHash::Iterator it = m_streamsHash.begin(); it != m_streamsHash.end(); ++it)
 	{
-		SessionStream* pStream = &it->Value();
+		SessionStream* pStream = &it.Value();
 		if (strcmp(pStream->strStreamName, strName) == 0)
 		{
 			*ppStream = pStream;
@@ -206,8 +206,6 @@ XnStatus XnServerSession::HandleOpenSensor()
 	// if an error occurred, send it to the client
 	if (nActionResult != XN_STATUS_OK)
 	{
-		xnLogWarning(XN_MASK_SENSOR_SERVER, "Client %u failed to open sensor '%s': %s", m_nID, strConnectionString, xnGetStatusString(nActionResult));
-
 		nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nActionResult);
 		XN_IS_STATUS_OK(nRetVal);
 	}
@@ -222,7 +220,7 @@ XnStatus XnServerSession::OpenSensorImpl(const XnChar* strConnectionString)
 	nRetVal = m_pSensorsManager->GetSensor(strConnectionString, &m_pSensor);
 	XN_IS_STATUS_OK(nRetVal);
 
-	nRetVal = m_pSensor->PropChangedEvent().Register(PropertyChangedCallback, this, m_hProprtyChangeCallback);
+	nRetVal = m_pSensor->PropChangedEvent().Register(PropertyChangedCallback, this, &m_hProprtyChangeCallback);
 	XN_IS_STATUS_OK(nRetVal);
 	
 	return (XN_STATUS_OK);
@@ -241,12 +239,12 @@ XnStatus XnServerSession::CloseSensorImpl()
 
 	// release all streams
 	XnAutoCSLocker locker(m_hStreamsLock);
-	SessionStreamsHash::Iterator it = m_streamsHash.Begin();
-	while (it != m_streamsHash.End())
+	SessionStreamsHash::Iterator it = m_streamsHash.begin();
+	while (it != m_streamsHash.end())
 	{
 		SessionStreamsHash::Iterator curr = it;
 		++it;
-		const XnChar* strName = curr->Key();
+		const XnChar* strName = curr.Key();
 		if (strcmp(strName, XN_MODULE_NAME_DEVICE) != 0)
 		{
 			RemoveStreamImpl(strName);
@@ -280,10 +278,6 @@ XnStatus XnServerSession::HandleSetIntProperty()
 	XN_IS_STATUS_OK(nRetVal);
 
 	XnStatus nActionResult = SetIntPropertyImpl(strModule, strProp, nValue);
-	if (nActionResult != XN_STATUS_OK)
-	{
-		xnLogWarning(XN_MASK_SENSOR_SERVER, "Client %u failed to set property '%s.%s': %s", m_nID, strModule, strProp, xnGetStatusString(nActionResult));
-	}
 	
 	nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nActionResult);
 	XN_IS_STATUS_OK(nRetVal);
@@ -297,7 +291,7 @@ XnStatus XnServerSession::SetIntPropertyImpl(const XnChar* strModule, const XnCh
 	
 	xnLogVerbose(XN_MASK_SENSOR_SERVER, "Client %u requested to set %s.%s", m_nID, strModule, strProp);
 
-	SessionStream* pStream = NULL;
+	SessionStream* pStream;
 	nRetVal = m_streamsHash.Get(strModule, pStream);
 	XN_IS_STATUS_OK(nRetVal);
 
@@ -319,10 +313,6 @@ XnStatus XnServerSession::HandleSetRealProperty()
 	XN_IS_STATUS_OK(nRetVal);
 
 	XnStatus nActionResult = SetRealPropertyImpl(strModule, strProp, dValue);
-	if (nActionResult != XN_STATUS_OK)
-	{
-		xnLogWarning(XN_MASK_SENSOR_SERVER, "Client %u failed to set property '%s.%s': %s", m_nID, strModule, strProp, xnGetStatusString(nActionResult));
-	}
 
 	nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nActionResult);
 	XN_IS_STATUS_OK(nRetVal);
@@ -336,7 +326,7 @@ XnStatus XnServerSession::SetRealPropertyImpl(const XnChar* strModule, const XnC
 
 	xnLogVerbose(XN_MASK_SENSOR_SERVER, "Client %u requested to set %s.%s", m_nID, strModule, strProp);
 
-	SessionStream* pStream = NULL;
+	SessionStream* pStream;
 	nRetVal = m_streamsHash.Get(strModule, pStream);
 	XN_IS_STATUS_OK(nRetVal);
 
@@ -358,11 +348,7 @@ XnStatus XnServerSession::HandleSetStringProperty()
 	XN_IS_STATUS_OK(nRetVal);
 
 	XnStatus nActionResult = SetStringPropertyImpl(strModule, strProp, strValue);
-	if (nActionResult != XN_STATUS_OK)
-	{
-		xnLogWarning(XN_MASK_SENSOR_SERVER, "Client %u failed to set property '%s.%s': %s", m_nID, strModule, strProp, xnGetStatusString(nActionResult));
-	}
-
+	
 	nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nActionResult);
 	XN_IS_STATUS_OK(nRetVal);
 
@@ -375,7 +361,7 @@ XnStatus XnServerSession::SetStringPropertyImpl(const XnChar* strModule, const X
 	
 	xnLogVerbose(XN_MASK_SENSOR_SERVER, "Client %u requested to set %s.%s", m_nID, strModule, strProp);
 
-	SessionStream* pStream = NULL;
+	SessionStream* pStream;
 	nRetVal = m_streamsHash.Get(strModule, pStream);
 	XN_IS_STATUS_OK(nRetVal);
 
@@ -397,10 +383,6 @@ XnStatus XnServerSession::HandleSetGeneralProperty()
 	XN_IS_STATUS_OK(nRetVal);
 
 	XnStatus nActionResult = SetGeneralPropertyImpl(strModule, strProp, gbValue);
-	if (nActionResult != XN_STATUS_OK)
-	{
-		xnLogWarning(XN_MASK_SENSOR_SERVER, "Client %u failed to set property '%s.%s': %s", m_nID, strModule, strProp, xnGetStatusString(nActionResult));
-	}
 
 	nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nActionResult);
 	XN_IS_STATUS_OK(nRetVal);
@@ -414,7 +396,7 @@ XnStatus XnServerSession::SetGeneralPropertyImpl(const XnChar* strModule, const
 	
 	xnLogVerbose(XN_MASK_SENSOR_SERVER, "Client %u requested to set %s.%s", m_nID, strModule, strProp);
 
-	SessionStream* pStream = NULL;
+	SessionStream* pStream;
 	nRetVal = m_streamsHash.Get(strModule, pStream);
 	XN_IS_STATUS_OK(nRetVal);
 
@@ -441,10 +423,6 @@ XnStatus XnServerSession::HandleGetIntProperty()
 	// get
 	XnUInt64 nValue;
 	XnStatus nActionResult = GetIntPropertyImpl(request.strModuleName, request.strPropertyName, &nValue);
-	if (nActionResult != XN_STATUS_OK)
-	{
-		xnLogWarning(XN_MASK_SENSOR_SERVER, "Client %u failed to get property '%s.%s': %s", m_nID, request.strModuleName, request.strPropertyName, xnGetStatusString(nActionResult));
-	}
 
 	nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_GET_INT_PROPERTY, nActionResult, sizeof(nValue), &nValue);
 	XN_IS_STATUS_OK(nRetVal);
@@ -456,7 +434,7 @@ XnStatus XnServerSession::GetIntPropertyImpl(const XnChar* strModule, const XnCh
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 	
-	SessionStream* pStream = NULL;
+	SessionStream* pStream;
 	nRetVal = m_streamsHash.Get(strModule, pStream);
 	XN_IS_STATUS_OK(nRetVal);
 
@@ -483,10 +461,6 @@ XnStatus XnServerSession::HandleGetRealProperty()
 	// get
 	XnDouble dValue;
 	XnStatus nActionResult = GetRealPropertyImpl(request.strModuleName, request.strPropertyName, &dValue);
-	if (nActionResult != XN_STATUS_OK)
-	{
-		xnLogWarning(XN_MASK_SENSOR_SERVER, "Client %u failed to get property '%s.%s': %s", m_nID, request.strModuleName, request.strPropertyName, xnGetStatusString(nActionResult));
-	}
 
 	nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_GET_REAL_PROPERTY, nActionResult, sizeof(dValue), &dValue);
 	XN_IS_STATUS_OK(nRetVal);
@@ -498,7 +472,7 @@ XnStatus XnServerSession::GetRealPropertyImpl(const XnChar* strModule, const XnC
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 
-	SessionStream* pStream = NULL;
+	SessionStream* pStream;
 	nRetVal = m_streamsHash.Get(strModule, pStream);
 	XN_IS_STATUS_OK(nRetVal);
 
@@ -525,10 +499,6 @@ XnStatus XnServerSession::HandleGetStringProperty()
 	// get
 	XnChar strValue[XN_DEVICE_MAX_STRING_LENGTH];
 	XnStatus nActionResult = GetStringPropertyImpl(request.strModuleName, request.strPropertyName, strValue);
-	if (nActionResult != XN_STATUS_OK)
-	{
-		xnLogWarning(XN_MASK_SENSOR_SERVER, "Client %u failed to get property '%s.%s': %s", m_nID, request.strModuleName, request.strPropertyName, xnGetStatusString(nActionResult));
-	}
 
 	nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_GET_STRING_PROPERTY, nActionResult, sizeof(strValue), strValue);
 	XN_IS_STATUS_OK(nRetVal);
@@ -540,7 +510,7 @@ XnStatus XnServerSession::GetStringPropertyImpl(const XnChar* strModule, const X
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 
-	SessionStream* pStream = NULL;
+	SessionStream* pStream;
 	nRetVal = m_streamsHash.Get(strModule, pStream);
 	XN_IS_STATUS_OK(nRetVal);
 
@@ -570,10 +540,6 @@ XnStatus XnServerSession::HandleGetGeneralProperty()
 	// get
 	XnGeneralBuffer gbValue = XnGeneralBufferPack(pData, pRequest->nSize);
 	XnStatus nActionResult = GetGeneralPropertyImpl(pRequest->strModuleName, pRequest->strPropertyName, gbValue);
-	if (nActionResult != XN_STATUS_OK)
-	{
-		xnLogWarning(XN_MASK_SENSOR_SERVER, "Client %u failed to get property '%s.%s': %s", m_nID, pRequest->strModuleName, pRequest->strPropertyName, xnGetStatusString(nActionResult));
-	}
 
 	nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_GET_GENERAL_PROPERTY, nActionResult, pRequest->nSize, pData);
 	XN_IS_STATUS_OK(nRetVal);
@@ -585,7 +551,7 @@ XnStatus XnServerSession::GetGeneralPropertyImpl(const XnChar* strModule, const
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 
-	SessionStream* pStream = NULL;
+	SessionStream* pStream;
 	nRetVal = m_streamsHash.Get(strModule, pStream);
 	XN_IS_STATUS_OK(nRetVal);
 
@@ -612,10 +578,6 @@ XnStatus XnServerSession::HandleConfigFromINIFile()
 
 	// load
 	XnStatus nActionResult = ConfigFromINIFileImpl(message.strFileName, message.strSectionName);
-	if (nActionResult != XN_STATUS_OK)
-	{
-		xnLogWarning(XN_MASK_SENSOR_SERVER, "Client %u failed to config sensor from file '%s': %s", m_nID, message.strFileName, xnGetStatusString(nActionResult));
-	}
 
 	nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nActionResult);
 	XN_IS_STATUS_OK(nRetVal);
@@ -639,10 +601,6 @@ XnStatus XnServerSession::HandleBatchConfig()
 	XN_IS_STATUS_OK(nRetVal);
 
 	XnStatus nActionResult = BatchConfigImpl(&props);
-	if (nActionResult != XN_STATUS_OK)
-	{
-		xnLogWarning(XN_MASK_SENSOR_SERVER, "Client %u failed to batch config: %s", m_nID, xnGetStatusString(nActionResult));
-	}
 
 	nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nActionResult);
 	XN_IS_STATUS_OK(nRetVal);
@@ -657,13 +615,13 @@ XnStatus XnServerSession::BatchConfigImpl(const XnPropertySet* pProps)
 	xnLogVerbose(XN_MASK_SENSOR_SERVER, "Client %u requested a batch config", m_nID);
 
 	XN_PROPERTY_SET_CREATE_ON_STACK(serverProps);
-	for (XnPropertySetData::Iterator it = pProps->pData->Begin(); it != pProps->pData->End(); ++it)
+	for (XnPropertySetData::Iterator it = pProps->pData->begin(); it != pProps->pData->end(); ++it)
 	{
-		SessionStream* pStream = NULL;
-		nRetVal = m_streamsHash.Get(it->Key(), pStream);
+		SessionStream* pStream;
+		nRetVal = m_streamsHash.Get(it.Key(), pStream);
 		XN_IS_STATUS_OK(nRetVal);
 
-		nRetVal = XnPropertySetCloneModule(pProps, &serverProps, it->Key(), pStream->strStreamName);
+		nRetVal = XnPropertySetCloneModule(pProps, &serverProps, it.Key(), pStream->strStreamName);
 		XN_IS_STATUS_OK(nRetVal);
 	}
 
@@ -686,16 +644,12 @@ XnStatus XnServerSession::HandleNewStream()
 	XN_IS_STATUS_OK(nRetVal);
 
 	XnPropertySet* pInitialValues = &props;
-	if (props.pData->Begin() == props.pData->End())
+	if (props.pData->begin() == props.pData->end())
 	{
 		pInitialValues = NULL;
 	}
 
 	XnStatus nActionResult = NewStreamImpl(strType, strName, pInitialValues);
-	if (nActionResult != XN_STATUS_OK)
-	{
-		xnLogWarning(XN_MASK_SENSOR_SERVER, "Client %u failed to create stream of type '%s': %s", m_nID, strType, xnGetStatusString(nActionResult));
-	}
 
 	nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nActionResult);
 	XN_IS_STATUS_OK(nRetVal);
@@ -767,10 +721,6 @@ XnStatus XnServerSession::HandleRemoveStream()
 
 	xnLogVerbose(XN_MASK_SENSOR_SERVER, "Client %u requested to remove stream %s", m_nID, strName);
 	XnStatus nActionResult = RemoveStreamImpl(strName);
-	if (nActionResult != XN_STATUS_OK)
-	{
-		xnLogWarning(XN_MASK_SENSOR_SERVER, "Client %u failed to remove stream '%s': %s", m_nID, strName, xnGetStatusString(nActionResult));
-	}
 
 	nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nActionResult);
 	XN_IS_STATUS_OK(nRetVal);
@@ -782,7 +732,7 @@ XnStatus XnServerSession::RemoveStreamImpl(const XnChar* strName)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 
-	SessionStream* pStream = NULL;
+	SessionStream* pStream;
 	nRetVal = m_streamsHash.Get(strName, pStream);
 	XN_IS_STATUS_OK(nRetVal);
 
@@ -832,10 +782,6 @@ XnStatus XnServerSession::HandleOpenStream()
 	XN_IS_STATUS_OK(nRetVal);
 
 	XnStatus nActionResult = OpenStreamImpl(strStreamName);
-	if (nActionResult != XN_STATUS_OK)
-	{
-		xnLogWarning(XN_MASK_SENSOR_SERVER, "Client %u failed to open stream '%s': %s", m_nID, strStreamName, xnGetStatusString(nActionResult));
-	}
 
 	nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nActionResult);
 	XN_IS_STATUS_OK(nRetVal);
@@ -848,13 +794,13 @@ XnStatus XnServerSession::OpenStreamImpl(const XnChar* strName)
 	XnStatus nRetVal = XN_STATUS_OK;
 	
 	xnLogVerbose(XN_MASK_SENSOR_SERVER, "Client %u requested to open stream %s", m_nID, strName);
-	SessionStream* pStream = NULL;
+	SessionStream* pStream;
 	nRetVal = m_streamsHash.Get(strName, pStream);
 	XN_IS_STATUS_OK(nRetVal);
 
 	if (!pStream->bIsOpen)
 	{
-		nRetVal = m_pSensor->OpenStream(pStream->strStreamName, StreamNewDataCallback, pStream, pStream->hNewDataCallback);
+		nRetVal = m_pSensor->OpenStream(pStream->strStreamName, StreamNewDataCallback, pStream, &pStream->hNewDataCallback);
 		XN_IS_STATUS_OK(nRetVal);
 		pStream->bIsOpen = TRUE;
 	}
@@ -874,10 +820,6 @@ XnStatus XnServerSession::HandleCloseStream()
 	XN_IS_STATUS_OK(nRetVal);
 
 	XnStatus nActionResult = CloseStreamImpl(strStreamName);
-	if (nActionResult != XN_STATUS_OK)
-	{
-		xnLogWarning(XN_MASK_SENSOR_SERVER, "Client %u failed to close stream '%s': %s", m_nID, strStreamName, xnGetStatusString(nActionResult));
-	}
 
 	nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nActionResult);
 	XN_IS_STATUS_OK(nRetVal);
@@ -890,7 +832,7 @@ XnStatus XnServerSession::CloseStreamImpl(const XnChar* strName)
 	XnStatus nRetVal = XN_STATUS_OK;
 
 	xnLogVerbose(XN_MASK_SENSOR_SERVER, "Client %u requested to close stream %s", m_nID, strName);
-	SessionStream* pStream = NULL;
+	SessionStream* pStream;
 	nRetVal = m_streamsHash.Get(strName, pStream);
 	XN_IS_STATUS_OK(nRetVal);
 
@@ -924,8 +866,6 @@ XnStatus XnServerSession::HandleReadStream()
 	}
 	else
 	{
-		xnLogWarning(XN_MASK_SENSOR_SERVER, "Client %u failed to read stream '%s': %s", m_nID, strStreamName, xnGetStatusString(nActionResult));
-
 		nRetVal = SendReply(XN_SENSOR_SERVER_MESSAGE_GENERAL_OP_RESPOND, nActionResult);
 		XN_IS_STATUS_OK(nRetVal);
 	}
@@ -937,7 +877,7 @@ XnStatus XnServerSession::ReadStreamImpl(const XnChar* strName, XnSensorServerRe
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 	
-	SessionStream* pStream = NULL;
+	SessionStream* pStream;
 	nRetVal = m_streamsHash.Get(strName, pStream);
 	XN_IS_STATUS_OK(nRetVal);
 
@@ -1163,7 +1103,7 @@ XnStatus XnServerSession::RemoveSessionModule(const XnChar* clientName)
 {
 	XnStatus nRetVal = XN_STATUS_OK;
 	
-	SessionStream* pStream = NULL;
+	SessionStream* pStream;
 	nRetVal = m_streamsHash.Get(clientName, pStream);
 	if (nRetVal == XN_STATUS_OK)
 	{
@@ -1252,10 +1192,10 @@ void XN_CALLBACK_TYPE XnServerSession::PropertyChangedCallback(const XnProperty*
 	pThis->OnPropertyChanged(pProp);
 }
 
-void XN_CALLBACK_TYPE XnServerSession::StreamNewDataCallback(const XnServerSensorInvoker::NewStreamDataEventArgs& args, void* pCookie)
+void XN_CALLBACK_TYPE XnServerSession::StreamNewDataCallback(const XnChar* /*strName*/, XnUInt64 nTimestamp, XnUInt32 nFrameID, void* pCookie)
 {
 	SessionStream* pStream = (SessionStream*)pCookie;
-	pStream->pSession->OnNewData(pStream, args.nTimestamp, args.nFrameID);
+	pStream->pSession->OnNewData(pStream, nTimestamp, nFrameID);
 }
 
 XN_THREAD_PROC XnServerSession::ServeThreadCallback(XN_THREAD_PARAM pThreadParam)
diff --git a/Source/XnDeviceSensorV2/XnServerSession.h b/Source/XnDeviceSensorV2/XnServerSession.h
index 3068936..85e9fd9 100644
--- a/Source/XnDeviceSensorV2/XnServerSession.h
+++ b/Source/XnDeviceSensorV2/XnServerSession.h
@@ -30,7 +30,7 @@
 #include <XnIONetworkStream.h>
 #include "XnSensorClientServer.h"
 #include "XnServerLogger.h"
-#include <XnStringsHashT.h>
+#include <XnStringsHash.h>
 
 //---------------------------------------------------------------------------
 // Types
@@ -59,7 +59,7 @@ private:
 		XnCallbackHandle hNewDataCallback;
 	} SessionStream;
 
-	typedef XnStringsHashT<SessionStream> SessionStreamsHash;
+	XN_DECLARE_STRINGS_HASH(SessionStream, SessionStreamsHash);
 
 	// Functions
 	XnStatus SendReply(XnSensorServerCustomMessages Type, XnStatus nRC, XnUInt32 nDataSize = 0, void* pAdditionalData = NULL);
@@ -113,7 +113,7 @@ private:
 	XnStatus ServeThread();
 
 	static void XN_CALLBACK_TYPE PropertyChangedCallback(const XnProperty* pProp, void* pCookie);
-	static void XN_CALLBACK_TYPE StreamNewDataCallback(const XnServerSensorInvoker::NewStreamDataEventArgs& args, void* pCookie);
+	static void XN_CALLBACK_TYPE StreamNewDataCallback(const XnChar* strName, XnUInt64 nTimestamp, XnUInt32 nFrameID, void* pCookie);
 	static XN_THREAD_PROC ServeThreadCallback(XN_THREAD_PARAM pThreadParam);
 
 	// Members
diff --git a/Source/XnDeviceSensorV2/XnSharedMemoryBufferPool.cpp b/Source/XnDeviceSensorV2/XnSharedMemoryBufferPool.cpp
new file mode 100644
index 0000000..87a0ee0
--- /dev/null
+++ b/Source/XnDeviceSensorV2/XnSharedMemoryBufferPool.cpp
@@ -0,0 +1,127 @@
+/****************************************************************************
+*                                                                           *
+*  PrimeSense Sensor 5.x Alpha                                              *
+*  Copyright (C) 2011 PrimeSense Ltd.                                       *
+*                                                                           *
+*  This file is part of PrimeSense Sensor.                                  *
+*                                                                           *
+*  PrimeSense Sensor is free software: you can redistribute it and/or modify*
+*  it under the terms of the GNU Lesser General Public License as published *
+*  by the Free Software Foundation, either version 3 of the License, or     *
+*  (at your option) any later version.                                      *
+*                                                                           *
+*  PrimeSense Sensor is distributed in the hope that it will be useful,     *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the             *
+*  GNU Lesser General Public License for more details.                      *
+*                                                                           *
+*  You should have received a copy of the GNU Lesser General Public License *
+*  along with PrimeSense Sensor. If not, see <http://www.gnu.org/licenses/>.*
+*                                                                           *
+****************************************************************************/
+//---------------------------------------------------------------------------
+// Includes
+//---------------------------------------------------------------------------
+#include "XnSharedMemoryBufferPool.h"
+
+//---------------------------------------------------------------------------
+// Code
+//---------------------------------------------------------------------------
+
+XnSharedMemoryBufferPool::XnSharedMemoryBufferPool(XnUInt32 nBufferCount, const XnChar* strDeviceName, const XnChar* strStreamName, XnUInt32 nMaxBufferSize, XnBool bAllowOtherUsers) :
+	XnBufferPool(nBufferCount),
+	m_nMaxBufferSize(nMaxBufferSize),
+	m_bAllowOtherUsers(bAllowOtherUsers),
+	m_hSharedMemory(NULL),
+	m_pSharedMemoryAddress(NULL)
+{
+	// to make the name unique, we'll add process ID
+	XN_PROCESS_ID procID;
+	xnOSGetCurrentProcessID(&procID);
+	sprintf(m_strName, "%u_%s_%s", (XnUInt32)procID, strDeviceName, strStreamName);
+}
+
+XnSharedMemoryBufferPool::~XnSharedMemoryBufferPool()
+{
+	XnSharedMemoryBufferPool::Free();
+}
+
+XnStatus XnSharedMemoryBufferPool::AllocateBuffers()
+{
+	XnStatus nRetVal = XN_STATUS_OK;
+	
+	if (m_nBufferSize > m_nMaxBufferSize)
+	{
+		return XN_STATUS_ALLOC_FAILED;
+	}
+
+	if (m_pSharedMemoryAddress != NULL)
+	{
+		// already allocated. nothing to do here
+		return (XN_STATUS_OK);
+	}
+
+	// first time. allocate shared memory
+	XnUInt32 nTotalSize = m_nMaxBufferSize * m_nBufferCount;
+	nRetVal = xnOSCreateSharedMemoryEx(m_strName, nTotalSize, XN_OS_FILE_READ | XN_OS_FILE_WRITE, m_bAllowOtherUsers, &m_hSharedMemory);
+	XN_IS_STATUS_OK(nRetVal);
+
+	void* pAddress;
+	nRetVal = xnOSSharedMemoryGetAddress(m_hSharedMemory, &pAddress);
+	if (nRetVal != XN_STATUS_OK)
+	{
+		xnOSCloseSharedMemory(m_hSharedMemory);
+		m_hSharedMemory = NULL;
+		return (nRetVal);
+	}
+
+	m_pSharedMemoryAddress = (XnUChar*)pAddress;
+
+	// now allocate buffers
+	for (XnUInt32 i = 0; i < m_nBufferCount; ++i)
+	{
+		XnBufferInPool* pBuffer = XN_NEW(XnBufferInPool);
+		if (pBuffer == NULL)
+		{
+			Free();
+			return (XN_STATUS_ALLOC_FAILED);
+		}
+
+		pBuffer->m_nID = i;
+
+		pBuffer->SetExternalBuffer(m_pSharedMemoryAddress + i*m_nMaxBufferSize, m_nMaxBufferSize);
+
+		xnDumpFileWriteString(Dump(), "Allocated buffer %u with size %u\n", i, m_nMaxBufferSize);
+
+		// add it to free list
+		m_AllBuffers.AddLast(pBuffer);
+		m_FreeBuffers.AddLast(pBuffer);
+	}
+
+	return (XN_STATUS_OK);
+}
+
+void XnSharedMemoryBufferPool::DestroyBuffer(XnBufferInPool* pBuffer)
+{
+	// simply add it back to free list
+	m_FreeBuffers.AddLast(pBuffer);
+}
+
+void XnSharedMemoryBufferPool::Free()
+{
+	if (m_hSharedMemory != NULL)
+	{
+		xnOSCloseSharedMemory(m_hSharedMemory);
+		m_hSharedMemory = NULL;
+	}
+
+	for (XnBuffersList::Iterator it = m_AllBuffers.begin(); it != m_AllBuffers.end(); ++it)
+	{
+		XnBufferInPool* pBuffer = *it;
+		XN_DELETE(pBuffer);
+	}
+
+	m_AllBuffers.Clear();
+	m_FreeBuffers.Clear();
+	XnBufferPool::Free();
+}
diff --git a/Source/XnDDK/XnExternalBufferPool.h b/Source/XnDeviceSensorV2/XnSharedMemoryBufferPool.h
similarity index 69%
rename from Source/XnDDK/XnExternalBufferPool.h
rename to Source/XnDeviceSensorV2/XnSharedMemoryBufferPool.h
index f44e0b2..9f3f435 100644
--- a/Source/XnDDK/XnExternalBufferPool.h
+++ b/Source/XnDeviceSensorV2/XnSharedMemoryBufferPool.h
@@ -19,34 +19,39 @@
 *  along with PrimeSense Sensor. If not, see <http://www.gnu.org/licenses/>.*
 *                                                                           *
 ****************************************************************************/
-#ifndef _XN_EXTERNAL_BUFFER_POOL_H_
-#define _XN_EXTERNAL_BUFFER_POOL_H_ 
+#ifndef __XN_SHARED_MEMORY_BUFFER_POOL_H__
+#define __XN_SHARED_MEMORY_BUFFER_POOL_H__
 
 //---------------------------------------------------------------------------
 // Includes
 //---------------------------------------------------------------------------
 #include <XnDDK/XnBufferPool.h>
-#include <XnArray.h>
-#include <XnGeneralBuffer.h>
 
 //---------------------------------------------------------------------------
 // Types
 //---------------------------------------------------------------------------
-class XnExternalBufferPool : public XnBufferPool
+class XnSharedMemoryBufferPool : public XnBufferPool
 {
 public:
-	XnExternalBufferPool();
-	~XnExternalBufferPool();
+	XnSharedMemoryBufferPool(XnUInt32 nBufferCount, const XnChar* strDeviceName, const XnChar* strStreamName, XnUInt32 nMaxBufferSize, XnBool bAllowOtherUsers);
+	~XnSharedMemoryBufferPool();
 
-	XnStatus SetBuffers(XnUInt32 nCount, const XnGeneralBuffer* aBuffers);
+	void Free();
+
+	inline const XnChar* GetSharedMemoryName() const { return m_strName; }
+
+	inline XnUInt32 GetBufferOffset(XnBuffer* pBuffer) const { return (XnUInt32)((XnUChar*)pBuffer->GetData() - m_pSharedMemoryAddress); }
 
 protected:
-	virtual XnStatus AllocateBuffers(XnUInt32 nSize);
-	virtual void DestroyBuffer(void* pBuffer);
+	virtual XnStatus AllocateBuffers();
+	virtual void DestroyBuffer(XnBufferInPool* pBuffer);
 
 private:
-	XnArray<XnGeneralBuffer> m_buffers;
+	XnChar m_strName[XN_FILE_MAX_PATH];
+	XnUInt32 m_nMaxBufferSize;
+	XnBool m_bAllowOtherUsers;
+	XN_SHARED_MEMORY_HANDLE m_hSharedMemory;
+	XnUChar* m_pSharedMemoryAddress;
 };
 
-
-#endif // _XN_EXTERNAL_BUFFER_POOL_H_
\ No newline at end of file
+#endif // __XN_SHARED_MEMORY_BUFFER_POOL_H__
\ No newline at end of file
diff --git a/Source/XnDeviceSensorV2/XnUncompressedBayerProcessor.cpp b/Source/XnDeviceSensorV2/XnUncompressedBayerProcessor.cpp
index 9052314..5f611e2 100644
--- a/Source/XnDeviceSensorV2/XnUncompressedBayerProcessor.cpp
+++ b/Source/XnDeviceSensorV2/XnUncompressedBayerProcessor.cpp
@@ -31,8 +31,8 @@
 // Code
 //---------------------------------------------------------------------------
 
-XnUncompressedBayerProcessor::XnUncompressedBayerProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper, XnFrameBufferManager* pBufferManager) :
-	XnImageProcessor(pStream, pHelper, pBufferManager)
+XnUncompressedBayerProcessor::XnUncompressedBayerProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper) :
+	XnImageProcessor(pStream, pHelper)
 {
 }
 
diff --git a/Source/XnDeviceSensorV2/XnUncompressedBayerProcessor.h b/Source/XnDeviceSensorV2/XnUncompressedBayerProcessor.h
index f0e7047..7590da8 100644
--- a/Source/XnDeviceSensorV2/XnUncompressedBayerProcessor.h
+++ b/Source/XnDeviceSensorV2/XnUncompressedBayerProcessor.h
@@ -34,7 +34,7 @@
 class XnUncompressedBayerProcessor : public XnImageProcessor
 {
 public:
-	XnUncompressedBayerProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper, XnFrameBufferManager* pBufferManager);
+	XnUncompressedBayerProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper);
 	~XnUncompressedBayerProcessor();
 
 	XnStatus Init();
diff --git a/Source/XnDeviceSensorV2/XnUncompressedDepthProcessor.cpp b/Source/XnDeviceSensorV2/XnUncompressedDepthProcessor.cpp
index 17680f8..9576b37 100644
--- a/Source/XnDeviceSensorV2/XnUncompressedDepthProcessor.cpp
+++ b/Source/XnDeviceSensorV2/XnUncompressedDepthProcessor.cpp
@@ -29,8 +29,8 @@
 // Code
 //---------------------------------------------------------------------------
 
-XnUncompressedDepthProcessor::XnUncompressedDepthProcessor(XnSensorDepthStream* pStream, XnSensorStreamHelper* pHelper, XnFrameBufferManager* pBufferManager) :
-	XnDepthProcessor(pStream, pHelper, pBufferManager)
+XnUncompressedDepthProcessor::XnUncompressedDepthProcessor(XnSensorDepthStream* pStream, XnSensorStreamHelper* pHelper) :
+	XnDepthProcessor(pStream, pHelper)
 {
 }
 
@@ -45,8 +45,8 @@ void XnUncompressedDepthProcessor::ProcessFramePacketChunk(const XnSensorProtoco
 	// when depth is uncompressed, we can just copy it directly to write buffer
 	XnBuffer* pWriteBuffer = GetWriteBuffer();
 
-	// Check there is enough room for the depth pixels
-	if (CheckDepthBufferForOverflow(nDataSize))
+	// make sure we have enough room
+	if (CheckWriteBufferForOverflow(nDataSize))
 	{
 		// sometimes, when packets are lost, we get uneven number of bytes, so we need to complete
 		// one byte, in order to keep UINT16 alignment
@@ -59,20 +59,13 @@ void XnUncompressedDepthProcessor::ProcessFramePacketChunk(const XnSensorProtoco
 		// copy values. Make sure we do not get corrupted shifts
 		XnUInt16* pRaw = (XnUInt16*)(pData);
 		XnUInt16* pRawEnd = (XnUInt16*)(pData + nDataSize);
-		XnDepthPixel* pDepthBuf = GetDepthOutputBuffer();
-		XnDepthPixel* pShiftBuf = GetShiftsOutputBuffer();
+		XnDepthPixel* pWriteBuf = (XnDepthPixel*)pWriteBuffer->GetUnsafeWritePointer();
 
-		XnUInt16 shift;
 		while (pRaw < pRawEnd)
 		{
-			shift = (((*pRaw) < (XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1)) ? (*pRaw) : 0);
-			*pShiftBuf = shift;
-			*pDepthBuf = GetOutput(shift);
-
+			*pWriteBuf = GetOutput(XN_MIN(*pRaw, XN_DEVICE_SENSOR_MAX_SHIFT_VALUE-1));
 			++pRaw;
-			++pDepthBuf;
-			++pShiftBuf;
-
+			++pWriteBuf;
 		}
 
  		pWriteBuffer->UnsafeUpdateSize(nDataSize);
@@ -80,4 +73,3 @@ void XnUncompressedDepthProcessor::ProcessFramePacketChunk(const XnSensorProtoco
 
 	XN_PROFILING_END_SECTION
 }
-
diff --git a/Source/XnDeviceSensorV2/XnUncompressedDepthProcessor.h b/Source/XnDeviceSensorV2/XnUncompressedDepthProcessor.h
index 90b57a0..043558e 100644
--- a/Source/XnDeviceSensorV2/XnUncompressedDepthProcessor.h
+++ b/Source/XnDeviceSensorV2/XnUncompressedDepthProcessor.h
@@ -34,7 +34,7 @@
 class XnUncompressedDepthProcessor : public XnDepthProcessor
 {
 public:
-	XnUncompressedDepthProcessor(XnSensorDepthStream* pStream, XnSensorStreamHelper* pHelper, XnFrameBufferManager* pBufferManager);
+	XnUncompressedDepthProcessor(XnSensorDepthStream* pStream, XnSensorStreamHelper* pHelper);
 	virtual ~XnUncompressedDepthProcessor();
 
 protected:
diff --git a/Source/XnDeviceSensorV2/XnUncompressedYUVImageProcessor.cpp b/Source/XnDeviceSensorV2/XnUncompressedYUVImageProcessor.cpp
index 6727f30..3c0f311 100644
--- a/Source/XnDeviceSensorV2/XnUncompressedYUVImageProcessor.cpp
+++ b/Source/XnDeviceSensorV2/XnUncompressedYUVImageProcessor.cpp
@@ -29,8 +29,8 @@
 // Code
 //---------------------------------------------------------------------------
 
-XnUncompressedYUVImageProcessor::XnUncompressedYUVImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper, XnFrameBufferManager* pBufferManager) :
-	XnImageProcessor(pStream, pHelper, pBufferManager)
+XnUncompressedYUVImageProcessor::XnUncompressedYUVImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper) :
+	XnImageProcessor(pStream, pHelper)
 {
 }
 
diff --git a/Source/XnDeviceSensorV2/XnUncompressedYUVImageProcessor.h b/Source/XnDeviceSensorV2/XnUncompressedYUVImageProcessor.h
index fcba971..3102105 100644
--- a/Source/XnDeviceSensorV2/XnUncompressedYUVImageProcessor.h
+++ b/Source/XnDeviceSensorV2/XnUncompressedYUVImageProcessor.h
@@ -34,7 +34,7 @@
 class XnUncompressedYUVImageProcessor : public XnImageProcessor
 {
 public:
-	XnUncompressedYUVImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper, XnFrameBufferManager* pBufferManager);
+	XnUncompressedYUVImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper);
 	~XnUncompressedYUVImageProcessor();
 
 	//---------------------------------------------------------------------------
diff --git a/Source/XnDeviceSensorV2/XnUncompressedYUVtoRGBImageProcessor.cpp b/Source/XnDeviceSensorV2/XnUncompressedYUVtoRGBImageProcessor.cpp
index cb4b2f8..24ccea3 100644
--- a/Source/XnDeviceSensorV2/XnUncompressedYUVtoRGBImageProcessor.cpp
+++ b/Source/XnDeviceSensorV2/XnUncompressedYUVtoRGBImageProcessor.cpp
@@ -30,8 +30,8 @@
 // Code
 //---------------------------------------------------------------------------
 
-XnUncompressedYUVtoRGBImageProcessor::XnUncompressedYUVtoRGBImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper, XnFrameBufferManager* pBufferManager) :
-	XnImageProcessor(pStream, pHelper, pBufferManager)
+XnUncompressedYUVtoRGBImageProcessor::XnUncompressedYUVtoRGBImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper) :
+	XnImageProcessor(pStream, pHelper)
 {
 }
 
diff --git a/Source/XnDeviceSensorV2/XnUncompressedYUVtoRGBImageProcessor.h b/Source/XnDeviceSensorV2/XnUncompressedYUVtoRGBImageProcessor.h
index 850377b..a148edf 100644
--- a/Source/XnDeviceSensorV2/XnUncompressedYUVtoRGBImageProcessor.h
+++ b/Source/XnDeviceSensorV2/XnUncompressedYUVtoRGBImageProcessor.h
@@ -34,7 +34,7 @@
 class XnUncompressedYUVtoRGBImageProcessor : public XnImageProcessor
 {
 public:
-	XnUncompressedYUVtoRGBImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper, XnFrameBufferManager* pBufferManager);
+	XnUncompressedYUVtoRGBImageProcessor(XnSensorImageStream* pStream, XnSensorStreamHelper* pHelper);
 	~XnUncompressedYUVtoRGBImageProcessor();
 
 	XnStatus Init();

-- 
openni-sensor-primesense packaging



More information about the pkg-multimedia-commits mailing list