Changed some code for path generation to a more generic approach.