Initial versions of summary data generation.
Added recursion methods and SQL changes
version for pushing to branch, has memory leak