Changed license to New BSD License.
Added tests and add_gtest_executable().
Added reentry guards.