shifted some functions around
added a small test program and modified CMakeLists.txt