split cpp functions into files, added R and src directories