register build_index_cpp through R's mechanism
move subset to headers
moved code to headers. closes #87