Feature/dynamic

Merge the work for dynamic parallelization including some bug fixes in to the main line.