changed path generation to dynamic