Restored some of the tests, fixed issues and added template_index.hpp.. Still in the middle of big changes