added passing filepath as parameter